help-bison
[Top][All Lists]
Advanced

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

Recognize grammar prefix.


From: Necrosoft
Subject: Recognize grammar prefix.
Date: Sun, 13 Jan 2008 19:19:43 +0100

HI

I would like to recognize a "prefix of a grammar" from an input sequence.
You can assume that lex reads a string to be recognized from a file. In
"interactive mode" the "prefix" is not a problem because a valid sequence is
recognized "step by step" when we insert an Input.

for example I have:

S1: token1 S2
S2: token2 S3 | token3 S2
S3: token4 ....

Now, If I call bison and I try to validate "token1 token2" sequence, the
parser fails because token2 must be followed by S3, but in my situation lex
have no others tokens for bison at a certain moment...I want to validate
this type of sequence (a "prefix" of terminal-symbol sequence...In others
words is a "part" of a valid sequence...). Obviously it work if I change my
grammar:

 S1: token1 S2
S2: token2 | token2 S3 | token3 S2

...but the only way is rewrite the grammar or exist others solutions in
Bison?

Many Thanks.

Bye


reply via email to

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