diff options
-rw-r--r-- | readme.md | 51 | ||||
-rw-r--r-- | readme.txt | 45 | ||||
-rw-r--r-- | src/Parser.hs | 4 |
3 files changed, 53 insertions, 47 deletions
diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..4b6f95a --- /dev/null +++ b/readme.md | |||
@@ -0,0 +1,51 @@ | |||
1 | |||
2 | ![lisk.png](https://u.peppe.rs/0j.png) | ||
3 | |||
4 | `lisk` is a (soon to be) interpreter for R6RS Scheme, | ||
5 | written by the students of RV. It is written in Haskell and | ||
6 | compiled against GHC v8.6.5. `lisk` is an educational | ||
7 | adventure, it does not intend to be highly performant or | ||
8 | fully compliant with R6RS. | ||
9 | |||
10 | ### Building and Running `lisk` | ||
11 | |||
12 | On systems using the `nix` package manager: | ||
13 | |||
14 | ```shell | ||
15 | cabal2nix . > default.nix | ||
16 | nix-build release.nix | ||
17 | ./result/bin/lisk | ||
18 | ``` | ||
19 | |||
20 | Alternatively, you may build and run using `cabal`: | ||
21 | |||
22 | ```shell | ||
23 | # requires ghc & cabal to be installed | ||
24 | cabal build exe:lisk | ||
25 | cabal run lisk | ||
26 | ``` | ||
27 | |||
28 | ### Usage | ||
29 | |||
30 | On running `lisk`, you will be greeted by the `lisk` REPL, | ||
31 | where you may enter `lisk` expressions: | ||
32 | |||
33 | ```scheme | ||
34 | ;;; Entering lisk repl ... | ||
35 | † (+ 1 1) | ||
36 | 2 | ||
37 | † (* 42 (- 2 -3)) | ||
38 | 210 | ||
39 | † (and (not (= 2 2)) #f) | ||
40 | #f | ||
41 | ``` | ||
42 | |||
43 | ### Testing | ||
44 | |||
45 | `lisk` includes a property-based testing suite, written with | ||
46 | the QuickCheck module, you may run tests for the project | ||
47 | via: | ||
48 | |||
49 | ```shell | ||
50 | cabal run tests | ||
51 | ``` | ||
diff --git a/readme.txt b/readme.txt deleted file mode 100644 index f187488..0000000 --- a/readme.txt +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | lisk | ||
2 | ---- | ||
3 | |||
4 | an educational lisp interpreter written in haskell | ||
5 | |||
6 | |||
7 | build and run | ||
8 | ------------- | ||
9 | |||
10 | nix: | ||
11 | |||
12 | cabal2nix . > default.nix | ||
13 | nix-build release.nix | ||
14 | ./result/bin/lisk | ||
15 | |||
16 | |||
17 | cabal: | ||
18 | |||
19 | cabal run | ||
20 | |||
21 | |||
22 | usage | ||
23 | ----- | ||
24 | |||
25 | $ lisk | ||
26 | ;;; Entering lisk repl ... | ||
27 | (lisk)> (+ 1 2 3) | ||
28 | Right 6 | ||
29 | (lisk)> (not (= 2 3)) | ||
30 | Right #t | ||
31 | (lisk)> '(a b c) | ||
32 | Right (a b c) | ||
33 | |||
34 | |||
35 | |||
36 | todo | ||
37 | ---- | ||
38 | |||
39 | apart from lines/blocks marked with TODO in the source | ||
40 | files: | ||
41 | |||
42 | * implement correct double/int interaction (src/Operators.hs) | ||
43 | * implement boolean operations: and, or | ||
44 | * rectify Ord implementation for LispNumber (src/Operators.hs) | ||
45 | * implement property based testing with quickcheck (tests/Properties.hs) | ||
diff --git a/src/Parser.hs b/src/Parser.hs index 69197b8..115203b 100644 --- a/src/Parser.hs +++ b/src/Parser.hs | |||
@@ -64,7 +64,7 @@ parseVector = do | |||
64 | return $ Vector x | 64 | return $ Vector x |
65 | 65 | ||
66 | symbol :: Parser Char | 66 | symbol :: Parser Char |
67 | symbol = oneOf "!$%&|*+:/-=<?>@^_~" | 67 | symbol = oneOf "!#$%&|*+:/-=<?>@^_~" |
68 | 68 | ||
69 | parseId :: Parser Expr | 69 | parseId :: Parser Expr |
70 | parseId = do | 70 | parseId = do |
@@ -99,11 +99,11 @@ parseLispValue = | |||
99 | parseString | 99 | parseString |
100 | <|> try parseFloat | 100 | <|> try parseFloat |
101 | <|> try parseInt | 101 | <|> try parseInt |
102 | <|> try parseVector | ||
102 | <|> try parseId | 103 | <|> try parseId |
103 | <|> parseQuote | 104 | <|> parseQuote |
104 | <|> parseQuasiquote | 105 | <|> parseQuasiquote |
105 | <|> parseUnquote | 106 | <|> parseUnquote |
106 | <|> parseVector | ||
107 | -- handles lists and dotted lists | 107 | -- handles lists and dotted lists |
108 | <|> do | 108 | <|> do |
109 | char '(' >> optionalWhiteSpace | 109 | char '(' >> optionalWhiteSpace |