Theory TIGER_Rules
theory TIGER_Rules
imports TIGER_Lexer.TIGER_Spec
begin
section ‹Rule actions from mode operations›
text ‹Rule actions built from three parts: the token kind of the lexeme, a guard on the
lexeme and an effect on the mode stack. The
effects are flex's: keep the stack, replace the top (‹BEGIN›), push or pop
\<^cite>‹‹Sect.~10› in "paxson2026-flex-manual"›, or any function on the stack.
A hook of type \<^typ>‹'k option ⇒ 'm ⇒ 'm› computes the new top from the kind of
the lexeme when the rule names no mode. It is lex's user flag
\<^cite>‹‹Sect.~10› in "lesk1975-lex"› made pure: a flag set in every action is a
function of the token.›