Re: bison and/or antlr ?

George Neuner <gneuner2@comcast.net>
Mon, 16 Jul 2007 21:43:16 -0400

          From comp.compilers

Related articles
[3 earlier articles]
Re: bison and/or antlr ? cfc@shell01.TheWorld.com (Chris F Clark) (2007-07-02)
Re: bison and/or antlr ? tom@infoether.com (Tom Copeland) (2007-07-03)
Re: bison and/or antlr ? gneuner2@comcast.net (George Neuner) (2007-07-04)
Re: bison and/or antlr ? cfc@shell01.TheWorld.com (Chris F Clark) (2007-07-07)
Re: bison and/or antlr ? gneuner2@comcast.net (George Neuner) (2007-07-09)
Re: bison and/or antlr ? cfc@shell01.TheWorld.com (Chris F Clark) (2007-07-13)
Re: bison and/or antlr ? gneuner2@comcast.net (George Neuner) (2007-07-16)
| List of all articles for this month |

From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.compilers
Date: Mon, 16 Jul 2007 21:43:16 -0400
Organization: Compilers Central
References: 07-06-071 07-07-008 07-07-013 07-07-031 07-07-036 07-07-052
Keywords: parse, tools
Posted-Date: 18 Jul 2007 20:02:38 EDT

On Fri, 13 Jul 2007 11:20:29 -0400, Chris F Clark
<cfc@shell01.TheWorld.com> wrote:


>George Neuner <gneuner2@comcast.net> writes:
>
>> Just to be sure, you are referring to _semantic_ predicates? ...
>> I do find _syntactic_ predicates to be indispensable, ...
>
>No, I was actually referring to syntactic predicates. I agree that
>they are sometimes indispensable, but they also put little loop-holes
>in your grammar, where something in one context parses one way (means
>one thing) and in a different context parses (means) another.


I actually make use of syntactic predicates to deliberately restrict
reuse of subgrammars where there is a possibility of semantic
confusion.




>problem is (particularly with PEG's, which are syntactic predicates on
>steroids) is that there is no check to verify that you haven't
>introduced some corner case you didn't intend to. I don't think that
>there are any PEG generators that even warn you if some rule is
>unreachable. That scares me.


It would scare me also. But I don't use PEGs and that may be why I
like syntax predicates more than you do - I find them indispensable
for CFG. I have rarely written grammars so complex that I couldn't
analyze them with moderate effort - though a DICOM parser I once wrote
pushed the limits.




>By the way, I do feel the same about the precedence and associativity
>declarations in LR parsing. They are great tools, but not for use
>with abandon. They also drop you off the cliff where your tool can't
>tell you that you have mis-specified what you want. Used with care
>that's okay. However, it is too easy to program carelessly.


Which is why I don't use declarations. Although it's more cumbersome
to code precedence hierarchies into the grammar, it's portable and it
makes the grammar easier (IMO) to analyze.


George



Post a followup to this message

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