go-compileutil

module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: BSD-3-Clause

README

This package implements several utility packages for compilers, interpreters, and similar programs. Such programs tend to have common elements, and I grew tired of writing and rewriting the same code over and over again - each failing to capture bug fixes from its predecessor. Some of these packages are intended to be useful for any compiler. Others are useful in selected common cases.

The main packages here are:

  • diag - A package for conventional diagnostics supporting multiple diagnostic levels (info, warn, error, fatal). Diagnostic sets comply with Go's error interface. Diagnostic sets are mergeable, allowing them to be used in parsers that rely on roll back and replay.
  • indentedwriter - An implementation of io.Writer that facilitates proper output indentation.
  • intern - A package that maps byte sequences into unique instances, mildly specialized for common cases of symbol names found in compilation units.
  • position - An abstract type (an interface) for recording input positions, with a usable example implementation.
  • reader - Support for low-level source file I/O, including condensed position tracking and input backtracking.
  • testing_cwd - A package you can import to ensure that go test, dlv test, and others all execute their tests from the same working directory. This is helpful if you want to write tests that source input files from the tree and have them work under the various different testing tools.

The principal documentation for these packages is the go documentation, which can be browsed online at pkg.go.com.

Directories

Path Synopsis
Package diag implements a traditional multi-level diagnostic system compatible with the Go error interface.
Package diag implements a traditional multi-level diagnostic system compatible with the Go error interface.
Package indentedWriter implements an io.Writer that prefaces each output line with a defined number of spaces.
Package indentedWriter implements an io.Writer that prefaces each output line with a defined number of spaces.
Package intern maps byte slices into unique symbol identifiers and private copies of those byte slices having the same value.
Package intern maps byte slices into unique symbol identifiers and private copies of those byte slices having the same value.
Abstraction of a position for use by consumers, with a basic implementation.
Abstraction of a position for use by consumers, with a basic implementation.
Package reader provides byte-level I/O and position tracking for compilers and interpreters, including backtracking support.
Package reader provides byte-level I/O and position tracking for compilers and interpreters, including backtracking support.
Hack to ensure that the current working directory for test execution is the project top level directory.
Hack to ensure that the current working directory for test execution is the project top level directory.

Jump to

Keyboard shortcuts

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