Parsing D Maybe Not Such a Good Idea <_<;

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 15 12:20:51 PDT 2016


On 15-Jun-2016 12:37, Shachar Shemesh wrote:
> On 15/06/16 08:27, H. S. Teoh via Digitalmars-d wrote:
>> IMHO, you're thinking about this at the wrong level of abstraction.
>
> I tend to agree.
>
>>
>> The first order of business, before you even think about parsing, should
>> be to tokenize (or lex) the input. This is the stage where you break up
>> the input into atomic chunks: keywords, parentheses, commas,
>> identifiers, etc.. Comments can simply be scanned once and discarded.
>
> No. The lexer is, typically, a regular language. /+ +/ comments are not
> parsable using a regular language.
>

Scanner can easily be non-regular.

> Shachar


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list