This library defines a representation for Go programs. It does not cover all aspects of the programming language Go. It is intended for applications generating Go programs.
Author: Jonas Boehm
Version: November 2020
Data types representing Go programs. The types were based on the golang specification, which can be found here: golang.org/ref/spec Go types are represented as Strings.
Type synonym: Type = String
Go identificators are represented as Strings.
Type synonym: Id = String
Go operators are represented as Strings.
Type synonym: Op = String
Type of Go expressions.
Constructors:
GoBoolLit
:: Bool -> GoExpr
GoIntLit
:: Int -> GoExpr
GoFloatLit
:: Float -> GoExpr
GoStringLit
:: String -> GoExpr
GoByteLit
:: Char -> GoExpr
GoCompositeLit
:: Type -> [GoExpr] -> GoExpr
GoOpName
:: Id -> GoExpr
GoOpExpr
:: GoExpr -> GoExpr
GoConversion
:: Type -> GoExpr -> GoExpr
GoSelector
:: GoExpr -> Id -> GoExpr
GoIndex
:: GoExpr -> GoExpr -> GoExpr
GoSlice
:: GoExpr -> GoExpr -> GoExpr -> GoExpr
GoVariadic
:: GoExpr -> GoExpr
GoCall
:: GoExpr -> [GoExpr] -> GoExpr
GoUnaryExpr
:: Op -> GoExpr -> GoExpr
GoBinaryExpr
:: GoExpr -> Op -> GoExpr -> GoExpr
Type of Go statements.
Constructors:
GoConstDecl
:: [Id] -> Type -> [GoExpr] -> GoStat
GoVarDecl
:: [Id] -> Type -> [GoExpr] -> GoStat
GoShortVarDecl
:: [Id] -> [GoExpr] -> GoStat
GoExprStat
:: GoExpr -> GoStat
GoAssign
:: [GoExpr] -> Op -> [GoExpr] -> GoStat
GoEmpty
:: GoStat
GoReturn
:: [GoExpr] -> GoStat
GoBreak
:: GoStat
GoContinue
:: GoStat
GoBlock
:: [GoStat] -> GoStat
GoIf
:: GoExpr -> [GoStat] -> [GoStat] -> GoStat
GoExprSwitch
:: GoExpr -> [GoExprBranch] -> GoStat
Type representing a branch of an expression switch statement.
Constructors:
Type of Go program. Arguments are name, imports, top-level declarations.
Constructors:
GoProg
:: String -> [String] -> [GoTopLevelDecl] -> GoProg
Type of Go top-level declarations.
Constructors:
GoTopLevelDecl
:: GoStat -> GoTopLevelDecl
GoTopLevelFuncDecl
:: GoFuncDecl -> GoTopLevelDecl
Type of Go function declaration. Arguments are name, parameters, return values, body.
Constructors:
Type of Go parameter
Constructors: