abad

package module
v0.0.0-...-d03bbad Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: MIT Imports: 7 Imported by: 0

README

abad

GoDoc Build Status Go Report Card

Abad stands for Abaddon the destroyer and torturer of men.

Why this name ? Because developing this will be torture, we have been forsaken by God and left on the hands of a torturing angel (we must have done something pretty awful).

End to End Tests

To run the end to end tests you can run:

make test-e2e

These tests assume that you have both d8 and abad installed on the host that is running the tests. d8 is a repl/debugger from the V8 engine, which is our reference implementation used to compare if we are interpreting JavaScript code correctly.

As you can imagine, compiling V8 is not exactly easy...or fun. So we provide a docker image for this. To run the tests inside the docker dev environment you can run:

make dev-test-e2e

Adding new tests is very easy, just add new code samples to tests/e2e/testdata and they will imediately be tested when you run the end to end tests.

If you need to checkout the behavior of some JS code on the V8 engine you can run:

make dev-d8 code=<relative path to JS code inside project dir>

Yeah the JS file with the code has to be inside the project and the path must be relative (because of docker volume mapping stuff).

For example, to run a test.js file inside the project root run:

make dev-d8 code=test.js

Documentation

Overview

Package abad implements the javascript engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Abad

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

Abad interpreter, a very bad one.

func NewAbad

func NewAbad() (*Abad, error)

NewAbad creates a new ecma script evaluator.

func (*Abad) Eval

func (a *Abad) Eval(code string) (types.Value, error)

Eval the code when no filename is involved (interactive/repl mode).

func (*Abad) EvalFile

func (a *Abad) EvalFile(filename string, code string) (types.Value, error)

EvalFile the code that was obtained from filename.

Directories

Path Synopsis
Package ast implements the javascript Abstract Syntax Tree representation.
Package ast implements the javascript Abstract Syntax Tree representation.
cmd
internal
Package lexer implements the lexical scanners of javascript source code into a sequence of tokens.
Package lexer implements the lexical scanners of javascript source code into a sequence of tokens.
tests
fixture
Package fixture contains all the test fixture required to run end to end tests comparing abad against google v8.
Package fixture contains all the test fixture required to run end to end tests comparing abad against google v8.
Package token exports the grammar's lexical tokens.
Package token exports the grammar's lexical tokens.
Package types implements the language built in primitypes types, the Object type and the Object wrappers for each primitive type.
Package types implements the language built in primitypes types, the Object type and the Object wrappers for each primitive type.

Jump to

Keyboard shortcuts

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