All Projects → ibilon → HaxeVM

ibilon / HaxeVM

Licence: MIT license
Prototype compiler/virtual machine in Haxe for Haxe

Programming Languages

haxe
709 projects

Projects that are alternatives of or similar to HaxeVM

bfpile
Optimizing Brainfuck compiler, transpiler and interpreter
Stars: ✭ 19 (-20.83%)
Mutual labels:  interpreter
fastbasic
FastBasic - Fast BASIC interpreter for the Atari 8-bit computers
Stars: ✭ 108 (+350%)
Mutual labels:  interpreter
jsish
Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support.
Stars: ✭ 32 (+33.33%)
Mutual labels:  interpreter
Tiny-Basic
A tiny and basic TINY-BASIC interpreter
Stars: ✭ 33 (+37.5%)
Mutual labels:  interpreter
roda
Röda: A stream-oriented scripting language
Stars: ✭ 43 (+79.17%)
Mutual labels:  interpreter
monkey
The Monkey Programming Language & Interpreter written in PHP.
Stars: ✭ 21 (-12.5%)
Mutual labels:  interpreter
Script
Script is an object-oriented interpreted programming language. Being migrated to CppUtils
Stars: ✭ 18 (-25%)
Mutual labels:  interpreter
PDDL.jl
Julia parser, interpreter and compiler interface for the Planning Domain Definition Language (PDDL). Planners not included.
Stars: ✭ 52 (+116.67%)
Mutual labels:  interpreter
types-and-programming-languages
C++ Implementations of programming languages and type systems studied in "Types and Programming Languages" by Benjamin C. Pierce..
Stars: ✭ 32 (+33.33%)
Mutual labels:  interpreter
pyccolo
Declarative instrumentation for Python.
Stars: ✭ 70 (+191.67%)
Mutual labels:  interpreter
monkey-interpreter
Monkey programming language interpreter designed in "Writing An Interpreter In Go".
Stars: ✭ 26 (+8.33%)
Mutual labels:  interpreter
foolang
A toy programming language.
Stars: ✭ 33 (+37.5%)
Mutual labels:  interpreter
foxscheme
An R5RS Scheme in JavaScript.
Stars: ✭ 15 (-37.5%)
Mutual labels:  interpreter
chip8
CHIP-8 Emulator in Rust
Stars: ✭ 12 (-50%)
Mutual labels:  interpreter
quickjs-build
Build for QuickJS JavaScript Engine
Stars: ✭ 25 (+4.17%)
Mutual labels:  interpreter
embed
An embeddable, tiny Forth interpreter with metacompiler.
Stars: ✭ 80 (+233.33%)
Mutual labels:  interpreter
JSchemeMin
A small scheme implementation in java
Stars: ✭ 22 (-8.33%)
Mutual labels:  interpreter
slox
Swift implementation of a Lox interpreter
Stars: ✭ 39 (+62.5%)
Mutual labels:  interpreter
locks-py
Python implementation of locks, which is an imperative, dynamically typed, procedure oriented scripting language based on the lox programming language.
Stars: ✭ 29 (+20.83%)
Mutual labels:  interpreter
Dictu
Dictu is a high-level dynamically typed, multi-paradigm, interpreted programming language.
Stars: ✭ 191 (+695.83%)
Mutual labels:  interpreter

HaxeVM

License Build Status Issue Count Test Coverage

Prototype compiler/virtual machine in Haxe for Haxe. Requires Haxe 4.

Currently support a very small subset of the language. Can run files containing a single class with a single static function called main.

You can test it using haxelib:

haxelib git haxevm https://github.com/ibilon/HaxeVM.git
haxelib run haxevm path/to/file.hx

Or from the repository:

git clone https://github.com/ibilon/HaxeVM.git
cd HaxeVM
haxe extraParams.hxml --run haxevm.Main path/to/file.hx

For example:

class Main
{
	public static function main()
	{
		trace("Hello world");

		var a = [7, 5, 6];
		function t(a:Int)
		{
			trace(a);
		}
		t(a[0]);
		t(0);
		var b = a[1] + 8.0;
		trace(b);
		b = -2;
		trace(b);
		var b = "hi";
		trace(b);

		var obj = { sub: { hello: "well hello" }, a: 12, b: -7.2 };
		trace(obj.sub.hello);
		trace(obj.a + obj.b);
		trace(obj.a - obj.b);
		trace(obj);

		var a = true;
		var b = false;

		function boolTest(b:Bool)
		{
			if (b)
			{
				trace("is true");
				return 0;
			} else {
				trace("is false");
			}

			return -1;
		}

		trace(a);
		trace(boolTest(a));
		trace(b);
		trace(boolTest(b));

		var i = 10;
		trace(i--);
		trace(i);
		trace(--i);
		trace(i);
		trace(i < 0);

		while (--i >= 0)
		{
			if (i == 5)
			{
				continue;
			}

			trace(i);

			if (i < 2)
			{
				break;
			}
		}

		for (i in 0...5)
		{
			if (i == 2)
			{
				continue;
			}

			trace(i * 2);

			if (i == 4)
			{
				break;
			}
		}
	}
}

gives the expected output:

test/samples/Main.hx:5: Hello world
test/samples/Main.hx:10: 7
test/samples/Main.hx:10: 0
test/samples/Main.hx:15: 13
test/samples/Main.hx:17: -2
test/samples/Main.hx:19: hi
test/samples/Main.hx:22: well hello
test/samples/Main.hx:23: 4.8
test/samples/Main.hx:24: 19.2
test/samples/Main.hx:25: {sub: {hello: well hello}, a: 12, b: -7.2}
test/samples/Main.hx:43: true
test/samples/Main.hx:34: is true
test/samples/Main.hx:44: 0
test/samples/Main.hx:45: false
test/samples/Main.hx:37: is false
test/samples/Main.hx:46: -1
test/samples/Main.hx:49: 10
test/samples/Main.hx:50: 9
test/samples/Main.hx:51: 8
test/samples/Main.hx:52: 8
test/samples/Main.hx:53: false
test/samples/Main.hx:62: 7
test/samples/Main.hx:62: 6
test/samples/Main.hx:62: 4
test/samples/Main.hx:62: 3
test/samples/Main.hx:62: 2
test/samples/Main.hx:62: 1
test/samples/Main.hx:134: 0
test/samples/Main.hx:134: 2
test/samples/Main.hx:134: 6
test/samples/Main.hx:134: 8
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].