git @ Cat's Eye Technologies Wanda / 7da4428
Factor test appliances out into own files. Chris Pressey 3 years ago
4 changed file(s) with 18 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
00 Wanda
11 =====
22
3 Wanda is a Forth-like "concatenative" language that's probably not actually
4 "concatenative" at all, nor even "stack-based", because it's based on a
3 Wanda is a Forth-like "concatenative" language that's arguably not actually
4 concatenative at all, nor even "stack-based", because it's based on a
55 string-rewriting semantics.
66
77 The remainder of this document will describe the language and will attempt
1010 Basics
1111 ------
1212
13 -> Functionality "Run Wanda program" is implemented by
14 -> shell command "lua src/wanda.lua %(test-body-file)"
15
16 -> Functionality "Trace Wanda program" is implemented by
17 -> shell command "lua src/wanda.lua --trace 15 %(test-body-file)"
18
19 -> Functionality "Run Wanda program" is implemented by
20 -> shell command "python impl/wanda.py/src/wanda.py %(test-body-file)"
21
22 -> Functionality "Trace Wanda program" is implemented by
23 -> shell command "python impl/wanda.py/src/wanda.py --trace %(test-body-file) | head -n 15"
24
2513 -> Tests for functionality "Run Wanda program"
2614
27 A Wanda program is a string of symbols. Each symbol consist of one or more
15 A Wanda program is a string of symbols. Each symbol consists of one or more
2816 non-whitespace characters. In the string, symbols are separated by whitespace.
2917
3018 Here is a legal Wanda program. (The `===>` is not part of the program;
4432
4533 Rewrites occur when parts of the string match the pattern of one of the
4634 rewrite rules that are in effect. For instance, the rule for `+` has the
47 pattern `X Y $ +`, where X and Y are integers; the part of the string that
48 matches that pattern is replaced by a single integer which is the sum of
49 X and Y, followed by a `$`.
35 pattern `X Y $ +`, where X and Y are integer symbols; the part of the string
36 that matches this pattern is replaced by a single integer symbol which is
37 the sum of X and Y, followed by a `$`.
5038
5139 You can think of `$` as a symbol which delineates the stack (on the left)
5240 from the program (on the right). When constants are encountered in the
6856 ### Some other builtins
6957
7058 We've seen `+` and `*`, which are built-in functions (or rules).
71 There are a couple of other built-in functions (or rules).
59 There are a handful of other built-in functions (or rules).
7260
7361 $ 7 sgn 0 sgn -14 sgn
7462 ===> 1 0 -1 $
00 #!/bin/sh
11
2 falderal README.md || exit 1
2 falderal tests/appliances/lua.md tests/appliances/python.md README.md || exit 1
0 -> Functionality "Run Wanda program" is implemented by
1 -> shell command "lua src/wanda.lua %(test-body-file)"
2
3 -> Functionality "Trace Wanda program" is implemented by
4 -> shell command "lua src/wanda.lua --trace 15 %(test-body-file)"
0 -> Functionality "Run Wanda program" is implemented by
1 -> shell command "python impl/wanda.py/src/wanda.py %(test-body-file)"
2
3 -> Functionality "Trace Wanda program" is implemented by
4 -> shell command "python impl/wanda.py/src/wanda.py --trace %(test-body-file) | head -n 15"