[antlr-interest] Interactive interpreter and line continuation characters
lars.vonwedel at bayertechnology.com
lars.vonwedel at bayertechnology.com
Thu Oct 23 03:18:26 PDT 2008
Hello,
I am trying to build an interactive interpreter shell for an application.
A simple approach is obviously to read a line from the command line and
send it to the lexer/parser. However, the input language permits line
continuation by special characters. If a line ends with a ';' or ',' it is
supposed to be continued on the next line.
To make things worse, some valid statements can end with multiple ','
characters. In this case, a special statement termination character '!' is
used(and can be followed by arbitrary input to be disregarded).
My current line of thinking is to send a line entered by the user to the
lexer, let it skip anything beyond '!' and then look at the last token. If
that is a ';' or ',' then obtain another line and concatenate the token
streams before actually running the parser.
Are there any better ideas how to deal with this ?
Freundliche Grüße / Best Regards
Lars von Wedel
_________________________________________
Bayer Technology Services GmbH
E-mail: lars.vonwedel at bayertechnology.com
Web: www.bayertechnology.com
Geschäftsführer: Achim Noack
Aufsichtsratsvorsitzender: Dr. Wolfgang Plischke
Sitz der Gesellschaft: Leverkusen | Eintragung: Amtsgericht Köln, HRB
49896
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081023/7d87ed4b/attachment.html
More information about the antlr-interest
mailing list