Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Apr 21, 2024
1 parent cd125ae commit 75ef99c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
update to esmodule

尝试用 node:test 而不用 test-runner

- 因为每次开启 node 解释器有严重的 overhead。

fix repl for windows

# chimera
Expand Down
34 changes: 34 additions & 0 deletions docs/diary/2024-04-21-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,37 @@ function id(x) {

我们应该如何改进 Chimera 当前的设计,
使得它能成为一个有用的语言?

首先我认为它不好用在于它没有类型系统。
但是也许无类型就是它的特点,
因为无类型的 term 很适合逻辑式与 term rewrite。

也许我们应该用 tagged term,
并且用 datatype 来限制 term 的形式:

```chimera todo
datatype Exp {
Var(name: String)
Fn(name: String, ret: Exp)
Ap(target: Exp, arg: Exp)
}
Exp::Ap(Exp::Var("f"), Exp::Var("x"))
```

在 datatype 的定义之后 `Exp` 可以被视为 type constraint。

这样就不用 quote 了。

```chimera todo
rule conjunctiveNormalForm {
Logic::Not(Logic::Not(x)) => x
Logic::Not(Logic::And(x, y)) => Logic::Or(Logic::Not(x), Logic::Not(y))
Logic::Not(Logic::Or(x, y)) => Logic::And(Logic::Not(x), Logic::Not(y))
Logic::Or(Logic::And(x, y), z) => Logic::And(Logic::Or(x, z), Logic::Or(y, z))
Logic::Or(x, Logic::And(y, z)) => Logic::And(Logic::Or(x, y), Logic::Or(x, z))
}
```

之后我们可以给 过程式/函数式 的部分加上简单类型系统,
类型参数的处理原则和 clause 一样。

0 comments on commit 75ef99c

Please sign in to comment.