CakeML/cakeml

Support custom failure exceptions in the translator

开放

#181 创建于 2016年11月24日

 (1 条评论) (0 个反应) (0 位负责人)Standard ML (98 个派生)auto 404
help wantedlow efforttranslator

仓库指标

星标
 (1,169 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Currently, if you translate something with a side-condition from ARB, the translator produces the code raise Bind. It would be nice to tweak this a little to allow an arbitrary exception. For example:

val _ = register_exn ``Size``; (* made this up... not sure how it should work *)
val sub_def = Define`sub i ls = if i < LENGTH ls then EL i ls else FAIL Size ARB`;

to produce code that calls raise Size rather than raise Bind. This requires the translator to support defining exceptions too.

For sophisticated use of exceptions, one must use CF, but for exceptions that correspond to side-conditions we expect to always be true, it would be nicer to just use the translator.

贡献者指南