Parsing indention based language?

Martin v. Loewis martin at v.loewis.de
Sat Apr 20 19:24:40 EDT 2002


"Philipp Lenssen" <lenssen at hitnet.rwth-aachen.de> writes:

> I was wondering if anybody knows any elegant approaches.

I recommend to use the same approach that Python uses: process
indentation on the lexical level. That is, the lexer ought to create
NEWLINE, INDENT and DEDENT tokens. Then you can describe the syntax
with a traditional grammar, and apply traditional parser/code
generator technology.

HTH,
Martin




More information about the Python-list mailing list