Re: [问题] FLOLAC op semantics 作业

楼主: noctem (noctem)   2010-07-04 12:02:56
我其实没仔细看,可能不是很进入状况。我猜是这样的:
※ 引述《dryman (dryman)》之铭言:
: type config =
: Inter of statement * state
: | Fianl of state
: 老师作业中应该是要让
: natural_semantics 的type为
: config->config = <fun>
: 不过实际写起来觉得似乎不太可行
: 因为根本不可能知道回传的config是Inter还是Final
: 于是根本无法递回(题目没有加rec,可是by definition ns 是递回没错)
我想 ns 应该是要定义成递回函数的。递回呼叫的结果
也可以用 match 得知是 Inter 还是 Final.
: 但如果将natural semantics设定成
: (statement,state)->state = <fun>
我也是觉得这样比较像 natural semantics. 也许
改用 config -> config 的原因是以后比较容易和 small-step
semantics 做比较?但无论如何这两个 type 蛮像的。
我猜想你碰到的问题可能不是关于 semantics, 而是
不知在 ocaml 中如何做 pattern matching?

Links booklink

Contact Us: admin [ a t ] ucptt.com