sutori-0.2.4: Sutori language compiler

Safe HaskellSafe
LanguageHaskell2010

Sutori.SymTable

Description

This module defines all the interaction with the table, along with the symbols themselves, their different categories and payloads.

Synopsis

Documentation

class SutSymbol a => ASTSymbol a where Source #

Represents a symbol that holds an AST

Minimal complete definition

symAST

Methods

symAST Source #

Arguments

:: a 
-> SutAST

The AST held by the symbol

symPreAST Source #

Arguments

:: a 
-> SutAST

An optional (empty by default) AST (hidden, preppended)

class SutSymbol a => OffsetSymbol a where Source #

Represents a symbol that _may_ hold an offset

Minimal complete definition

symOffset

Methods

symOffset :: a -> Offset Source #

class SutSymbol a => ParametricSymbol a where Source #

Represents a symbol which also has some parameters

Minimal complete definition

symParams

Methods

symParams Source #

Arguments

:: a 
-> [SutParam]

The list of parameters (in order)

type Scope = Int Source #

A Scope is just a number uniquely representing a scope (NOT a level, but an ID)

data SutParam Source #

A SutParam represents a function parameter, and it has a kind, type and ID

Constructors

SutParam 

Fields

Instances

data SymPerson Source #

A person who may do things in the story

Constructors

SymPerson SutID Scope 

type SymTable = Map SutID [SutSymbol'] Source #

A SymTable represents the SymTable of a Sutori parsing, so it matches a SutID (symbol name) to a list of symbols

data SymType Source #

A reference to a (now named) type

class SutSymbol a => TypedSymbol a where Source #

Represents a symbol with a type

Minimal complete definition

symType

Methods

symType Source #

Arguments

:: a 
-> SutTypeID

The type of the symbol

insertSymbol :: SutSymbol' -> SymTable -> SymTable Source #

Inserts a symbol into its ID stack in the map

lookupSymbols :: SutID -> SymTable -> Maybe [SutSymbol'] Source #

Lookup the list of symbols using the given ID

lookupSymbolsVariable :: SutID -> SymTable -> [SymVariable] Source #

Lookup the list of variables with an ID

lookupSymbolsPerson :: SutID -> SymTable -> [SymPerson] Source #

Lookup the list of persons with an ID

lookupSymbolsModule :: SutID -> SymTable -> [SymModule] Source #

Lookup the list of modules with an ID

lookupSymbolsType :: SutID -> SymTable -> [SymType] Source #

Lookup the list of types with an ID

lookupSymbolsFunction :: SutID -> SymTable -> [SymFunction] Source #

Lookup the list of functions with an ID

updateSymbol :: SutSymbol' -> SymTable -> SymTable Source #

Updates (read: replaces) the head of the symbol stack (for this symbol's ID

paramByValue :: SutTypeID -> SutID -> SutParam Source #

Helper to abstract the True/False isRef field

paramByRef :: SutTypeID -> SutID -> SutParam Source #

Helper to abstract the True/False isRef field

lookupAllFunctions :: Scope -> SymTable -> [SymFunction] Source #

Lookup all defined functions in a given scope