good day,
fortran supports "if construct" with following syntax:

[name:] if (..) then
 [block]

else if (..) [name:] then
 [block]....

else if (..) [name:] then
 [block]
else [name:]
 [block]
end if [name]

for example:
 firstIf : if (a>10) then
 a = 10
 else if (b>10) : secondIf then
 b = 10;
 else secondif:
 b = 20;

 else firstif:
 a = 20;
 endif firstif

My parser:
 if_construct : if_then_stmt block? (else_if_stmt block)* (else_stmt 
block)? endif_stmt
 -> "if_construct "

if_then_stmt, else_if_stmt, else_stmt and endif_stmt contain "name" 
attribute...
so... i gave you an example, when my parser creates second if_stmt with 
!!! 2 else stmt's (not one) !!! it context-sensitive place of grammar. 
it depends on the "name" attribute. if it name= firstif then "else_if" 
it belongs to first if_stmt.
if name=secondif, it belongs to second if_stmt...

how can I modify the grammar, to get right AST. how to analize [name] 
attribute at make right desicion?

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to