[Top][All Lists]

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

Re: Lexer woes

From: Ben Pfaff
Subject: Re: Lexer woes
Date: Wed, 24 Sep 2008 08:34:59 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

John Darrington <address@hidden> writes:

> On Tue, Sep 23, 2008 at 09:19:26PM -0700, Ben Pfaff wrote:
>      I also think this would be nice to have.  It is a problem that I
>      did some work on a few years ago.  It is not too hard to write a
>      parser generator that accepts a context-free grammar for PSPP
>      syntax and outputs C code to parse it, and in fact I did most of
>      the work necessary for that.
> Really? As I understand it, the example that I've given means that the
> grammar is not context-free.

The grammars for many languages are not strictly context-free,
but compiler writers still write context-free grammars for them
and work around them in various ways.  The C language, for
example, famously is not context-free due to the syntax for
"typedef", but that does not stop us from using yacc to parse it.
(Usually, you add a little bit of intelligence to the lexer, and
that's what I planned to do too.)
Ben Pfaff

reply via email to

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