From: Mart Lubbers Date: Fri, 19 Feb 2016 19:51:56 +0000 (+0100) Subject: stub voor parsen gemaakt X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=953019d8255b9779d67fb1cb6c8946f589a24936;p=cc1516.git stub voor parsen gemaakt --- diff --git a/main.icl b/main.icl index 90624e8..ced5b0a 100644 --- a/main.icl +++ b/main.icl @@ -4,13 +4,14 @@ import StdFile import StdBool import lex +import parse -Start :: *World -> (LexerOutput, *World) +Start :: *World -> (ParserOutput, *World) Start w # (out, w) = stdio w # (toparse, out) = readEntireFile out # (_, w) = fclose out w -= (lexer toparse, w) += (parse (lexer toparse), w) readEntireFile :: *File -> *([Char], *File) readEntireFile f diff --git a/main.prj b/main.prj index c86f61c..5f00e02 100644 --- a/main.prj +++ b/main.prj @@ -69,6 +69,20 @@ OtherModules ReadableABC: False ReuseUniqueNodes: True Fusion: False + Module + Name: parse + Dir: {Project} + Compiler + NeverMemoryProfile: False + NeverTimeProfile: False + StrictnessAnalysis: True + ListTypes: StrictExportTypes + ListAttributes: True + Warnings: True + Verbose: True + ReadableABC: False + ReuseUniqueNodes: True + Fusion: False Module Name: StdArray Dir: {Application}/lib/StdEnv diff --git a/parse.dcl b/parse.dcl new file mode 100644 index 0000000..c7d177c --- /dev/null +++ b/parse.dcl @@ -0,0 +1,8 @@ +definition module parse + +import lex + +:: ParserOutput :== Either String AST +:: AST = If | While //stub + +parse :: LexerOutput -> ParserOutput diff --git a/parse.icl b/parse.icl new file mode 100644 index 0000000..3344e27 --- /dev/null +++ b/parse.icl @@ -0,0 +1,9 @@ +implementation module parse + +import StdString + +import lex + +parse :: LexerOutput -> ParserOutput +parse (Left e) = Left ("Lexer error: " +++ e) +parse (Right r) = Left "Parser not yet implemented"