There is a trick for parsing &quot;indented&quot; syntax which is not covered by this tutorial: the lexer (not the parser) keeps track of indentation. Lexer inserts Indent and Descent tokens, which the parser considers like { and } tokens in a C syntax language.<p>Now your parser implements a context-free grammar although the language is not context-free.