[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
can i rewrite yyparse() based on ACTION and GOTO tables extracted from X
From: |
elite liu |
Subject: |
can i rewrite yyparse() based on ACTION and GOTO tables extracted from XML output? |
Date: |
Thu, 14 Oct 2021 18:30:54 +0800 |
Hi Guys:
Because of customization necessaries, i want to rewrite yyparse() based on
ACTION and GOTO tables -- a more straightforward way, just like the classic
compiler book does, and ignore error recovery.
bison is more complex due to efficient consideration.
I notice bison can dump XML-format output. In XML output file, symbols
both terminals and nonterminals, rules are record. shifts, reduce , and
goto actions, conflicts are fully listed.
But i don't know whether the information are complete enough to create a
big ACTION table and GOTO table based on xml extraction, where conflicts
are solved like precedence, %nonassoc, and %right and %prec can be well
treated from the table guided actions. I try to store ACTION table and
GOTO table using std::map. Efficiency is not a focus.
Another problem is: there is a check on shift/goto action. For shift
action, if yycheck[yypact[state] + sym] != sym,then it will redirect to
"reduce" action.
i don't know such process is intended for error handling, or a part of
regular design? if the latter, please tell me more.
command to dump XML:
bison bison.y --debug --output=bison_parser.cpp -x --report=all
--defines=bison_parser.h --verbose -Wconflicts-rr
Regards,
Levin
- can i rewrite yyparse() based on ACTION and GOTO tables extracted from XML output?,
elite liu <=