Skip to content

Latest commit

 

History

History
143 lines (116 loc) · 2.31 KB

imp-tests.org

File metadata and controls

143 lines (116 loc) · 2.31 KB

implish tests

repl behavior: print everything but nil

> [nil]
[nil]
> nil
> 1 `x
`x

echo “hello”

> echo "hello"
hello

echo 2 + 2

> echo 2 + 2
4

outputing “2 2” would be reasonable here if you don’t look ahead for operators. So this test forces you to define operators, and look ahead multiple tokens.

  • next -> echo (verb)
  • have verb, so look ahead for adverb/conjunction/
  • peek -> 2 (noun)
  • okay. we will apply verb to noun
  • fetch full noun phrase, by calling “next”
  • next -> 2 (noun)
  • have noun, so look ahead for .method or infix op

arithmetic (left to right eval)

> echo 1 + 2 * 3 + 5
14

ignore comments

> echo .: this is a comment :. "hi"
hi

echo show “quoted”

> echo show "quoted"
"quoted"

echo[“hello”]

> echo["hello"]
hello

echo[2 + 2]

> echo[2 + 2]
4

+[2;3]

> +[2;3]
5

echo[+[2;3]]

> echo[+[2;3]]
5

echo xmls [1 2; “three”; four]

> echo xmls [1 2; "three"; four]
<imp:lst open="[" close="]">
  <imp:int v="1"/>
  <imp:int v="2"/>
  <imp:sep v=";"/>
  <imp:str v="three"/>
  <imp:sep v=";"/>
  <imp:sym v="four"/>
</imp:lst>

strands

> 1 2 3 4
1 2 3 4

vector math

> 1 + ! 4
1 2 3 4
> 1 + 1 2 3 4
2 3 4 5

[0/7] upcoming tests

ambivalent operators

ex: - x is negate, x - y is subtraction x + y is addition, + x is transpose or complex conjugate

grammar rules / definitions / macros

binary expressions

eq =  ne ~: gt >  lt <  ge >: le <:
xr ~: an *. or +. nt -.
lid / rid ? (li/ri?)

proofs

  • unification for rewrite rules
  • hehner has two levels (one for expr, one for proofs)
  • really just same op with two precedence levels
  • quoting might fill the gap?

tokenizer -> xml test?