help-bison
[Top][All Lists]
Advanced

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

Re: Whether to Parser


From: Matthias Simon
Subject: Re: Whether to Parser
Date: Sat, 13 May 2017 19:03:23 +0200

Hi,

although the second solution is simpler, I'd go with the first one.
As soon as you plan to extend the grammar, for example by allowing user
defined types or expressions as initialization-value, you'll run into
trouble:

    // parser has no idea if `mytype` requires an INT_CONST
    mytype x = 23
 
    // ensuring type-compatibility makes grammar quite complicated
    float f = 23.5 + 'a'

It's a good practice to keep grammar rather general and deal with the
semantics (like type-compatibility) in a later semantic-phase.

Cheers,
Matthias




reply via email to

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