Commit 0609153c authored by POTTIER Francois's avatar POTTIER Francois
Browse files

TODO update.

parent dd6343ef
......@@ -28,27 +28,12 @@
* standard library: define "%public %inline epsilon: {}", which allows using
"epsilon" as a marker for an empty right-hand side.
* Inspired by BtYacc inherited attributes, which are just syntactic sugar
for embedded semantic actions and accesses to the stack at $0, $-1, etc.
In other words, a way of using the LR stack for parameter passing.
Could Menhir offer something like this? (in a safe way)
Every non-terminal symbol would have a "stack type" (a hypothesis about
the types of the semantic values on the stack). By default, empty.
If non-empty, introduces names for the semantic values.
list<sum>: /* empty */ { sum }
| i = INT sum' = list<sum + i> { sum' }
This allows left-to-right-carried state in a list, even though the list
is right-recursive, and without using mutable state.
(But is that really interesting?)
Desugared to:
list: /* assumes an integer sum is on the stack */
sum = POP { sum }
| sum = POP i = INT PUSH<sum + i> sum' = list { sum' }
One could read "POP" as a normal nonterminal symbol (of ocaml type int)
and read "PUSH" as a primitive embedded action that reduces the empty
word to a POP symbol.
So if we have embedded actions, we can encode inherited attributes.
* Implement $0, $-1, etc.
with and without --infer, must be type-safe
in the code and table back-ends
On top of that, it is easy to implement mid-rule actions (à la Bison).
On top of that, it should be easy to implement inherited attributes (à la BtYacc).
again, should be type-safe
* Installation problems.
- put menhirLib.{ml,mli} in a different directory;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment