I'm Okam a newbie and I'm trying to write a simple dictionary-like grammar, and I can not understand this out . My grammar allows something like this:
let's sub = joke x - & gt; Interesting y - & gt; X - Y ;;
However, if I want to define the function so much then I can write: (sub 7) 3
but I do not write sub 7 Can I really do it for some reason, it is interpreted as I wrote
sub (7 3)
(that is, 7
As a work with logic 3
). Related sections are as follows:
/ * Other operators, then at the very end: * /% left APPLY / * ... * / expr: / * ... * / | Expr expr% prec Apply {Apply ($ 1, $ 2)}
Thanks!
The Oklahul compiler works like this: ( ocaml / parsing / parser.mly
to)
expr: ... | Simple_expr simple_labeled_expr_list {mkexp (Pexp_apply ($ 1, list.rev $ 2))}
Where simple_expr
is a subset of possible xp value that evaluates for the function Without the need of brackets this function does not include all non-self-bracket-built structures using the inline with the call, it also clarifies the collaboration of sub-expectations, because the second supplement is clearly a Is the list.
Your comment does not work because of comment in Okmol's parser, to get the right co-operative, why the % left APPLY
.
We only have x * x - & gt; Will use associates with type operators. X For example, in the rules of the form expr: In all other cases, the EXP BINOP expr, we define two predecessors when necessary to resolve conflicts.
I can say this means that you can not use% pre for collaborators without the operator. By defining more rules, try to make co-habitation, and see where it is.
Comments
Post a Comment