From c9958740743bd38f600d6b3d2f47af474def714f Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 14 Oct 2020 23:00:05 +0530 Subject: fix vector and bool interactions --- readme.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ readme.txt | 45 --------------------------------------------- src/Parser.hs | 4 ++-- 3 files changed, 53 insertions(+), 47 deletions(-) create mode 100644 readme.md delete mode 100644 readme.txt diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..4b6f95a --- /dev/null +++ b/readme.md @@ -0,0 +1,51 @@ + +![lisk.png](https://u.peppe.rs/0j.png) + +`lisk` is a (soon to be) interpreter for R6RS Scheme, +written by the students of RV. It is written in Haskell and +compiled against GHC v8.6.5. `lisk` is an educational +adventure, it does not intend to be highly performant or +fully compliant with R6RS. + +### Building and Running `lisk` + +On systems using the `nix` package manager: + +```shell +cabal2nix . > default.nix +nix-build release.nix +./result/bin/lisk +``` + +Alternatively, you may build and run using `cabal`: + +```shell +# requires ghc & cabal to be installed +cabal build exe:lisk +cabal run lisk +``` + +### Usage + +On running `lisk`, you will be greeted by the `lisk` REPL, +where you may enter `lisk` expressions: + +```scheme +;;; Entering lisk repl ... +† (+ 1 1) +2 +† (* 42 (- 2 -3)) +210 +† (and (not (= 2 2)) #f) +#f +``` + +### Testing + +`lisk` includes a property-based testing suite, written with +the QuickCheck module, you may run tests for the project +via: + +```shell +cabal run tests +``` diff --git a/readme.txt b/readme.txt deleted file mode 100644 index f187488..0000000 --- a/readme.txt +++ /dev/null @@ -1,45 +0,0 @@ -lisk ----- - -an educational lisp interpreter written in haskell - - -build and run -------------- - -nix: - - cabal2nix . > default.nix - nix-build release.nix - ./result/bin/lisk - - -cabal: - - cabal run - - -usage ------ - -$ lisk -;;; Entering lisk repl ... -(lisk)> (+ 1 2 3) -Right 6 -(lisk)> (not (= 2 3)) -Right #t -(lisk)> '(a b c) -Right (a b c) - - - -todo ----- - -apart from lines/blocks marked with TODO in the source -files: - -* implement correct double/int interaction (src/Operators.hs) -* implement boolean operations: and, or -* rectify Ord implementation for LispNumber (src/Operators.hs) -* 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 return $ Vector x symbol :: Parser Char -symbol = oneOf "!$%&|*+:/-=@^_~" +symbol = oneOf "!#$%&|*+:/-=@^_~" parseId :: Parser Expr parseId = do @@ -99,11 +99,11 @@ parseLispValue = parseString <|> try parseFloat <|> try parseInt + <|> try parseVector <|> try parseId <|> parseQuote <|> parseQuasiquote <|> parseUnquote - <|> parseVector -- handles lists and dotted lists <|> do char '(' >> optionalWhiteSpace -- cgit v1.2.3