Converting from Yacc/Lex

Apr 21, 2012 at 10:12 PM

I have a grammar in Yacc/Lex that I would like to convert to Irony (and also convert the entire program from C to C# mind you xD), but I've stumbled across one thing that I don't know how to handle.

The parser-file (parser.y) has stuff like this defined:

block_statement:
    LEFT_CURLY_BRACKET
        {
             EnterNestedScope();
        }
    statement_list RIGHT_CURLY_BRACKET
        {
             $$ = MakeBlockStatement($2);

             LeaveScope();

 }
;
How would I go about achieving the same thing in Irony?

Coordinator
Apr 23, 2012 at 5:20 PM

the fragment you show, as far as I can guess, mixes syntax rule (block= "{" + stmt_list + "}" ), and interpreter, runtime rule (create nested scope when entering the block). 

The syntax rule in Irony is expressed the usual way.

Scope creation - it should be done by an AST node for a block element, this is part of interpreter behavior.