BNFC-2.9.0: A compiler front-end generator.
Safe HaskellNone
LanguageHaskell2010

BNFC.TypeChecker

Description

Type checker for defined syntax constructors define f xs = e.

Synopsis

Type checker entry point

checkDefinitions :: CF -> Err () Source #

Entry point.

data Base Source #

Type of a non-terminal.

Constructors

BaseT String 
ListT Base 

Instances

Instances details
Eq Base Source # 
Instance details

Defined in BNFC.CF

Methods

(==) :: Base -> Base -> Bool #

(/=) :: Base -> Base -> Bool #

Ord Base Source # 
Instance details

Defined in BNFC.CF

Methods

compare :: Base -> Base -> Ordering #

(<) :: Base -> Base -> Bool #

(<=) :: Base -> Base -> Bool #

(>) :: Base -> Base -> Bool #

(>=) :: Base -> Base -> Bool #

max :: Base -> Base -> Base #

min :: Base -> Base -> Base #

Show Base Source # 
Instance details

Defined in BNFC.CF

Methods

showsPrec :: Int -> Base -> ShowS #

show :: Base -> String #

showList :: [Base] -> ShowS #

Backdoor for rechecking defined syntax constructors for list types

checkDefinition' Source #

Arguments

:: ListConstructors

Translation of the list constructors.

-> Context

Signature (types of labels).

-> RFun

Function name.

-> [String]

Function arguments.

-> Exp

Function body.

-> Err (Telescope, (Exp, Base))

Typed arguments, translated body, type of body.

buildSignature :: [Rule] -> Err Signature Source #

Create context containing the types of all labels, computed from the rules.

Fail if a label is used at different types.

buildContext :: CF -> Context Source #

ctxTokens :: Context -> [String] Source #

User-defined token types.

isToken :: String -> Context -> Bool Source #

data ListConstructors Source #

Constructors

LC (Base -> String) (Base -> String)