[antlr-interest] Expression parsing ideas for ANTLR v4

Sam Harwell sharwell at pixelminegames.com
Wed Jan 20 06:09:08 PST 2010


UnrealScript uses $ and @ for two types of string concatenation. It also has $= and @= to match.


-----Original Message-----
From: Johannes Luber [mailto:JALuber at gmx.de] 
Sent: Wednesday, January 20, 2010 6:08 AM
To: Sam Harwell; antlr-interest at antlr.org
Subject: Re: [antlr-interest] Expression parsing ideas for ANTLR v4

> Several expression parsers are limited to handling the binary operator
> portion of the expression. In addition to the obvious limitations, it
> poses an additional problem for languages like C++ where the assignment
> operators are split (in precedence) from the rest of the binary
> operators by the ternary operator (?:). My most complicated production
> ANTLR grammar (parses the UnrealScript language) currently uses a
> completely new expression parser that offers a great deal more
> flexibility than the previous approaches I tried. I don't think it's the
> end-all solution for integrating expression parsing into ANTLR for v4,
> but I believe it's a worthwhile example to show what's possible. Here
> are some pros and cons of the implementation:
> 
...
> 
> I'm very interested in any feedback y'all may have on this.
> 

As a layman in expression parsing I don't feel qualified to comment on if your solution lacks certain features, but the way you define the operators looks clean to me. One knows immediately how operators work in a given language. The only not obvious thing is if the precedence is ascending or descending. I guess ascending from my knowledge of C#.

BTW, which tokens are encoded as CATEQ and CAT2EQ?

Johannes
-- 
Preisknaller: GMX DSL Flatrate für nur 16,99 Euro/mtl.!
http://portal.gmx.net/de/go/dsl02


More information about the antlr-interest mailing list