[Top][All Lists]

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

Re: Any help needed?

From: Kaz Kylheku
Subject: Re: Any help needed?
Date: Tue, 08 May 2018 09:31:19 -0700
User-agent: Roundcube Webmail/0.9.2

On 2018-05-08 04:03, Vlad Vladov wrote:
Good day,
I am interested in contributing to the project. Is there anything I can
help with?

Hi Vlad,

Bison/Yacc has an annoying limitation. When you call yyparse, it parses the entire grammar down to the start symbol.

Sometimes you just want to parse a subtree of the grammar.

Like say you have a full programming language grammar, and you want to provide a function to parse regular expressions (which are in that grammar, represented as a "regex" symbol).

Currently, some ugly hack has to be used, like the insertion of a "secret token" which is recognized by the top-level production.

The parser generator could just automate this. Suppose we could give a list of additional starts:

%start regex /* additional comma separated non-terminals listed here */

then we have a yyparse_regex(...) entry point we just call to parse a regex. No programmer-visible secret tokens or anything of the sort. (All the yyparse_* functions have the same arg signature; they probably just do some special setup and recurse into yyparse.)

Cheers ...

reply via email to

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