Implement basic interpreted language

This commit is contained in:
Martin Fredin 2023-01-20 14:12:04 +01:00
parent d28aa9fc5d
commit 64ee4dc432
12 changed files with 559 additions and 1 deletions

26
src/Grammar/Abs.hs Normal file
View 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)