parser

package
v0.0.0-...-ef6f610 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EXEC_FILE current file
	EXEC_FILE string = "EXEC-FILE"
	// SELF current process id
	SELF string = "self"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Type      NodeType
	Arguments []Node
	Token     lexer.Token
}

Node a parser node

func Parse

func Parse(tokens []lexer.Token) []Node

Parse parse tokens and return an AST

type NodeType

type NodeType uint8

NodeType a parser node-type

const (
	// ACTION_DEF define
	ACTION_DEF NodeType = 0
	// ACTION_CALL call function
	ACTION_CALL NodeType = 1
	// ACTION_FOR for loop
	ACTION_FOR NodeType = 2
	// ACTION_WHILE for loop
	ACTION_WHILE NodeType = 15
	// ACTION_IF if condition
	ACTION_IF NodeType = 3
	// ACTION_MAP_ACCESS map access
	ACTION_MAP_ACCESS = 4
	// ACTION_MAP map creation
	ACTION_MAP = 14
	// ACTION_BRANCH branch statement
	ACTION_BRANCH = 13
	// IDENTIFIER identifier
	IDENTIFIER NodeType = 5
	// LITERAL_FN function literal
	LITERAL_FN NodeType = 6
	// LITERAL_STRING string literal
	LITERAL_STRING NodeType = 7
	// LITERAL_INT int literal
	LITERAL_INT NodeType = 8
	// LITERAL_FLOAT float literal
	LITERAL_FLOAT NodeType = 9
	// LITERAL_BOOL boolean literal
	LITERAL_BOOL NodeType = 10
	// LITERAL_ATOM atom literal
	LITERAL_ATOM NodeType = 11
	// PARAMETERS a parameter node
	PARAMETERS NodeType = 12
	// STRUCT_DEF struct definition
	STRUCT_DEF NodeType = 16
	// MACRO_DEF macro definition
	MACRO_DEF NodeType = 17
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL