help-bison
[Top][All Lists]
Advanced

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

Re: Question about Lexx & Yacc


From: Hans Aberg
Subject: Re: Question about Lexx & Yacc
Date: Fri, 12 Jan 2001 20:11:00 +0100

At 15:20 -0700 1-01-11, Nattapong wrote:
>please take a look at my "ch1-05.y".
...
>%token NOUN PRON VERB ADV ADJ PREP CONJ
>
>%%
>
>sentence: subject VERB object { printf ("Sentence is valid.\n"); }
>   ;
>
>subject:     NOUN
>       |    PRON
>       ;
>object:        NOUN
>       ;
>%%

If you intent is to write a parser for the English language, there is
already a large project for that going on, see for example
  http://lands.let.kun.nl/TSpublic/tosca/

One problem is that the same English word (or group of words) may have a
set of different token values. Bison cannot handle this; an interesting
question is how to modify Bison so that it can.

The same problem happens when implementing the grammar used in common
mathematics -- I once write a simple recursive decent parser that could
handle such a situation.

With the current Bison, you could handle the situation by letting the Bison
grammar sending back context information to the (F)lexer.

  Hans Aberg





reply via email to

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