All Projects → SuperTails → Langcraft

SuperTails / Langcraft

Licence: other
Compiler from LLVM IR to Minecraft datapacks.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Langcraft

Llvm
[MERGED UPSTREAM] AVR backend for the LLVM compiler library
Stars: ✭ 222 (-55.15%)
Mutual labels:  compiler, llvm
Soll
SOLL is a new compiler for generate Ewasm from solidity and yul. See a demo here: https://asciinema.org/a/ezJqNLicn5fya02zwu4VXIo8a
Stars: ✭ 329 (-33.54%)
Mutual labels:  compiler, llvm
Ts Llvm
TypeScript to LLVM compiler (abandoned)
Stars: ✭ 230 (-53.54%)
Mutual labels:  compiler, llvm
Llvm Guide Zh
User Guides For those new to the LLVM system.(LLVM系统的新用户指南,中文翻译版)
Stars: ✭ 180 (-63.64%)
Mutual labels:  compiler, llvm
Nlvm
LLVM-based compiler for the Nim language
Stars: ✭ 380 (-23.23%)
Mutual labels:  compiler, llvm
Lhc
The LLVM LHC Haskell Optimization System
Stars: ✭ 188 (-62.02%)
Mutual labels:  compiler, llvm
Speedy.js
Accelerate JavaScript Applications by Compiling to WebAssembly
Stars: ✭ 300 (-39.39%)
Mutual labels:  compiler, llvm
Jitfromscratch
Example project from my talks in the LLVM Social Berlin and C++ User Group
Stars: ✭ 158 (-68.08%)
Mutual labels:  compiler, llvm
Sericum
(Toy) Compiler Infrastructure influenced by LLVM written in Rust
Stars: ✭ 366 (-26.06%)
Mutual labels:  compiler, llvm
Bfc
An industrial-grade brainfuck compiler
Stars: ✭ 340 (-31.31%)
Mutual labels:  compiler, llvm
Command Block Assembly
Compile high-level code into Minecraft commands
Stars: ✭ 175 (-64.65%)
Mutual labels:  compiler, minecraft
Scala Native
Your favorite language gets closer to bare metal.
Stars: ✭ 4,053 (+718.79%)
Mutual labels:  compiler, llvm
Play with llvm
A book about LLVM & Clang(中文开源书:玩转 LLVM)
Stars: ✭ 175 (-64.65%)
Mutual labels:  compiler, llvm
Nxdk
The cross-platform, open-source SDK to develop for original Xbox: *new* xdk
Stars: ✭ 200 (-59.6%)
Mutual labels:  compiler, llvm
Compile To Web
Discover what languages can be compiled to Web Assembly
Stars: ✭ 164 (-66.87%)
Mutual labels:  compiler, llvm
Deepc
vendor independent deep learning library, compiler and inference framework microcomputers and micro-controllers
Stars: ✭ 260 (-47.47%)
Mutual labels:  compiler, llvm
Ispc
Intel SPMD Program Compiler
Stars: ✭ 1,924 (+288.69%)
Mutual labels:  compiler, llvm
Rhine
🔬 a C++ compiler middle-end, using an LLVM backend
Stars: ✭ 157 (-68.28%)
Mutual labels:  compiler, llvm
Staticscript
🎉🎉🎉 A new statically typed programming language, syntactically like TypeScript.
Stars: ✭ 337 (-31.92%)
Mutual labels:  compiler, llvm
Bytecoder
Rich Domain Model for JVM Bytecode and Framework to interpret and transpile it.
Stars: ✭ 401 (-18.99%)
Mutual labels:  compiler, llvm

Langcraft

The LLVM target for Minecraft you've never wanted

Langcraft is a code generator targeting Minecraft Data Packs. It can currently run a fairly substantial set of bitcode files without issue. The project has a built-in command interpreter for debugging that supports breakpoints (ish) and inspecting register/memory values. All generated datapacks can be run in a real Minecraft Java Edition 1.16+ world in under 5 minutes.

Usage

cargo run -- --arg1 --arg2 ./path/to/llvm/bitcode.bc

Valid arguments are:

  • --help: Display usage and available options
  • --out=path/to/dir/: Specify the directory the datapack files should be placed in (default is ./out)
  • --run: Run the command interpreter on the generated code
  • --trace-bbs: Insert a print command at the beginning of each LLVM basic block

To use the generated datapack in Minecraft:

  1. Copy the entire output folder (./out by default) to the datapacks/ directory of a Minecraft world (using a superflat void world is recommended)
  2. Run /function setup:setup. This only has to be done the first time a Langcraft datapack is used in a world.
  3. Run /function rust:run
  4. If the datapack is modified while the world is open, run /reload and then go back to step 3.

Rust code must be built as follows:

  • Release mode
  • panic=abort
  • #![no_std]
  • #![no_main]
  • Have a main function with #[no_mangle]
  • Use i686-unknown-linux

rust_interp is a Rust project already configured to generate the proper bitcode. The interpreter binary target as shown in the demo can be built with:

sh compile_rust.sh

And the file to use will be:

rust_interp/target/i686-unknown-linux-gnu/release/deps/interpreter-SOMEHEXSTRING.bc

Any other language capable of generating LLVM bitcode can be used, as long as it can be built for a bare-metal 32-bit target. For a clang example see compile_c.sh.

Note that the latest nightly versions of rustc now use LLVM 11, which Langcraft cannot parse (yet). You can set an earlier version to use for a directory with:

rustup override set nightly-2020-08-23

Demo

A video of a Langcraft-compiled interpreter can be seen here.

License

Licensed under either of

  • MIT License
  • Apache License, Version 2.0
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].