diff --git a/app/Parser.hs b/app/Parser.hs new file mode 100644 index 0000000..3e981e8 --- /dev/null +++ b/app/Parser.hs @@ -0,0 +1,20 @@ +module Parser where + +import qualified Lexer + +type AST = Expr + +data Expr = Add Term Expr + | Sub Term Expr + | ETerm Term + deriving Show + +data Term = Mult Factor Term + | Div Factor Term + | TFactor Factor + deriving Show + +data Factor = Integer Int + | Parantheses Expr + | NegFactor Factor + deriving Show diff --git a/simple-arithmetic-compiler.cabal b/simple-arithmetic-compiler.cabal index 7ba5860..629dee5 100644 --- a/simple-arithmetic-compiler.cabal +++ b/simple-arithmetic-compiler.cabal @@ -52,7 +52,7 @@ executable simple-arithmetic-compiler main-is: Main.hs -- Modules included in this executable, other than Main. - other-modules: Lexer + other-modules: Lexer, Parser -- LANGUAGE extensions used by modules in this package. -- other-extensions: