Hello Ben,

so you finished the while without problems?

For the if/else/else if, I think it would be something like this:

statement = IF LBRACK expression RBRACK LCUR statements RCUR optelse
          | ... other statements ...

optelse = elseif
        | else
        |

elseif = ELSE IF LBRACK expression RBRACK LCUR statements RCUR optelse

else = ELSE LCUR statements RCUR

I haven't tried it, but something like this could work...

Dennis



comsatcat wrote:
> I actually figured out what I was trying to do...  to clarify I was 
> having issues with parsing a statement that looked like so:
>  
> while(expression) {
>     expressions
> }
>  
> I've gotten a lot of the langage done and a processor written for 
> parsing the AST.  One thing I'm having trouble with is how to handle 
> the equiv of an if else statement...
>  
> in my parser I have a statement that looks for:
> if (expression) {
>     statements
> }
>  
> and
>  
> if (expression) {
>     statements
> } else {
>     statements
> }
>  
> My problem is how do I handle an else if statement since there can be 
> an unlimited number of else if's.. ie:
>  
> if(expression) {
>     statements
> } else if (expression) {
>     statements
> } else if (expression) {
>    statements
> } else {
>     statements
> }
>  
> I'm not sure how I would put together the AST and determine which else 
> if are related to which if statement.
>  
> Let me know if that makes sense and if so if you have any ideas how to 
> parse and process that.
>  
> Thanks,
> Ben
>  
>
>     On Feb 16, 2009 12:22 AM, "D.Hendriks (Dennis)" <[email protected]
>     <mailto:[email protected]>> wrote:
>
>     Hello,
>
>     > handle looping events
>
>     > handle looping symantex in ply
>
>     I don't really understand what you mean by "looping events"? Can
>     you give an example of something with looping events that you
>     would like to parse?
>
>     Also, it's "semantics", not "symantex"...
>
>     Dennis comsatcat wrote: > > Dennis, >   > Thank you for all the
>     feedback.  I RTFM'ed a lot and h...
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ply-hack" 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/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to