Theory Parser_Example
section ‹Examples›
theory Parser_Example
imports LL1_Parser_show "Show.Show_Instances"
begin
text‹In this section we present two examples for LL1-grammars to show how the
parser generator can be used to create a parse tree from a sequence of symbols.›
subsection ‹Mini-language›
text‹The first example is based on Grammar 3.11 from Appel's ``Modern Compiler
Implementation in ML''~\cite{DBLP:books/cu/Appel1998ml}:
S @{text →} if E then S else S | begin S L | print E
L @{text →} end | ; S L
E @{text →} num = num
›