Skip to content

Arcscript Interpreters

This repository includes the supported interpreters for arcscript, the scripting language of Arcweave, for C++, C# and JavaScript.

The interpreters are built using ANTLR 4, a parser generator for reading, processing, executing, or translating structured text or binary files.

Why a parser generator?

In order to support updating game data from Arcweave that use arcscript during runtime in game engines, we had to find a way to interpret it without having to rebuild the game. This lead us to use a parser generator. ANTLR 4 is a great option for that, since it can create parsers for multiple languages, including C++ (which we use for unreal), C# (for Unity and Godot) and JavaScript (for our frontend).

Our implementation

In folder grammar you can find the files ArcscriptLexer.g4 and ArcscriptParser.g4, the Grammar files for the Lexer and the Parser respectively.

Build

Prerequisites:

  • curl
  • Java JRE to run the antlr4 tool
  • python3

In order to build all Parsers for C++, C# and JavaScript, run the generate.sh shell script.

bash
$ sh generate.sh

This script:

  1. Will download the antlr4.jar file to create the Parsers with
  2. Generate the parsers for each language

JavaScript

We are using the JavaScript parser to interpret arcscript in our arcweave app. We have also created a package, @arcweave/arcscript using the generated files in JavaScript, along with a custom ANTLR Visitor to parse the generated Parse Tree from ANTLR.

You can find more info in JavaScript folder.

C# & C++

The implementation on these two languages is not yet ready to be published.