Related articles |
---|
Simple Expression Recursion vs Expression/Term/Factor stoggers@uniquest.demon.co.uk (Mike Stogden) (2001-08-02) |
Re: Simple Expression Recursion vs Expression/Term/Factor Mark.van.den.Brand@cwi.nl (M.G.J. van den Brand) (2001-08-06) |
Re: Simple Expression Recursion vs Expression/Term/Factor kvinay@ip.eth.net (Vinay Kakade) (2001-08-06) |
Re: Simple Expression Recursion vs Expression/Term/Factor lucadesantis@infinito.it (luca) (2001-08-06) |
Re: Simple Expression Recursion vs Expression/Term/Factor gregod@cs.rpi.edu (Douglas Gregor) (2001-08-06) |
Re: Simple Expression Recursion vs Expression/Term/Factor joachim_d@gmx.de (Joachim Durchholz) (2001-08-08) |
Re: Simple Expression Recursion vs Expression/Term/Factor lucads@xoommail.xoom.it (Luca) (2001-08-08) |
[1 later articles] |
From: | "Mike Stogden" <stoggers@uniquest.demon.co.uk> |
Newsgroups: | comp.compilers |
Date: | 2 Aug 2001 02:46:18 -0400 |
Organization: | Compilers Central |
Keywords: | syntax |
Posted-Date: | 02 Aug 2001 02:46:17 EDT |
Hi,
Please could someone offer an explanation as to the relative merits of
describing expressions as productions based on two comparable
specifications?
I have seen expressions for the same language described as...
expr -> expr + expr
expr -> expr * expr
etc...
alternatively...
expr -> expr + term
term -> factor | term * factor
factor -> number | identifier
etc...
Just by working through these rules by hand I suspect that they pass the
same language constructs - so what are the relative merits of each approach?
Regards,
Mike Stogden.
[They both define the same language, but the first form has many parses
for any input string while the second defines a unique parse for each
input. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.