# README
gc
Package GC is a Go compiler front end. (Work in progress)
Installation
$ go get modernc.org/gc
Documentation: godoc.org/modernc.org/gc
# Functions
IgnoreRedeclarations disables reporting redeclarations as errors.
LocalImportsPath sets the relative path for local imports.
NewContext returns a newly created Context.
NoErrorColumns disable displaying of columns in error messages.
NoErrorLimit disables limit on number of errors reported.
# Constants
[Expr]Element.
Values of ScopeKind.
TypeKind values.
T in 'func make(T)'.
U in 'func delete(map[T]U)'.
U in 'func complex(r, i T) U'.
T in 'func complex(r, i T) U'.
U in 'make(T, ...U)'.
chan T.
TypeKind values.
TypeKind values.
Values of DeclarationKind.
Values of ScopeKind.
TypeKind values.
TypeKind values.
Values of DeclarationKind.
func(params) result.
Values of DeclarationKind.
TypeKind values.
TypeKind values.
TypeKind values.
TypeKind values.
TypeKind values.
interface{...}.
TypeKind values.
map[T]U.
Values of DeclarationKind.
Values of ScopeKind.
*T.
qualifier.ident.
Values of type ChanDir.
[]T.
TypeKind values.
struct{...}.
(T1, T2, ...).
Values of type ChanDir.
Values of DeclarationKind.
ident.
TypeKind values.
TypeKind values.
TypeKind values.
TypeKind values.
TypeKind values.
TypeKind values.
Values of ScopeKind.
TypeKind values.
TypeKind values.
TypeKind values.
TypeKind values.
TypeKind values.
TypeKind values.
TypeKind values.
Values of DeclarationKind.
# Structs
ArrayType represents '[Expr]Element'.
CaseBlock represents data reduced by productions
caseBlockList: | caseBlockList "case" exprOrTypeList ":=" expr ':' stmtList | caseBlockList "case" exprOrTypeList ':' stmtList | caseBlockList "case" exprOrTypeList '=' expr ':' stmtList | caseBlockList "default" ':' stmtList.
ChannelType represents 'chan Element'.
CompLitExprExpr is a CompLitExpr.
CompLitExprKeyValList is a CompLitExpr.
ConstDecl describes a constant declaration.
Context describes the context of loaded packages.
ElseIf represents data reduced by productions
elseIfList: | elseIfList "else" "if" ifHeader loopBody.
ExprADD represents LHS + RHS.
ExprAND represents LHS & RHS.
ExprANDNOT represents LHS &^ RHS.
ExprARROW represents LHS <- RHS.
ExprEQL represents LHS == RHS.
ExprGEQ represents LHS >= RHS.
ExprGTR represents LHS > RHS.
ExprLAND represents LHS && RHS.
ExprLEQ represents LHS <= RHS.
ExprLOR represents LHS || RHS.
ExprLSS represents LHS < RHS.
ExprMUL represents LHS * RHS.
ExprNEQ represents LHS != RHS.
ExprOR represents LHS | RHS.
ExprOrTypeExpr is an ExprOrType.
ExprOrTypeType is an ExprOrType.
ExprQUO represents LHS / RHS.
ExprREM represents LHS % RHS.
ExprSHL represents LHS << RHS.
ExprSHR represents LHS >> RHS.
ExprSUB represents LHS - RHS.
ExprXOR represents LHS 6 RHS.
FieldDeclarationEmbedded is a FieldDeclaration.
FieldDeclarationNamed is a FieldDeclaration.
FuncDecl describes a function declaration.
FunctionType represents 'func(Params) Result'.
Ident represents an identifier and its resolution scope.
IfHeader1 describes if foo() ...
IfHeader2 describes if x := foo(); x > 3 ...
ImportDecl is an import declaration.
InterfaceType represents 'interface{...}'.
InvalidValue represents an invalidValue.
KeyValExpr is a KeyVal.
KeyValKeyedExpr is a KeyVal.
MapType represents 'map[Key]Value'.
MethodDecl describes a method declaration.
NamedType represents 'identifier type'.
Package describes a package.
ParamTypeIdentType is a ParamType that includes the name of the parameter.
ParamTypeListIdentType is a ParamTypeList of ParamTypeIdentType.
ParamTypeListType is a ParamTypeList of ParamTypeType.
ParamTypeType is a ParamType without a name of the parameter.
PointerType represents '*Element'.
PrimaryExprCall is an Expr.
PrimaryExprCompositeLiteral is an Expr.
PrimaryExprConversion is an Expr.
PrimaryExprFloatLiteral is an Expr.
PrimaryExprFullSlice is an Expr.
PrimaryExprFuncLiteral is an Expr.
PrimaryExprIdent is an Expr.
PrimaryExprImagLiteral is an Expr.
PrimaryExprIndex is an Expr.
PrimaryExprIntLiteral is an Expr.
PrimaryExprParenExpr is an Expr.
PrimaryExprRuneLiteral is an Expr.
PrimaryExprSelector is an Expr.
PrimaryExprSimpleSlice is an Expr.
PrimaryExprStringLiteral is an Expr.
PrimaryExprTypeAssertion is an Expr.
PrimaryExprTypeSwitchGuard is an Expr.
QualifiedNamedType represents 'qualifier.identifier'.
Scope tracks declarations.
SimpleStmtAddAssign describes expr += expr.
SimpleStmtAndAssign describes expr &= expr.
SimpleStmtAndNotAssign describes expr &^= expr.
SimpleStmtAssignment describes exprList = exprList.
SimpleStmtDec describes expr--.
SimpleStmtDecl describes a list of declarations.
SimpleStmtDefine describes exprList := exprList.
SimpleStmtExpr describes an expresssion statement.
SimpleStmtInc describes expr++.
SimpleStmtMulAssign describes expr *= expr.
SimpleStmtOrAssign describes expr |= expr.
SimpleStmtQuoAssign describes expr /= expr.
SimpleStmtRemAssign describes expr %= expr.
SimpleStmtSend describes expr <- expr.
SimpleStmtShlAssign describes expr <<= expr.
SimpleStmtShrAssign describes expr >>= expr.
SimpleStmtSubAssign describes expr -= expr.
SimpleStmtXorAssign describes expr ^= expr.
SliceType represents '[]Element'.
SourceFile describes a source file.
StmtBlock describes { stmt; stmt2; ..
StmtBreak describes break label.
StmtContinue describes continue label.
StmtDefer describes defer expr.
StmtFallthrough describes falltrough.
StmtFor describes for stmt; stmt2; stmt3 { body }.
StmtForRange describes for i := range expr { body } or the = variant.
StmtGo describes go expr.
StmtGoto describes goto ident.
StmtIf descibes if ifHeader body elseIfList else body2.
StmtLabeled describes label: stmt.
StmtReturn describes return expr.
StmtSelect describes select {}.
StmtSwitch describes switch {}.
StructType represents 'struct{...}'.
Token represents the position and value of a token.
TupleType represents '(T1, T2, ...)'.
TypeDecl describes a type declaration.
UnaryExprAddr is an Expr.
UnaryExprDeref is an Expr.
UnaryExprNeg is an Expr.
UnaryExprNot is an Expr.
UnaryExprPos is an Expr.
UnaryExprReceive is an Expr.
UnaryExprXor is an Expr.
UntypedBooleanValue represents a true/false value.
UntypedFalse represents a boolean false constant.
UntypedIntOperand represents an integer operand.
UntypedIntValue represents an untyped integer.
UntypedTrue represents a bool true constant.
VarDecl describes a variable declaration.
# Interfaces
CompLitExpr represents data reduced by productions
compLitExpr: '{' bracedKeyValList '}' | expr.
Declaration is one of *ConstDecl, *FuncDecl, *ImportSpec, *MethodDecl, *TypeDecl or *VarDecl.
Expr represents data reduced by productions
expr: expr "!=" expr | expr "&&" expr | expr "&^" expr | expr "<-" expr | expr "<<" expr | expr "<=" expr | expr "==" expr | expr ">=" expr | expr ">>" expr | expr "||" expr | expr '%' expr | expr '&' expr | expr '*' expr | expr '+' expr | expr '-' expr | expr '/' expr | expr '<' expr | expr '>' expr | expr '^' expr | expr '|' expr | unaryExpr.
ExprOrType represents data reduced by productions
exprOrType: expr | nonExprType %prec _PreferToRightParen.
FieldDeclaration represents data reduced by productions
fieldDecl: '*' embeddedName literalOpt | identList typ literalOpt | embeddedName literalOpt.
IfHeader represents data reduced by productions
ifHeader: simpleStmtOpt | simpleStmtOpt ';' simpleStmtOpt.
KeyVal represents data reduced by productions
keyVal: compLitExpr | compLitExpr ':' compLitExpr.
No description provided by the author
Operand describes operation's operand.
ParamType represents data reduced by productions
paramType: IDENT dddType | IDENT typ | dddType | typ.
ParamTypeList represents data reduced by productions
paramTypeList: paramType | paramTypeList ',' paramType.
Stmt represents data reduced by productions
stmt: | "break" identOpt | "continue" identOpt | "defer" primaryExpr | "fallthrough" | "for" "range" expr loopBody | "for" exprList ":=" "range" expr loopBody | "for" exprList '=' "range" expr loopBody | "for" simpleStmtOpt ';' simpleStmtOpt ';' simpleStmtOpt loopBody | "for" simpleStmtOpt loopBody | "go" primaryExpr | "goto" IDENT | "if" ifHeader loopBody elseIfList | "if" ifHeader loopBody elseIfList "else" compoundStmt | "return" | "return" exprList | "select" BODY caseBlockList '}' | "switch" ifHeader BODY caseBlockList '}' | IDENT ':' stmt | commonDecl | compoundStmt | simpleStmt.
Type represents a Go type.
Value represents operand's value.
# Type aliases
Bindings map names to Declarations.
ChanDir represents channel direction.
DeclarationKind describes a Declaration's Kind.
Option amends Context.
PrimaryExpr represents data reduced by productions
primaryExpr: '(' exprOrType ')' | IDENT genericArgsOpt %prec _NotParen | convType '(' expr commaOpt ')' | fnType lbrace stmtList '}' | literal | otherType lbrace bracedKeyValList '}' | primaryExpr '(' ')' | primaryExpr '(' exprOrTypeList "..." commaOpt ')' | primaryExpr '(' exprOrTypeList commaOpt ')' | primaryExpr '.' '(' "type" ')' | primaryExpr '.' '(' exprOrType ')' | primaryExpr '.' IDENT | primaryExpr '[' expr ']' | primaryExpr '[' exprOpt ':' exprOpt ':' exprOpt ']' | primaryExpr '[' exprOpt ':' exprOpt ']' | primaryExpr '{' bracedKeyValList '}'.
ScopeKind describe a Scope's Kind.
SimpleStmt represents data reduced by productions
simpleStmt: expr | expr "%=" expr | expr "&=" expr | expr "&^=" expr | expr "*=" expr | expr "++" | expr "+=" expr | expr "--" | expr "-=" expr | expr "/=" expr | expr "<<=" expr | expr ">>=" expr | expr "^=" expr | expr "|=" expr | exprList ":=" exprList | exprList '=' exprList.
TypeKind represents a particular type kind.
UnaryExpr represents data reduced by productions
unaryExpr: "<-" unaryExpr | '!' unaryExpr | '&' unaryExpr | '*' unaryExpr | '+' unaryExpr | '-' unaryExpr | '^' unaryExpr | primaryExpr.