token

package
v0.0.0-...-d4061d8 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: GPL-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package token contains the list of token-types we accept/recognize.

Index

Constants

View Source
const (
	ILLEGAL = "ILLEGAL"
	EOF     = "EOF"
	IDENT   = "IDENT"
	LABEL   = "LABEL"
	INT     = "INT"
	STRING  = "STRING"
	COMMA   = "COMMA"

	// math
	ADD = "ADD"
	AND = "AND"
	DEC = "DEC"
	DIV = "DIV"
	INC = "INC"
	MUL = "MUL"
	OR  = "OR"
	SUB = "SUB"
	XOR = "XOR"

	// control-flow
	CALL  = "CALL"
	JMP   = "JMP"
	JMPNZ = "JMPNZ"
	JMPZ  = "JMPZ"
	RET   = "RET"

	// stack
	PUSH = "PUSH"
	POP  = "POP"

	// types
	IS_STRING  = "IS_STRING"
	IS_INTEGER = "IS_INTEGER"
	STRING2INT = "STRING2INT"
	INT2STRING = "INT2STRING"

	// compare
	CMP = "CMP"

	// store
	STORE = "STORE"

	// print
	PRINT_INT = "PRINT_INT"
	PRINT_STR = "PRINT_STR"

	// memory
	PEEK = "PEEK"
	POKE = "POKE"

	// Misc
	CONCAT = "CONCAT"
	DATA   = "DATA"
	DB     = "DB"
	EXIT   = "EXIT"
	MEMCPY = "MEMCPY"
	NOP    = "NOP"
	RANDOM = "RANDOM"
	SYSTEM = "SYSTEM"
	TRAP   = "TRAP"
)

pre-defined Type

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type    Type
	Literal string
}

Token struct represent the lexer token

type Type

type Type string

Type is a string

func LookupIdentifier

func LookupIdentifier(identifier string) Type

LookupIdentifier used to determinate whether identifier is keyword nor not

Jump to

Keyboard shortcuts

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