Theory Ast_Tests
theory Ast_Tests
imports TIGER_Grammar.LR_Prec_Parse Parser_Check
begin
section ‹⬚‹parser (ast)›: the tree, no decoder›
text ‹⬚‹parser (ast) p for G› returns the tree of \<^const>‹dparse› and ignores the
actions: ‹p.sound› says the tree is the erasure of a parse tree of the word,
‹p.complete› that the erasure of every parse tree is returned for its yield.›
fun toks :: ‹nat ⇒ 'tok list ⇒ ('tok, unit) token list› where
‹toks i [] = []›
| ‹toks i (x # xs) = ⦇tok = x, span = span.make 0 i i 1 []⦈ # toks (Suc (Suc i)) xs›
text ‹A token at a line and a column.›
definition tk :: ‹nat ⇒ nat ⇒ 'tok ⇒ ('tok, unit) token› where
‹tk l c x = ⦇tok = x, span = span.make l c c 1 []⦈›