ddc-source-tetra-0.4.1.1: Disciplined Disciple Compiler source language.

Safe HaskellNone

DDC.Source.Tetra.Transform.Defix

Synopsis

Documentation

data FixTable a n Source

Table of infix operator definitions.

Constructors

FixTable [FixDef a n] 

data FixDef a n Source

Infix operator definition.

Constructors

FixDefPrefix 

Fields

fixDefSymbol :: String
 
fixDefExp :: a -> Exp a n
 
FixDefInfix 

data InfixAssoc Source

Infix associativity.

Constructors

InfixLeft

Left associative.

InfixRight

Right associative.

InfixNone

Non associative.

defaultFixTable :: FixTable SourcePos NameSource

Default fixity table for infix operators.

data Error a n Source

Things that can go wrong when defixing code.

Constructors

ErrorNoInfixDef

Infix operator symbol has no infix definition.

Fields

errorAnnot :: a
 
errorSymbol :: String
 
ErrorDefixNonAssoc

Two non-associative operators with the same precedence.

ErrorDefixMixedAssoc

Two operators of different associativies with same precedence.

Fields

errorAnnot :: a
 
errorOps :: [String]
 
ErrorMalformed

Infix expression is malformed. Eg + 3 or 2 + + 2

Fields

errorAnnot :: a
 
errorExp :: Exp a n
 

Instances

(Show a, Show n) => Show (Error a n) 
Pretty n => Pretty (Error SourcePos n) 

class Defix c whereSource

Methods

defix :: FixTable a n -> c a n -> Either (Error a n) (c a n)Source

Resolve infix expressions in a thing.