projects
/
kaleidoscope-hs-old.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
fd502ca
)
Handle ending ;
author
Luke Lau
<luke_lau@icloud.com>
Sun, 10 Mar 2019 17:04:29 +0000
(17:04 +0000)
committer
Luke Lau
<luke_lau@icloud.com>
Wed, 17 Apr 2019 22:38:30 +0000
(23:38 +0100)
AST.hs
patch
|
blob
|
history
diff --git
a/AST.hs
b/AST.hs
index 73523d6d4c8a37cef977d5614d355aaac13756af..6b9928d5b13fa0d67c848b8c3c0e446c2babb4f4 100644
(file)
--- a/
AST.hs
+++ b/
AST.hs
@@
-8,10
+8,14
@@
newtype Program = Program [AST]
deriving Show
instance Read Program where
deriving Show
instance Read Program where
- readPrec = fmap Program $ lift $ sepBy1 (readS_to_P reads) $ do
+ readPrec = fmap Program $ lift $ do
+ asts <- sepBy1 (readS_to_P reads) $ do
skipSpaces
char ';'
skipSpaces
skipSpaces
char ';'
skipSpaces
+ optional $ char ';'
+ skipSpaces
+ return asts
data AST = Function String [String] Expr
| Eval Expr
data AST = Function String [String] Expr
| Eval Expr