Implement basic interpreted language
This commit is contained in:
parent
d28aa9fc5d
commit
64ee4dc432
12 changed files with 559 additions and 1 deletions
26
src/Grammar/Abs.hs
Normal file
26
src/Grammar/Abs.hs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
-- File generated by the BNF Converter (bnfc 2.9.4.1).
|
||||
|
||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||
|
||||
-- | The abstract syntax of language Grammar.
|
||||
|
||||
module Grammar.Abs where
|
||||
|
||||
import Prelude (Integer, String)
|
||||
import qualified Prelude as C (Eq, Ord, Show, Read)
|
||||
import qualified Data.String
|
||||
|
||||
data Program = Program Exp
|
||||
deriving (C.Eq, C.Ord, C.Show, C.Read)
|
||||
|
||||
data Exp
|
||||
= EId Ident
|
||||
| EInt Integer
|
||||
| EApp Exp Exp
|
||||
| EAdd Exp Exp
|
||||
| EAbs Ident Exp
|
||||
deriving (C.Eq, C.Ord, C.Show, C.Read)
|
||||
|
||||
newtype Ident = Ident String
|
||||
deriving (C.Eq, C.Ord, C.Show, C.Read, Data.String.IsString)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue