resolving shift/reduce in ActionScript3

2008-11-26 Thread Matthias Kramm
Hi All, I'm writing a parser for ActionScript3, and I'm stuck with the following problem. In ActionScript, you can omit the semicolon (;). Furthermore, function pointers are allowed. I have the following (simplified) grammar: PROGRAM : EXPRESSION | PROGRAM ';' EXPRESSION | PROG

Re: resolving shift/reduce in ActionScript3

2008-11-26 Thread Matthias Kramm
On Wed, Nov 26, 2008 at 03:25:42PM +0100, Hans Aberg <[EMAIL PROTECTED]> wrote: > >state 1 > >4 EXPRESSION: T_IDENTIFIER . '(' EXPRESSION ')' > >5 | T_IDENTIFIER . [$end, T_IDENTIFIER, ';', '(', > >')', "++", "--", '+', '-', '/'] > >'(' shift, and go to state 5 > >'('

Two-pass parser or AST with Bison?

2009-01-06 Thread Matthias Kramm
Hi All, I'm still busy compiling ActionScript 3.0, which, among others, supports forward function calls: function bar() { foo("", 3) } function foo(s:String, i:int) { } In order to properly resolve these (and check for correct arguments), I can currently think about three

Re: Two-pass parser or AST with Bison?

2009-01-06 Thread Matthias Kramm
Hi Evan, thanks for the many tips! On Tue, Jan 06, 2009 at 09:57:34AM +, Evan Lavelle wrote: > I had a lot of this, but I mainly put it in the C++ code called from the > actions, where it was a trivial addition - if you're in the wrong pass, > you just return. Right now, I do a lot in t

Re: Two-pass parser or AST with Bison?

2009-01-30 Thread Matthias Kramm
On Tue, Jan 06, 2009 at 03:22:53PM +, Evan Lavelle wrote: > >I'll probably define myself some C macros so that I can at least > >write something like > >E = E '+' E {pass2only append($1);append($3);append(OP_ADD);} > >. > >But it would of course be more nifty if the default behaviour > >