Version: v0.0.0-...-841d92d Latest Latest

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

Go to latest
Published: Jul 27, 2020 License: BSD-2-Clause Imports: 0 Imported by: 0




This section is empty.


This section is empty.


func GetPrecedence

func GetPrecedence(src Token) int

* returns the precedence of the operator given * if 0 is returned then the token is not an operator

func IsOperator

func IsOperator(src Token) bool

determines wether the given token is an operator

func Print

func Print(src Token) string

returns the content of a token in a readable format

func PrintArr

func PrintArr(src []Token) string

prints an array of tokens in a readable format


type Token

type Token struct {
	/* Type of Token */
	T Type
	/* Raw string value of Token */
	S string

func Pop

func Pop(src *[]Token) Token

pop the last element in src., for use with stacks

type Type

type Type int

sketchy enum implementation using constants

const (
	NULL Type = 0

	NUM Type = 1

	/* operators */
	ADD Type = 2
	SUB Type = 3
	MUL Type = 4
	DIV Type = 5

	LBRAC Type = 6
	RBRAC Type = 7

Source Files

Jump to

Keyboard shortcuts

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