[antlr-interest] Problem with Tree Grammar
NickAl at discovery.co.za
Fri Apr 13 05:43:56 PDT 2012
Hi i'm building a tree grammar for my AST
I have 2 rules
^(IF expression ^(THEN statement+) elsif_statement+ ^(ELSE statement+))
^(ELSIF expression statement+)
This seems to be a problem although I can construct the AST using this
IF ifexpr=expression THEN ( thenstats+=statement SEMI )+
( ELSIF elseifexpr=expression THEN ( elseifstats+=statement SEMI )+ )*
( ELSE ( elsestats+=statement SEMI )+ )?
-> ^(IF $ifexpr ^(THEN $thenstats+) ^(ELSIF $elseifexpr $elseifstats*)* ^(ELSE $elsestats*)?)
Which works fine.
Does anyone have any ideas how to address this?
Discovery is an authorised financial services provider.
The information in this email is confidential and may have legal privileges. We intend it only for the use of the individual or entity we've addressed the communication to. If you've received this email by mistake please delete it and tell the sender. We forbid any unauthorised use, change, disclosure or sending of the contents of this email (including its attachments), whether in part or as a whole, unless consented to in writing by the sender, as it may be unlawful.
We cannot guarantee this email has no malicious coding.
We reserve the right to check, intercept and block emails or take any other action according to our email etiquette.
Discovery will not be liable for any delivery delay, loss, harm, disruption or data corruption that may arise from this email.
A full list of company directors is available on our website at: https://www.discovery.co.za/index_login.jhtml?p_content=/investor_relations/directorate.jhtml - or to get this list by email, please email directors_list at discovery.co.za
More information about the antlr-interest