|Implementation decision email@example.com (Michael Risse) (1998-09-22)|
|Re: Implementation decision firstname.lastname@example.org (1998-09-22)|
|Re: Implementation decision email@example.com (Quinn Tyler Jackson) (1998-09-26)|
|Re: Implementation decision firstname.lastname@example.org (Michael McKernan) (1998-09-26)|
|From:||email@example.com (Dwight VandenBerghe)|
|Date:||22 Sep 1998 22:30:57 -0400|
On 22 Sep 1998 14:34:24 -0400, Michael Risse
>Another way is for example writing down this analysis in the
>attributed grammar ?
If you have real attributes (that is, something better than
L-attributed, which is what you get for free in a left-to-right parse)
then attributes are a great way to go. Take a look at Eli, and you'll
find that it's only a few lines of code to do it right.
On the other hand, if you don't have attributes, then you need to do
it yourself somehow. I recently wrote a parser that needed a lot of
this kind of work done, and I wrote up the constraints in the form of
a text file. Then I wrote an awk program to turn the text file of
constraints into a table (and a function) that, when called with a
bitfield of all the found words, returned an indication of the
validity of the combinations. The generated function is nearly a
thousand lines, in the form of a hash table that contains one entry
for every valid combination of words (in other words, the hash key is
the bitfield value of all valid words or'ed together, and the value
part of the table is a list of other things that might need to be
looked at in certain special cases). This has worked out so well in
practice - the text file is so readable, by comparision to other
techniques - that I think I'll use again whenever I need to find out
the valid combinations of things.
Return to the
Search the comp.compilers archives again.