help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tokenising dedents


From: Stuart Reynolds
Subject: Tokenising dedents
Date: Mon, 7 Jan 2002 13:05:44 -0000

I'm new to (f)lex and I'd like to experiment writing a new language using a
syntax similar to Python (but with strong typing). However, I'm not know how
(or even whether) you can use flex for tokenising dedents.

E.g.

while true:
   print
   print

print "Done"

Should generate something like the following tokens:

WHILE
BOOL
":"
NEWLINE
INDENT
  PRINT
  NEWLINE
  PRINT
  NEWLINE
DEDENT
PRINT
STRING
NEWLINE


Any ideas?

Cheers,
Stuart

PS. Had a look in the through the Python distribution and could only find
the source for the grammar.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]