[antlr-interest] parsing the matlab language

Ron Burk ronburk at gmail.com
Thu Apr 14 07:44:38 PDT 2011


Couldn't find a rigorous language spec for matlab,
but it kinda looks like the lexer can handle the distinction
by remember the previous token type returned. (e.g.,
if the previous token type was X, or X., or ), then the
single quote is an operator instead of a string -- the exact
rule depends on the exact language spec).

Obviously, you don't want the parser trying to piece
together a quoted string out of whatever (possibly illegal!)
tokens appeared inside it, so this is a job for the lexer.


More information about the antlr-interest mailing list