aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-10-14 18:30:05 +0100
committerAkshay <[email protected]>2020-10-14 18:30:05 +0100
commitc9958740743bd38f600d6b3d2f47af474def714f (patch)
treec8aafe0b12064ffcd2fca6d41819ca013b65f076
parent14ad0667bf25351e522faa7d9fbb3ff31619d92e (diff)
fix vector and bool interactions
-rw-r--r--readme.md51
-rw-r--r--readme.txt45
-rw-r--r--src/Parser.hs4
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,
5written by the students of RV. It is written in Haskell and
6compiled against GHC v8.6.5. `lisk` is an educational
7adventure, it does not intend to be highly performant or
8fully compliant with R6RS.
9
10### Building and Running `lisk`
11
12On systems using the `nix` package manager:
13
14```shell
15cabal2nix . > default.nix
16nix-build release.nix
17./result/bin/lisk
18```
19
20Alternatively, you may build and run using `cabal`:
21
22```shell
23# requires ghc & cabal to be installed
24cabal build exe:lisk
25cabal run lisk
26```
27
28### Usage
29
30On running `lisk`, you will be greeted by the `lisk` REPL,
31where you may enter `lisk` expressions:
32
33```scheme
34;;; Entering lisk repl ...
35† (+ 1 1)
362
37† (* 42 (- 2 -3))
38210
39† (and (not (= 2 2)) #f)
40#f
41```
42
43### Testing
44
45`lisk` includes a property-based testing suite, written with
46the QuickCheck module, you may run tests for the project
47via:
48
49```shell
50cabal 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 @@
1lisk
2----
3
4an educational lisp interpreter written in haskell
5
6
7build and run
8-------------
9
10nix:
11
12 cabal2nix . > default.nix
13 nix-build release.nix
14 ./result/bin/lisk
15
16
17cabal:
18
19 cabal run
20
21
22usage
23-----
24
25$ lisk
26;;; Entering lisk repl ...
27(lisk)> (+ 1 2 3)
28Right 6
29(lisk)> (not (= 2 3))
30Right #t
31(lisk)> '(a b c)
32Right (a b c)
33
34
35
36todo
37----
38
39apart from lines/blocks marked with TODO in the source
40files:
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
66symbol :: Parser Char 66symbol :: Parser Char
67symbol = oneOf "!$%&|*+:/-=<?>@^_~" 67symbol = oneOf "!#$%&|*+:/-=<?>@^_~"
68 68
69parseId :: Parser Expr 69parseId :: Parser Expr
70parseId = do 70parseId = 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