X-Git-Url: https://git.lukelau.me/?p=kaleidoscope-hs-old.git;a=blobdiff_plain;f=AST.hs;h=6b9928d5b13fa0d67c848b8c3c0e446c2babb4f4;hp=73523d6d4c8a37cef977d5614d355aaac13756af;hb=4b03cb96fd234ca3e85581e218668f68afc16375;hpb=fd502ca628b539cffbc38c21755ebaa615b30b72 diff --git a/AST.hs b/AST.hs index 73523d6..6b9928d 100644 --- a/AST.hs +++ b/AST.hs @@ -8,10 +8,14 @@ newtype Program = Program [AST] 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 + optional $ char ';' + skipSpaces + return asts data AST = Function String [String] Expr | Eval Expr