help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LALR Grammar help


From: Hans Aberg
Subject: Re: LALR Grammar help
Date: Wed, 24 Aug 2005 00:00:42 +0200


On 23 Aug 2005, at 23:32, Michael Schidlowsky wrote:

I am working on a LALR grammar and am relatively knew to the craft of
writing LALR grammars.  The grammar is for a procedural style
programming language that looks like java, and includes an additional
block appended to the text which is where the program should start (the
equivalent of a main method, but outside the class).

I'm including the grammar file below. I'd appreciate help in two areas:

1. How can I include support for procedure calls in addition to function
calls?  Right now CUP generates a parser that recognizes

a = myclass.fun(b);

but not

myclass.fun(b);

There is a Yacc-grammar for C++:
http://www.parashift.com/c++-faq-lite/compiler- dependencies.html#faq-38.11
You might check how it is resolved there.

2. Are there any parts of the grammar that those of you with more
experience would recommend that I do differently?  I'm not only
interested in getting this to work properly, but in the craft of grammar writing in general, and in making this as clear as possible to the user
or the grammar.


Fewer rules makes a more comprehensible grammar. Sometimes token precedences can be used.

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]