> [nil] [nil] > nil > 1 `x `x
> echo "hello" hello
> 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
> echo 1 + 2 * 3 + 5 14
> echo .: this is a comment :. "hi" hi
> echo show "quoted" "quoted"
> echo["hello"] hello
> echo[2 + 2] 4
> +[2;3] 5
> echo[+[2;3]] 5
> 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>
> 1 2 3 4 1 2 3 4
> 1 + ! 4 1 2 3 4 > 1 + 1 2 3 4 2 3 4 5
ex: - x is negate, x - y is subtraction x + y is addition, + x is transpose or complex conjugate
eq = ne ~: gt > lt < ge >: le <: xr ~: an *. or +. nt -. lid / rid ? (li/ri?)
- 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?