help-bison
[Top][All Lists]
Advanced

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

Semantic parsing


From: REFSTRUP,JACOB (HP-Vancouver,ex1)
Subject: Semantic parsing
Date: Fri, 19 Apr 2002 23:17:57 -0400

Greetings,

I'm working on some parsing project that currently utilizes a hand written
parser for some semantic parsing. Since that's hard to maintain I'd like to
move to bison so I have the following questions:

1) I understand that bison does have semantic parsing (via %semantic_parser)
but also noticed that there's some concern as to whether that code should be
used or not.
2) If I can use %semantic_parser then what's the syntax? I've been looking
around but haven't found anything.
3) If I shouldn't use %semantic_parser then how do I go about it? My
semantic "conflicts" are relatively simple so perhaps someone can just point
out to me how to approach it.

name:
        IDENT
        ;

keyword:
        IDENT
        ;

color:
        IDENT
        ;

combination:
          name 
        | keyword
        | color
        ;

Current the strings for names, keywords and colors are non-overlapping but
they may be in the future. I need to enable productions suchs as

complex:
          keyword [ limit to certain keywords ] color
        | color keyword
        ;

This is not an exact grammar but I think you get the point - I need to
reject rules and backup a number of tokens.

Any help is greatly appreciated,
Regards,

Jacob Refstrup
Hewlett-Packard



reply via email to

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