LobsterLang-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

AstOptimizer

Synopsis

Documentation

optimizeAst :: [ScopeMb] -> [Ast] -> Bool -> [Either AstError AstOptimised] Source #

Optimize a list of Ast and check for invalid operation: optimization is taking place when operation have the same result no matter what for exemple `3 + 3`, when a forbidden operation is taking place, the optimization results in an AstError, when the optimization was a success it results in an AstOptimised. Takes the stack (`[ScopeMb]`), a list of Ast, a boolean to indicate whether the optimization take place insinde a function and returns the list of Either AstError or AstOptimised

fromOpti :: AstOptimised -> Ast Source #

Get the Ast contained in a AstOptimised

data AstError Source #

Constructors

Error String Ast 

Instances

Instances details
Show AstError Source # 
Instance details

Defined in AstOptimizer

Eq AstError Source # 
Instance details

Defined in AstOptimizer

data AstOptimised Source #

Constructors

Result Ast

The Ast after optimization

Warning String Ast

When the optimization throw a warning contains the warining message and the Ast post optimization that caused it

Instances

Instances details
Show AstOptimised Source # 
Instance details

Defined in AstOptimizer

Eq AstOptimised Source # 
Instance details

Defined in AstOptimizer