giml-backend-js-0.1.0.0: A JavaScript backend for Giml
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Backend.JS.Ast

Description

An AST of a subset of JavaScript

Synopsis

Documentation

data File Source #

A JavaScript file

Constructors

File [Statement] 

Instances

Instances details
Show File Source # 
Instance details

Defined in Language.Backend.JS.Ast

Methods

showsPrec :: Int -> File -> ShowS #

show :: File -> String #

showList :: [File] -> ShowS #

data Definition Source #

A JavaScript definition

Constructors

Variable Var Expr 
Function Var [Var] Block 

Instances

Instances details
Show Definition Source # 
Instance details

Defined in Language.Backend.JS.Ast

type Block = [Statement] Source #

A JavaScript scoped block

data Statement Source #

A JavaScript statement

Constructors

SExpr Expr

An expression

SRet Expr

A return statement

SDef Definition

A definition

SIf Expr Block

An if statement (we don't need else for Giml)

SRecordClone Var Expr

A complex statement that shallowly clones an expression

SRecordAssign Var Label Expr

Record label assignment

Instances

Instances details
Show Statement Source # 
Instance details

Defined in Language.Backend.JS.Ast

data Expr Source #

A JavaScript expression

Constructors

ELit Lit

A literal

EVar Var

A variable

EFun [Var] Block

An anonymous function

EFunCall Expr [Expr]

A function call

ERecord (Record Expr)

A record

EAnd [Expr]

expressions separated by &&

EEquals Expr Expr

Equality of two expressions

EBinOp Text Expr Expr

a binary operator application

ENot Expr

A negation of an expression

ERecordAccess Expr Label

Record label access

ERaw Text

A raw JavaScript string

Instances

Instances details
Show Expr Source # 
Instance details

Defined in Language.Backend.JS.Ast

Methods

showsPrec :: Int -> Expr -> ShowS #

show :: Expr -> String #

showList :: [Expr] -> ShowS #

type Label = Text Source #

A record label

type Record a = Map Var a Source #

A record

data Lit Source #

A JavaScript literal

Instances

Instances details
Show Lit Source # 
Instance details

Defined in Language.Backend.JS.Ast

Methods

showsPrec :: Int -> Lit -> ShowS #

show :: Lit -> String #

showList :: [Lit] -> ShowS #

type Var = Text Source #

A JavaScript variable