...

Package generator

import "github.com/zylisp/zylisp/core/generator"
Overview
Index
Subdirectories

Overview ▾

Constants

Generator-specific error messages

const (
    DefInExpressionError           string = "A def within an expression is not allowed"
    NSInExpressionError            string = "A namespace defined in an expression is not allowed"
    LoopWithoutRecurError          string = "There was no recur found in the loop"
    AssertArgsCountError           string = "The assert function requires two arguments"
    AssrtArgTypeError              string = "The assert function's first argument must be a type"
    MissingCallNodeError           string = "Expected call node is missing in root scope"
    CalleeIndentifierMismatchError string = "Expecting call to identifier (i.e. def, defconst, etc.)"
    MissingAssgnmentArgsError      string = "Expecting expression to be assigned to variable: %q"
    NSPackageTypeMismatch          string = "ns package name needs to be an identifier"
    InvalidImportError             string = "Import declaration is invalid"
    InvalidImportUseError          string = "Use of import is invalid"
    ExpectingAsInImportError       string = "Use of import is invalid; expecting: \":as\""
    BinaryArgsCountError           string = "Use of binary operator with only one argument is not allowed"
    UnaryArgsCountError            string = "Use of unary operator requires exactly on argument"
    TooManyArgsError               string = "Too many args (%d) were passed to %s; expected %d"
    TooFewArgsError                string = "Too few args (%d) were passed to %s; expected %d"
)

func EvalExpr

func EvalExpr(node parser.Node) ast.Expr

EvalExpr is a function that takes a parser node and returns an AST expression.

func EvalExprs

func EvalExprs(nodes []parser.Node) []ast.Expr

EvalExprs is a function that takes a collection of parser nodes and returns a collection of AST expressions.

func GenerateAST

func GenerateAST(tree []parser.Node) *ast.File

GenerateAST takes a collection of parser nodes and returns an AST file.

func GenerateASTFromLispFile

func GenerateASTFromLispFile(filename string) (*token.FileSet, *ast.File)

GenerateASTFromLispFile takes a ZYLISP file and generates the Go AST for it, as an AST file set.

func GenerateASTFromLispString

func GenerateASTFromLispString(data string) (*token.FileSet, []ast.Expr)

GenerateASTFromLispString takes a ZYLISP string and generates the Go AST for it and returns both a token file set for it as well as its AST expressions.

func PrintASTFromFile

func PrintASTFromFile(filename string)

PrintASTFromFile takes a filename, generates the Go AST for it, and then prints that AST.

func PrintASTFromLispString

func PrintASTFromLispString(data string)

PrintASTFromLispString takes Lisp data in the form of a string, parses it, and prints the Go AST for it.

func PrintGoFromFile

func PrintGoFromFile(filename string)

PrintGoFromFile takes a filename, generates the Go code for it, and then prints the Go.

func PrintGoFromLispString

func PrintGoFromLispString(data string)

PrintGoFromLispString takes Lisp data in the form of a string, parses it, and prints the generated Go for it.

func WriteASTFromFile

func WriteASTFromFile(fromFile string, toFile string)

WriteASTFromFile takes an input file and an uutput file, reading Lisp from the former and writing Go AST to the latter.

func WriteGoFromFile

func WriteGoFromFile(fromFile string, toFile string)

WriteGoFromFile takes an input file and an uutput file, reading Lisp from the former and writing the corresponding Go for it to the latter.

Subdirectories

Name Synopsis
..
helpers