help-bison
[Top][All Lists]
Advanced

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

Re: When to use a token yacc_EOF instead of relying on 0 return value of


From: Peng Yu
Subject: Re: When to use a token yacc_EOF instead of relying on 0 return value of yylex()?
Date: Mon, 11 Feb 2019 16:56:19 -0600

> I have no idea.  You'd have to study the grammar to see if there
> are doing fancy things around yacc_EOF.

declare -p BASH_SOURCE

Here is what I got with the above one line bash code (with the newline
at the end).

The lines with -> are the parsing rules activated. The rest lines are
yylex() results.

WORD
WORD
simple_command_element -> WORD
simple_command -> simple_command_element
simple_command_element -> WORD
simple_command -> simple_command simple_command_element
WORD
simple_command_element -> WORD
simple_command -> simple_command simple_command_element
\n
command -> simple_command
pipeline -> command
pipeline_command -> pipeline
simple_list1 -> pipeline_command
simple_list -> simple_list1
simple_list_terminator -> '\n'
inputunit -> simple_list simple_list_terminator
yacc_EOF
inputunit -> yacc_EOF

If yacc_EOF were to be removed, do you see how to redesigned this
subset of grammar rules? Thanks. (Since this subset is much smaller
than the full grammar, I think it should be easy to see how to remove
yacc_EOF, yet maintain the same functionality of the grammar?)

-- 
Regards,
Peng



reply via email to

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