compiler

package
v0.0.0-...-b687d68 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package compiler contains the core of our compiler.

In brief we go through a three-step process:

  1. We use the lexer to tokenize the expression.

  2. We convert our series of tokens to an internal form.

  3. We walk our internal form, generating output for each block.

There are only one minor complication - storing all the input-floats in the data-area of the program. These require escaping for uniqueness purposes, and to avoid issues with the assembling.

That said this is a toy, and will remain a toy, so I can live with these problems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

Compiler holds our object-state.

func New

func New(input string) *Compiler

New creates a new compiler, given the expression in the constructor.

func (*Compiler) Compile

func (c *Compiler) Compile() (string, error)

Compile converts the input program into a collection of AMD64-assembly language.

func (*Compiler) SetDebug

func (c *Compiler) SetDebug(val bool)

SetDebug changes the debug-flag for our output.

Jump to

Keyboard shortcuts

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