Add AST to Parser

This commit is contained in:
Laborratte 5 2024-07-16 13:30:06 +02:00
parent b51be83eff
commit bf4592540a
Signed by: Laborratte5
GPG key ID: 3A30072E35202C02
2 changed files with 21 additions and 1 deletions

20
app/Parser.hs Normal file
View file

@ -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

View file

@ -52,7 +52,7 @@ executable simple-arithmetic-compiler
main-is: Main.hs main-is: Main.hs
-- Modules included in this executable, other than Main. -- Modules included in this executable, other than Main.
other-modules: Lexer other-modules: Lexer, Parser
-- LANGUAGE extensions used by modules in this package. -- LANGUAGE extensions used by modules in this package.
-- other-extensions: -- other-extensions: