neos Universal Compiler and Bytecode JIT -- Coming Soon
Introduction
neos is a cross-platform (C++) universal compiler that can theoretically compile any scripting/programming language. The compiler targets custom bytecode used by a custom VM with JIT. neos will be used as the scripting engine in the neoGFX project.
The plan is for version 1.0 of neos to ship with implementations of the following scripting/programming languages:
- Ada
- Kotlin
- Python
- JavaScript
- Lua
- C
- Forth
- Haskell
- Brainfuck
neos is open source and the source is available from: https://github.com/i42output/neos.
Features
- Language agnostic: a language schema file describes the syntax and semantics of the scripting/programming language to use (theoretically allowing any language to be used).
- Easy to write ENBF-like language schema file format.
- Extensible generic (cross-language) semantic concepts (extendable by providing semantic concept plugins).
- The ability to mix source code from different programming languages within the same source file.
- Invent your own scripting language to use with neos by writing a new language schema!
Mixing Programming Languages
An interesting side effect of the neos architecture that comes almost for free is the possibility of mixing code from different programming languages in the same source file. These source files have the .mix file extension. Here is an example .mix file:
# The following line defines the language selection character (.mix files are UTF-8 encoded)... %%%⚛% ⚛⚛c⚛ /* make c the default language and select it */ #include <stdio.h> ⚛c++⚛ /* select the c++ language */ #include <iostream> ⚛ada⚛ with Ada.Text_IO; use Ada.Text_IO; ⚛⚛ /* select the default language (c in this example) */ void hello_from_c() {
printf("Hello, world (from C)!\n"); } ⚛ada⚛ procedure Hello is begin Put_Line("Hello, world (from Ada)!"); end Hello; ⚛⚛ int main() { hello_from_c(); ⚛c++⚛ std::cout << "Hello, world (from C++)!" << std::endl; ⚛ada⚛ Hello(); ⚛⚛ printf("Hello again from C!\n"); }