tiny

package
v0.0.0-...-d4b45ed Latest Latest
Warning

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

Go to latest
Published: May 3, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const KWCode string = "xileweRWve"

KWCode is the Keyword Code

View Source
const MaxEntry = 100

MaxEntry is the number of Entries allowed in the Symbol Table

View Source
const NKW = 9

NKW is the Number of Keywords

View Source
const NKW1 = 10

NKW1 is the Number of Keywords + 1 (?)

Variables

View Source
var KWList = []string{"IF", "ELSE", "ENDIF", "WHILE", "ENDWHILE", "READ",
	"WRITE", "VAR", "END"}

KWList is the Keyword List

View Source
var LCount int

LCount is a Label Counter

View Source
var Look rune

Look is a Lookahead character

View Source
var NEntry int

NEntry is the Next Entry in the Symbol Table

View Source
var ST []string

ST is the Symbol Table

View Source
var SType []rune

SType is the Symbol Type Table

View Source
var Token rune

Token is an Encoded Token

View Source
var Value string

Value is an Unencoded Token

Functions

func Abort

func Abort(s string)

Abort Reports Error and Halts

func Add

func Add()

Add Recognizes and Translates an Add

func AddEntry

func AddEntry(n string, t rune)

AddEntry Adds a New Entry to Symbol Table

func Alloc

func Alloc()

Alloc Allocates Storage for a Variable

func Allocate

func Allocate(name string, val string)

Allocate Allocates Storage for a Static Variable

func Assignment

func Assignment()

Assignment Parses and Translates an Assignment Statement

func Block

func Block()

Block Parses and Translates a Block of Statements

func BoolExpression

func BoolExpression()

BoolExpression Parses and Translates a Boolean Expression

func BoolOr

func BoolOr()

BoolOr Recognizes and Translates a Boolean OR

func BoolTerm

func BoolTerm()

BoolTerm Parses and Translates a Boolean Term

func BoolXor

func BoolXor()

BoolXor Recognizes and Translates an Exclusive OR

func Branch

func Branch(l string)

Branch Branches Unconditional

func BranchFalse

func BranchFalse(l string)

BranchFalse Branches false

func CheckDup

func CheckDup(n string)

CheckDup Checks the Symbol Table for a Duplicate Identifier Reports an error if identifier is already in table.

func CheckIdent

func CheckIdent()

CheckIdent Checks to Make Sure the Current Token is an Identifier

func CheckTable

func CheckTable(n string)

CheckTable Checks to See if an Identifier is in the Symbol Table Reports an error if it's not.

func Clear

func Clear()

Clear Clears the Primary Register

func CompareExpression

func CompareExpression()

CompareExpression Gets Another Expression and Compares

func Divide

func Divide()

Divide Recognizes and Translates a Divide

func DoIf

func DoIf()

DoIf Recognizes and Translates an IF Construct

func DoRead

func DoRead()

DoRead Processes a Read Statement

func DoWhile

func DoWhile()

DoWhile Parses and Translates a WHILE Statement

func DoWrite

func DoWrite()

DoWrite Processes a Write Statement

func Duplicate

func Duplicate(n string)

Duplicate Reports a Duplicate Identifier

func Emit

func Emit(s string)

Emit Ouputs a String with Tab

func EmitLn

func EmitLn(s string)

EmitLn Ouputs a String with Tab and CRLF

func Epilog

func Epilog()

Epilog Writes the Epilog

func Equals

func Equals()

Equals Recognizes and Translates a Relational "Equals"

func Error

func Error(s string)

Error Reports an Error

func Expected

func Expected(s string)

Expected Reports What Was Expected

func Expression

func Expression()

Expression Parses and Translates a Math Expression

func Factor

func Factor()

Factor Parses and Translates a Math Factor

func GetChar

func GetChar()

GetChar Reads New Character From Input Stream

func GetName

func GetName()

GetName Gets an Identifier

func GetNum

func GetNum()

GetNum Gets a Number

func GetOp

func GetOp()

GetOp Gets an Operator

func Go

func Go()

Go starts the execution of this chapter

func Greater

func Greater()

Greater Recognizes and Translates a Relational "Greater Than"

func Header()

Header Writes Header Info

func InTable

func InTable(n string) bool

InTable Looks for Symbol in Table

func Init

func Init()

Init Initializes

func IsAddOp

func IsAddOp(r rune) bool

IsAddOp Recognizes an AddOp

func IsAlNum

func IsAlNum(r rune) bool

IsAlNum Recognizes an Alphanumeric Character

func IsAlpha

func IsAlpha(r rune) bool

IsAlpha Recognizes an Alpha Character

func IsDigit

func IsDigit(r rune) bool

IsDigit Recognizes a Decimal Digit

func IsMulOp

func IsMulOp(r rune) bool

IsMulOp Recognizes a MulOp

func IsOrOp

func IsOrOp(r rune) bool

IsOrOp Recognizes a Boolean OrOp

func IsRelOp

func IsRelOp(r rune) bool

IsRelOp Recognizes a RelOp

func IsWhite

func IsWhite(r rune) bool

IsWhite Recognizes White Space

func Less

func Less()

Less Recognizes and Translates a Relational "Less Than"

func LessOrEqual

func LessOrEqual()

LessOrEqual Recognizes and Translates a Relational "Less Than or Equal"

func LoadConst

func LoadConst(n string)

LoadConst Loads a Constant Value to Primary Register

func LoadVar

func LoadVar(name string)

LoadVar Loads a Variable to Primary Register

func Locate

func Locate(n string) int

Locate Locates a Symbol in Table

func Lookup

func Lookup(table []string, s string, n int) int

Lookup Looks Up Tokens in the Keyword Table

func MatchString

func MatchString(x string)

MatchString Matches a Specific Input String

func Multiply

func Multiply()

Multiply Recognizes and Translates a Multiply

func Negate

func Negate()

Negate Negates the Primary Register

func NewLabel

func NewLabel() (out string)

NewLabel Generates a Unique label

func Next

func Next()

Next Gets the Next Input Token

func NextExpression

func NextExpression()

NextExpression Gets the Next Expression and Compares

func NotEqual

func NotEqual()

NotEqual Recognizes and Translates a Relational "Not Equals"

func NotFactor

func NotFactor()

NotFactor Parses and Translates a Boolean Factor with Leading NOT

func NotIt

func NotIt()

NotIt Complements the Primary Register

func PopAdd

func PopAdd()

PopAdd Adds Top of Stack to Primary

func PopAnd

func PopAnd()

PopAnd ANDs Top of Stack with Primary

func PopCompare

func PopCompare()

PopCompare Compares Top of Stack with Primary

func PopDiv

func PopDiv()

PopDiv Divides Top of Stack by Primary

func PopMul

func PopMul()

PopMul Multiplies Top of Stack by Primary

func PopOr

func PopOr()

PopOr ORs Top of Stack with Primary

func PopSub

func PopSub()

PopSub Subtracts Primary from Top of Stack

func PopXor

func PopXor()

PopXor XORs Top of Stack with Primary

func PostLabel

func PostLabel(l string)

PostLabel Posts a Label to Outputs

func Prolog

func Prolog()

Prolog Writes the Prolog

func Push

func Push()

Push Pushes Primary onto Stack

func ReadIt

func ReadIt(name string)

ReadIt Reads Variable to Primary Register

func ReadVar

func ReadVar()

ReadVar Reads Variable to Primary Register

func Relation

func Relation()

Relation Parses and Translates a Relation

func Scan

func Scan()

Scan Gets an Identifier and Scans it for Keywords

func SetEqual

func SetEqual()

SetEqual Sets D0 if Compare was =

func SetGreater

func SetGreater()

SetGreater Sets D0 If Compare was >

func SetGreaterOrEqual

func SetGreaterOrEqual()

SetGreaterOrEqual Sets D0 if Compare was >= 0

func SetLess

func SetLess()

SetLess Sets D0 if Compare was <

func SetLessOrEqual

func SetLessOrEqual()

SetLessOrEqual Sets D0 if Compare was <= 0

func SetNEqual

func SetNEqual()

SetNEqual Sets D0

func SkipWhite

func SkipWhite()

SkipWhite Skips Over Leading White Space

func Store

func Store(name string)

Store Stores Primary to Variable

func Subtract

func Subtract()

Subtract Recognizes and Translates a Subtract

func Term

func Term()

Term Parses and Translates a Math Term

func TopDecls

func TopDecls()

TopDecls Parses and Translates Global Declarations

func Undefined

func Undefined(n string)

Undefined Reports an Undefined Identifier

func WriteIt

func WriteIt()

WriteIt Writes from Primary Register

Types

This section is empty.

Jump to

Keyboard shortcuts

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