simple ambigous grammar...

abate@zed.students.cs.unibo.it ()
21 Aug 2000 00:06:07 -0400

          From comp.compilers

Related articles
simple ambigous grammar... abate@zed.students.cs.unibo.it (2000-08-21)
Re: simple ambigous grammar... llkparsing@aol.com (2000-08-27)
Re: simple ambigous grammar... rkrayhawk@aol.com (2000-08-27)
Re: simple ambigous grammar... gvmt@bgl.vsnl.net.in (Venkatesha Murthy G.) (2000-08-27)
| List of all articles for this month |
From: abate@zed.students.cs.unibo.it ()
Newsgroups: comp.compilers
Date: 21 Aug 2000 00:06:07 -0400
Organization: Compilers Central
Keywords: parse
User-Agent: slrn/0.9.6.2 (Linux)

Hi,
I'm trying to write a yacc spec to parser expression like this
a = a.e.r.t + o.o + o o = p.p + r.t.w + o + h + d d = y


[ with some syntactic sugar it looks like :
a = ( a.e.r.t ) + (o.o) + (o)
o = ( p.p ) + ( r.t.w ) + o + h + d
d = y
]


So I've written this simple grammar...
AL -> AL A | A
A -> ID = E
E -> E + T | T
T -> T . F | F
F -> ID


But since I've no delimiters between expression,
and yacc has only one lookahead, this does not work.
Which is the right grammar to parser my expression ?


TXH,
pietro
--
Undergraduate student of Computer Science - ALMA MATER STUDIORUM Bologna -
Alias: coc0526@iperbole.bologna.it


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.