A simple interpreter language written in Rust.

Overview

Glang

Backstory

Hello and welcome to the Glang git repository. Game Slang or in short Glang is a super simple interpreted language written in Rust with the soul purpose to make pong. After making a video about it, a lot of people requested an update so I made a new version, a little better this time.

Disclaimer

Glang was made as an experimental side project of mine and by no means was meant for serious use other than playing around. It is extremely unstable and limited.

Libraries I used

  • Unescape
  • Pixels
  • Device Query
  • Beryllium
  • Fermium
  • Zstring
  • Open

Installation/Use

Installing the syntax highlighting Visual Studio Code extension:

  1. Grab glang-extension.zip from the repository or from the itch.io page
  2. Extract the glang folder within the .zip file into your .vscode/extensions folder (located in C:/Users/USERNAME/.vscode/extensions on Windows)
  3. Open Visual Studio Code, the extension should appear in your installed category in the extensions tab and every file ending with .glg will be highlighted correctly.

Building from source:

Since Glang code base is written in Rust building it from source should be cross platform as long as you have cargo and cmake installed:

Note: In all operating systems you'll need the most recent version of both Rust/Rustup and CMake. I addition you'll also need the libx11-dev and libxv-dev packages on Linux.

  1. Open your OS's terminal and type in git clone https://github.com/BlidDev/Glang.git.
  2. After git finishes cloning the repository cd into the Glang folder.
  3. Type in cargo build --release (building for the first time will take a bit of time since Rust imports all the libraries)
  4. Rust will create a new folder called target and one called release. Inside release you'll find the glang executable, you can now use it as mentioned bellow.

Windows:

  1. Get glang.exe from building the project from source or from downloading and unzipping the itch.io release
  2. Run a script by typing in the terminal (in the same directory as the exe file) glang.exe path/to/script.glg

Linux:

  1. Get glang from building the project from source or from downloading and unzipping the itch.io release
  2. Run a script by typing in the terminal (in the same directory as the program file) ./glang path/to/script.glg

Example Code

An example with no graphics:

// This code will generate and print 10 random numbers from 0 to 99

print Hello\tWorld!\n
set i, 0 
set r, 0

#LOOP:
if i, <, 10, 3
    rng r, 0, 100
    out $r
    goto LOOP

print Finished!\n

An example of using graphics:

// This programs draws a blue diagonal line of pixels from (0,0) to (119,119)

init 848,480,212,120
set WHITE, 16777215
set BLUE, 255

set_clear $WHITE
clear

put 119, 119, $BLUE
set i, 0

#FIIL_LOOP:
    get color, $i, $i
    if color, ==, $BLUE,2
        goto GAME_LOOP

#GAME_LOOP:
handle_input
display
goto GAME_LOOP

Documentation

You can find basic documentation of Glang in the attached cheatsheet

Thanks for trying out Glang! :)

You might also like...
Ethereal - a general-purpose programming language that is designed to be fast and simple
Ethereal - a general-purpose programming language that is designed to be fast and simple

Ethereal is a general-purpose programming language that is designed to be fast and simple. Heavly inspired by Monkey and written in Rust

A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

My 'Lugli' language compiler for learning purposes, written in rust. 🥰🤠

Lugli language compiler My 'Lugli' language compiler for learning purposes, written in rust. This language is to be a subset for other purposes, for e

Tyrade: a pure functional language for type-level programming in Rust

A pure functional language for type-level programming in Rust

luau bindings for the Rust programming language

🌔 luau-rs Luau bindings for the Rust programming language using bindgen ⚠️ Disclaimer This does not provide bindings for everything as luau does not

Czech for the Rust programming language
Czech for the Rust programming language

rez Nejsi you tired from writing Rust programs in English? Do you like saying do prdele or pivo a lot? Would you like to try something different, in a

The official home of the Nyson Programming Language, built off Rust.
The official home of the Nyson Programming Language, built off Rust.

Nyson Programming Language The official home of the Nyson Programming Language, built off Rust. (created by Nyelsonon and AMTitan, 2021) Advertisement

A shell scripting language

Slash The system level language for getting the job done. Detailed documentation is available on the Slash site Motivation Bash is an awesome shell, b

An interactive scripting language where you can read and modify code comments as if they were regular strings
An interactive scripting language where you can read and modify code comments as if they were regular strings

An interactive scripting language where you can read and modify code comments as if they were regular strings. Add and view text-based visualizations and debugging information inside your source code file.

Comments
Owner
null
An interpreter for the esoteric programming language, Brainf*ck.

Brainf*ck Interpreter This is just a normal Brainf*ck interpreter written in Rust. If you don't know what Brainf*ck is, you can check out the wikipedi

Callum Irving 0 Dec 23, 2021
RustPython - A Python Interpreter written in Rust

RustPython A Python-3 (CPython >= 3.9.0) Interpreter written in Rust ?? ?? ?? . Usage Check out our online demo running on WebAssembly. RustPython req

null 13.3k Jan 2, 2023
Rust bindings for the Python interpreter

PyO3 Rust bindings for Python. This includes running and interacting with Python code from a Rust binary, as well as writing native Python modules. Us

PyO3 7.2k Jan 4, 2023
Pyo3 - Rust bindings for the Python interpreter

PyO3 Rust bindings for Python, including tools for creating native Python extension modules. Running and interacting with Python code from a Rust bina

PyO3 7.2k Jan 2, 2023
Rust bindings for the Wasm spec interpreter.

wasm-spec-interpreter This project shows how to use ocaml-interop to call into the Wasm spec interpreter. There are several steps to making this work:

Bytecode Alliance 9 Aug 23, 2022
A memory safe Lua interpreter

Hematita Da Lua Hematita Da Lua is an interpreter for the scripting language Lua, written entirely in 100% safe Rust. Hematita is the portugese word f

Daniel 149 Dec 29, 2022
WebAssembly (Wasm) interpreter.

Continuous Integration Test Coverage Documentation Crates.io wasmi- WebAssembly (Wasm) Interpreter wasmi was conceived as a component of parity-ethere

Parity Technologies 1k Jan 4, 2023
Lisp interpreter that might be fast someday maybe?

ehlisp Pronunciation I'm not really sure. Maybe like an incorrect pronunciation of "ellipse", like "ellisp"? Also maybe like "a lisp". I named it this

Eddie Hatfield 3 Oct 6, 2022
A simple programming language made for scripting inspired on rust and javascript.

FnXY Programming Language Quick move: CONTRIBUTING | LICENSE What? FnXY is a simple programming language made for scripting inspired on rust and javas

null 2 Nov 27, 2021
Program analysis playground for a simple, imperative language

Proggers Proggers is a program analysis playground for a simple, imperative language. Features Numerical analysis using abstract interpretation Type-c

Niels Saurer 32 Nov 24, 2022