#compiler #bytecode #script #compile #source #gs2 #graal

gs2compiler

Compile GS2 source code to bytecode

1 unstable release

0.1.0 Aug 14, 2024

#782 in WebAssembly

Custom license

4.5MB
106K SLoC

C 63K SLoC // 0.2% comments C++ 25K SLoC // 0.1% comments Python 3.5K SLoC // 0.2% comments M4 3K SLoC // 0.6% comments Lex 2.5K SLoC // 0.2% comments Happy 2.5K SLoC Bazel 2.5K SLoC // 0.1% comments XSL 1.5K SLoC // 0.1% comments D 856 SLoC // 0.3% comments Java 775 SLoC // 0.3% comments Shell 344 SLoC // 0.2% comments PowerShell 235 SLoC // 0.1% comments Rust 115 SLoC // 0.3% comments Batch 81 SLoC // 0.1% comments C# 50 SLoC Visual Studio Solution 16 SLoC CUDA 13 SLoC // 0.4% comments JavaScript 6 SLoC // 0.5% comments Bitbake 4 SLoC

Contains (WOFF font, 24KB) glyphicons-halflings-regular.woff

gs2-parser

This is a compiler for the Graal Script 2 (GS2) language.

Prerequisites

Before building, clone the repository and recursively clone the submodules:

git clone git@github.com:xtjoeytx/gs2-parser.git --recursive

Building

You can build the project using CMake:

mkdir build
cd build
cmake ..
make -j $(nproc)

Building (Wasm)

First, ensure you have Emscripten installed. Then, you can build the project using CMake:

mkdir build
cd build
emcmake cmake ..
make -j $(nproc)

The resulting gs2test.js file can be imported into a webpage.

Running

The non-wasm build can be run using the following command:

$ ./gs2test ../scripts/asd2.txt
Argc: 2
Args: ../scripts/asd2.txt
Compiling file ../scripts/asd2.txt
Compiled in 0.001322 seconds
 -> saved to ../scripts/asd2.gs2bc
Total length of bytecode w/ headers:   160

Dependencies