[antlr-interest] Example anyone?
Darach Ennis
darach at gmail.com
Tue Aug 21 08:53:07 PDT 2007
Hi Jeff,
SMC for java (smc.sourceforge.net) supports a similar syntax for
guarded transitions, however it does not use antlr. The (minimal) EBNF
may however be inspiring:
http://smc.cvs.sourceforge.net/smc/smc/net/sf/smc/SmcEBNF.txt?view=markup
Failing that, the state machines are available too:
http://smc.cvs.sourceforge.net/smc/smc/net/sf/smc/SmcLexer.sm?revision=1.8&view=markup
http://smc.cvs.sourceforge.net/smc/smc/net/sf/smc/SmcParser.sm?revision=1.17&view=markup
Perhaps try plugging in the java productions for boolean expressions
and see what happens
with your grammar above?
Regards,
Darach.
On 8/21/07, Barnes, Jeff <JB0284 at att.com> wrote:
> I'm looking to implement a language that has the following features (not
> complete):
>
> event :
> "@event" ID (POPEN args PCLOSE)?
> ( SQBOPEN guardExpr SQBCLOSE )? TRANSITION ID
> ( SLASH actionExpr )?
> ;
>
> args :
> ID ID ( ',' ID ID )*
> ;
>
> POPEN : "(";
> PCLOSE : ")";
> SQBOPEN : "[";
> SQBCLOSE : "]";
> TRANSITION: "->";
>
>
> I'm having a little trouble figuring out how to do the guardExpr because
> it can have SQBCLOSE in it (an array index for example). I like the way
> UML specifies guard expressions, so I'd like to stick with that. But the
> guardExpr can be any valid java boolean expression.
>
> Is this going to be like the example for javadoc comments? Or is there
> another more pertinent example.
>
> Thanks for any pointers.
>
> Jeff
>
More information about the antlr-interest
mailing list