Let's stop parser Hell

Timon Gehr timon.gehr at gmx.ch
Wed Jul 11 06:50:48 PDT 2012


On 07/11/2012 10:23 AM, Christophe Travert wrote:
> Timon Gehr , dans le message (digitalmars.D:171814), a écrit :
>> On 07/11/2012 01:16 AM, deadalnix wrote:
>>> On 09/07/2012 10:14, Christophe Travert wrote:
>>>> deadalnix , dans le message (digitalmars.D:171330), a écrit :
>>>>> D isn't 100% CFG. But it is close.
>>>>
>>>> What makes D fail to be a CFG?
>>>
>>> type[something]<= something can be a type or an expression.
>>> typeid(somethning)<= same here
>>> identifier!(something)<= again
>>
>> 'something' is context-free:
>>
>> something ::= type | expression.
>
> Do you have to know if something is a type or an expression for a simple
> parsing?

No. Some token sequences can be both a type and an expression based on
the context (the CFG is ambiguous), but that is the analysers business.
Parsing D code does not require any kind of analysis.

> The langage would better not require this, otherwise simple
> parsing is not possible without looking at all forward references and
> imported files.


More information about the Digitalmars-d mailing list