Re: Question about token stack

Hegedüs Ervin <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
Hi Akim,

thanks again,

On Sun, Aug 30, 2020 at 06:19:09PM +0200, Akim Demaille wrote:
> > Le 30 août 2020 à 18:06, Ervin Hegedüs <[email protected]> a écrit :
> > 
> > the documentation shows:
> > 
> > https://www.gnu.org/software/bison/manual/html_node/Enabling-Traces.html
> > 
> > the option -t (POSIX Yacc compliant)
> > 
> > the option --debug (Bison extension)
> 
> Have a look at Bison's examples (e.g. https://github.com/akimd/bison/tree/master/examples/c/calc) and in particular:
> 
> https://github.com/akimd/bison/blob/b63e3a3352ea13074c5491e40f92b40ce0552004/examples/c/calc/calc.y#L26
> 
> https://github.com/akimd/bison/blob/b63e3a3352ea13074c5491e40f92b40ce0552004/examples/c/calc/calc.y#L100


oh my... thanks, now it's clear.

Here is the result:

Starting parse
Entering state 0
Stack now 0
Reducing stack by rule 1 (line 41):
-> $$ = nterm config ()
Entering state 1
Stack now 0 1
Reading a token
Next token is token T_CONFIG_DIRECTIVE ()
Shifting token T_CONFIG_DIRECTIVE ()
Entering state 4
Stack now 0 1 4
Reading a token
Next token is token T_CONFIG_DIRECTIVE_ARGUMENT ()
Shifting token T_CONFIG_DIRECTIVE_ARGUMENT ()
Entering state 11
Stack now 0 1 4 11
Reducing stack by rule 8 (line 57):
   $1 = token T_CONFIG_DIRECTIVE ()
   $2 = token T_CONFIG_DIRECTIVE_ARGUMENT ()
This is a configuration directive and argument: 'ConfKey1' 'foo'
-> $$ = nterm config_directive_line ()
Entering state 9
Stack now 0 1 9
Reducing stack by rule 6 (line 52):
   $1 = nterm config_directive_line ()
-> $$ = nterm config_line ()
Entering state 8
Stack now 0 1 8
Reducing stack by rule 4 (line 46):
   $1 = nterm config_line ()
-> $$ = nterm line ()
Entering state 6
Stack now 0 1 6
Reducing stack by rule 2 (line 42):
   $1 = nterm config ()
   $2 = nterm line ()
-> $$ = nterm config ()
Entering state 1
Stack now 0 1
Reading a token
Next token is token T_CONFIG_DIRECTIVE_ARGUMENT ()
Parse error: syntax error in file badconf1.conf, line 1




a.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.