Skip to content

Commit

Permalink
remove quote
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Apr 28, 2024
1 parent 4508ea2 commit a922f99
Show file tree
Hide file tree
Showing 20 changed files with 4 additions and 81 deletions.
5 changes: 3 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
remove quote and eval

`datatype` -- `Data` should have `type` and `kind`

[maybe] remove eval
[maybe] remove print -- find should print

type constraint should not be `String(x)`

- should be `The(String, x)`
Expand Down
6 changes: 0 additions & 6 deletions docs/tests/basic/eval.ch

This file was deleted.

3 changes: 0 additions & 3 deletions docs/tests/basic/eval.ch.out

This file was deleted.

3 changes: 0 additions & 3 deletions docs/tests/basic/let.ch
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ assert equal(x, 1)

let [x, y] = [1, 2]
assert equal([x, y], [1, 2])

let f(x, y) = quote f(1, 2)
assert equal([x, y], [1, 2])
1 change: 0 additions & 1 deletion docs/tests/basic/quote-nested.error.ch

This file was deleted.

5 changes: 0 additions & 5 deletions docs/tests/basic/quote-nested.error.ch.err

This file was deleted.

2 changes: 0 additions & 2 deletions docs/tests/basic/quote.ch

This file was deleted.

1 change: 0 additions & 1 deletion docs/tests/basic/quote.ch.out

This file was deleted.

1 change: 0 additions & 1 deletion docs/tests/conventions/quote-reject-curry.error.ch

This file was deleted.

5 changes: 0 additions & 5 deletions docs/tests/conventions/quote-reject-curry.error.ch.err

This file was deleted.

7 changes: 1 addition & 6 deletions docs/tests/globals/equal.ch
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
print find x {
Equal(x, 1)
}

assert equal(1, 1)
assert equal(quote a, quote a)
assert not equal(quote a, quote b)
assert not equal(1, 2)
7 changes: 0 additions & 7 deletions docs/tests/goal/goal.ch
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
clause Exp(var(name)) -- { String(name) }
clause Exp(fn(name, ret)) -- { String(name) Exp(ret) }
clause Exp(ap(target, arg)) -- { Exp(target) Exp(arg) }

print Exp
print Exp(quote var("x"))

// TypeConstraint

print Number
Expand Down
2 changes: 0 additions & 2 deletions docs/tests/goal/goal.ch.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
$Relation(Exp, 1)
$Goal(Exp(var("x")))
$TypeConstraint(Number)
$Goal(Number(1))
4 changes: 0 additions & 4 deletions src/lang/evaluate/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ export function evaluate(mod: Mod, env: Env, exp: Exp): Value {
)
}

case "Quote": {
return quote(mod, env, exp.exp)
}

case "Eval": {
return evaluate(mod, env, exp.exp)
}
Expand Down
16 changes: 0 additions & 16 deletions src/lang/exp/Exp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export type Exp =
| Dot
| Ap
| Fn
| Quote
| Eval
| Find
| And
Expand Down Expand Up @@ -203,21 +202,6 @@ export function Fn(patterns: Array<Exp>, stmts: Array<Stmt>, span: Span): Fn {
}
}

export type Quote = {
"@type": "Exp"
"@kind": "Quote"
exp: Exp
span: Span
}

export function Quote(exp: Exp, span: Span): Quote {
return {
"@type": "Exp",
"@kind": "Quote",
exp,
span,
}
}

export type Eval = {
"@type": "Exp"
Expand Down
4 changes: 0 additions & 4 deletions src/lang/format/formatExp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ export function formatExp(exp: Exp): string {
: `(${patterns}) => {\n${indent(stmts.join("\n"))}\n}`
}

case "Quote": {
return `quote ${formatExp(exp.exp)}`
}

case "Eval": {
return `eval ${formatExp(exp.exp)}`
}
Expand Down
6 changes: 0 additions & 6 deletions src/lang/quote/quote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ export function quote(mod: Mod, env: Env, exp: Exp): Value {
)
}

case "Quote": {
throw new Errors.LangError(`[quote] can not handle nested quote`, {
span: exp.span,
})
}

case "Eval": {
return evaluate(mod, env, exp.exp)
}
Expand Down
1 change: 0 additions & 1 deletion src/lang/syntax-old/grammars/exp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export const operand = {
'"}"',
],
"operand:fn_with_exp": [{ patterns: "args" }, '"="', '">"', { ret: "exp" }],
"operand:quote": ['"quote"', { exp: "exp" }],
"operand:eval": ['"eval"', { exp: "exp" }],
"operand:find": [
'"find"',
Expand Down
2 changes: 0 additions & 2 deletions src/lang/syntax-old/matchers/exp_matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ export function operand_matcher(tree: pt.Tree): Exp {
[Stmts.Return(matchers.exp_matcher(ret), span)],
span,
),
"operand:quote": ({ exp }, { span }) =>
Exps.Quote(matchers.exp_matcher(exp), span),
"operand:eval": ({ exp }, { span }) =>
Exps.Eval(matchers.exp_matcher(exp), span),
"operand:find": ({ pattern, limit, goals }, { span }) => {
Expand Down
4 changes: 0 additions & 4 deletions src/lang/var-collection/varCollectionFromExp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ export function varCollectionFromExp(exp: Exp): VarCollection {
return createVarCollection()
}

case "Quote": {
return varCollectionFromExp(exp.exp)
}

case "Eval": {
return createVarCollection()
}
Expand Down

0 comments on commit a922f99

Please sign in to comment.