Open ReubenJ opened 5 months ago
The only issue that I can spot with the proposed version is that it is quite unintuitive. I would read
grab(moveUp(moveRight(End())))
as move right, move up, and then grab rather than the other way around.
Yep, I see your point. I guess this would be a tradeoff between readability of the expression, and size of the synthesized program.
Some ideas regarding the robot grammar after discussing today with @pwochner.
Current Implementation
In the new robot grammar, here:
https://github.com/Herb-AI/HerbBenchmarks.jl/blob/a1a801ba5e68911b78f4c059164963bc46d72024/src/data/Robots_2020/grammar.jl#L1-L14
the resulting syntax trees are cluttered with
RuleNode(3, [...])
. For example, the program for grab, move up, and finally move right is written aswhich corresponds to the
RuleNode
s:3{11,3{9,6}}
.Note that this current
Sequence
syntax does not allow us to write variable-length sequences. It always results in a quote block with two children, the first one being another operation and the other being either an operation or another nested quote block.Alternative
What if we let each
Transformation
take the next action as an argument? We would then remove theSequence
rules and maybe add a singleEnd()
terminal operation.The expression would become
and the
RuleNode
representation: `11{9,{6,{22}}We can keep the interpret function mostly the same, meaning that we first apply
grab
to the state, thenmoveUp
, etc. Functionally, it would be the same, but the resulting syntax trees will contain roughly half the number of nodes.