[问题] FLOLAC op semantics 作业

楼主: dryman (dryman)   2010-07-04 09:24:16
type config =
Inter of statement * state
| Fianl of state
老师作业中应该是要让
natural_semantics 的type为
config->config = <fun>
不过实际写起来觉得似乎不太可行
因为根本不可能知道回传的config是Inter还是Final
于是根本无法递回(题目没有加rec,可是by definition ns 是递回没错)
(除非在每个用到递回的match元素中都另外match所有的Inter, Final..)
这跟定义也不尽相同:
In a natural semantics we are concerned with the relationship
between the initial and the final state of an execution.
(page 20)
虽然这定义并不强
但如果将natural semantics设定成
(statement,state)->state = <fun>
实际撰写时就容易多了,不然我没办法解开实际撰写时碰到的ambiguous
不过这只是我硬凹题目的结果
不知道有没有强者有办法在config->config的架构下写出来?

Links booklink

Contact Us: admin [ a t ] ucptt.com