Re: [cedet-semantic] Is there a wisent analog to Bison %empty non-empty rule?
Brought to you by:
zappo
From: Christian J. <chr...@cv...> - 2020-06-14 20:38:29
|
Hi Eric! Alright, I don’t just want to create tags, I would like to build a complete AST equivalent of the PHP AST. Can you improve the Wisent q > 13 juni 2020 kl. 21:36 skrev Eric Ludlam <er...@si...>: > > Hi Christian, > > Using %prec, etc doesn't occur much in Wisent grammars because the usual use case is to generate tags, and not evaluate code that requires precedence. If your goal is to just generate tags, there is a good chance you can just ignore the %prec pieces of the rule. If the precedence is not used in expressions used after an equal, then you may be able to just delete the whole rule backup_fn_flags. > > A quick read of bison %empty indicates it can be safely left out as well, so if you need to keep the rule, just delete %empty. > > Hope this helps. > Eric > >> On 6/6/20 1:47 AM, Christian Johansson wrote: >> Hi! >> I'm translating the PHP bison grammar to wisent and currently I'm stuck at a rule that looks like this: >> backup_fn_flags: >> %prec PREC_ARROW_FUNCTION %empty { $$ = CG(extra_fn_flags); CG(extra_fn_flags) = 0; } >> ; >> The %prec symbol seems to work with Wisent but for the %empty I get the message "wisent-parse-nonterminals: Symbol ‘%empty’ is used, but is not defined as a token and has no rules" >> Is it possible to solve this? >> For empty %empty rules I just replace %empty with ;; empty\n but I don't know what to do when there are other nonterminals in the rule |