Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
0609153c
Commit
0609153c
authored
May 10, 2016
by
POTTIER Francois
Browse files
TODO update.
parent
dd6343ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
TODO
View file @
0609153c
...
...
@@ -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.
e.g.
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;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment