Re: dynamic yacc-tables? (Joshua Levy)
Tue, 13 Aug 1991 17:26:18 GMT

          From comp.compilers

Related articles
dynamic yacc-tables? (1991-08-12)
Re: dynamic yacc-tables? (1991-08-13)
Re: dynamic yacc-tables? (1991-08-13)
Re: dynamic yacc-tables? (1991-08-13)
Re: dynamic yacc-tables? (1991-08-13)
Re: dynamic yacc-tables? (Kjell Post) (1991-08-14)
Re: dynamic yacc-tables? (1991-08-16)
| List of all articles for this month |

Newsgroups: comp.lang.c,comp.compilers
From: (Joshua Levy)
Keywords: parse, yacc
Organization: VERITAS Software
References: 91-08-043
Date: Tue, 13 Aug 1991 17:26:18 GMT

In article 91-08-043 (Ercument Canver) writes:
>I got the following problem: I need to extend the parse tables generated
>by yacc dynamically during parsing a text. ...
>Background: I'm posting this request because I have to write a parser suitable
>for declaring mixfix operators and overloading.
>I'd also appreciate pointers to parser generaters dealing with this kinda
>problem (not necessarily yacc-like).

You may want to attack the problem with lex instead of yacc. Read:
PARSING DISTFIX OPERATORS by Edgar H. Sibley in Commmunications of the ACM
February 1986, Vol 29, num 2, page 118.
        The advantages of user-defined distfix operators -- a syntactic
        convenience that enhances the readability of programs -- can be
        obtained as an extension of almost any programming language without
        requiring dynamic changes to the parser.
        We have described a simple technique whereby a fixed BNF grammar can
        describe languages including user-defined infix, postfix, and distfix
        operators. The technique requires only that the parts of disfix
        operators be lexically distinguishable. ...
        The idea has been successfully implemented [with YACC] with minimal

Note that "lexically distinguishable" means that lex can look up the
answer in a table, which can grow dynamically. I'm not sure how Sibley's
ideas interact with overloading.

Joshua Levy (

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.