[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: y.output format
From: |
Akim Demaille |
Subject: |
Re: y.output format |
Date: |
11 Jan 2002 15:22:45 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) |
| At 18:54 +0100 2002/01/09, Bernard Granier wrote:
| > Where can I find a simple tutorial which explains the y.output file format
?
|
| It follows the standard format of bottom up parsing (Bison uses LALR(1)),
| son one can look into standard books describing that method. For example,
| Aho, Sethi & Ullman, "Compilers...".
|
| Bison generates code for a stack machine, which uses a lookahead token to
| determine what action to take, and to find the next state. For example, in
| state 11
| command -> "rule" expression_list . (rule 7)
| expression_list -> expression_list . production (rule 10)
|
| "nonterminal" shift, and go to state 12
|
| $default reduce using rule 7 (command)
|
| production go to state 13
|
| the dot "." on the RHS means that this is the point the state machine has
| parsed so far, and the list below tells which action to take, and which is
| the next state after that.
$default stands `for any other lookahead', and [reduce ...] stands for
`there is another rule which wanted to be reduced here, but a
conflicting shift, or a conflicting reduce has won over this one'. In
short, square brackets denote disabled possibilities.
If you are using 1.31 or even better, 1.49, I suggest that you had
--trace to -v: the output is then even more complete, showing the
items (i.e., the rule plus the dot) that are deducible from the
others.