Source

Toy C#-ish compiler / Envs.hs

Full commit
{-# LANGUAGE TemplateHaskell #-}
module Envs where

import Control.Lens
import Data.Map
import SymbolTable
import CSharpGram

data ProgramEnv = ProgramEnv { _classes :: Map String ClassEnv
                             , _mainClass :: Maybe String }
                             deriving Show

data ClassEnv = ClassEnv { _name :: String
                         , _parents :: [String]
                         , _mvars :: Table Type
                         , _svars :: Table Type
                         , _mfuns :: Map String (Type, Maybe (String, Int))
                         , _nextVirtual :: Int}
                         deriving Show

$(makeLenses ''ProgramEnv)
$(makeLenses ''ClassEnv)