compiler

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package compiler provides functionality for parsing Golang code.

Index

Constants

View Source
const (
	VarInitFunctionName     = "VariableInit"
	VarInitFunctionFullName = "github.com/retroenv/nesgo/pkg/nes.VariableInit"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

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

Compiler defines a new compiler.

func New

func New(cfg *Config) (*Compiler, error)

New returns a new compiler.

func (*Compiler) OutputAsmFile

func (c *Compiler) OutputAsmFile(fileName string) (string, string, error)

OutputAsmFile creates an .asm file based on the given .nes file name as base.

func (*Compiler) Parse

func (c *Compiler) Parse(fileName string, data []byte) error

Parse parses a file content and it's imports.

type Config

type Config struct {
	// DisableComments does not output any comments.
	DisableComments bool
}

Config contains the compiler configuration.

type File

type File struct {
	Path      string
	IsIgnored bool
	Package   string

	Imports   []*ast.Import
	Constants []*ast.Constant
	Variables []*ast.Variable
	Functions []*ast.Function
	// contains filtered or unexported fields
}

File is a .go file.

type Function

type Function struct {
	Definition *ast.FunctionDefinition
	Body       *ast.NodeList

	// package that this function belongs to
	Package *Package
	// map of all labels in this function
	Labels map[string]*ast.Label
	// function is an IRQ handler and has to return with rti instruction
	IrqHandler bool
}

Function is a function declaration.

type Package

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

Package represents a code package.

Jump to

Keyboard shortcuts

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