#datapack #syntax #programming-language #ir #aid #tags #ast

bin+lib dpscript

A transpiled programming language to aid in Datapack development

1 unstable release

0.2.0 Oct 10, 2024

#447 in Development tools

37 downloads per month

MIT license

460KB
12K SLoC

Contains (JAR file, 44KB) mod/gradle/wrapper/gradle-wrapper.jar

DPScript

DPScript is a transpiled programming language to aid in Datapack development, inspired by CBScript.

Features

  • Extremely comfortable syntax
  • A friendly and familiar syntax
  • An IR form to allow other syntaxes to grow on top of DPScript's framework
  • Advanced conditionals
  • Scoreboard & store manipulation
  • A batteries-included standard library (WIP)
  • Full array support
  • Support for loops
  • Compile-time constants
  • Easy text components and NBT manipulation
  • Functions & subroutines
  • Tags
  • Init & Tick blocks
  • Modules
  • Imports & Exports
  • A language server for auto-completion (Coming Soon!)
  • Support for your favorite IDEs (WIP)
  • A fully-fledged package registry and build system (Coming Soon!)
  • And much more!

DPScript features a fully custom tokenizer, lexer, validator, and AST to provide an extremely comfortable syntax while being very stable. By merging all imported files into a single AST it can provide the best error detection and validation possible. Don't worry anymore about strange issues when making datapacks!

TODO List

Core

  • Tokenizer
  • AST
  • Lexer
  • AST Validator
  • IR (DPIR)
  • Codegen
  • Build System

Language Features

  • Functions
  • Variables
  • Compile-time constants
  • Imports
  • Exports
  • If/else statements
  • Subroutines & goto
  • for entity in selector loops
  • for ... in ... loops
  • for ... in [0..3] loop unrolling

QoL

  • Syntax Highlighting
  • IR Syntax Highlighting
  • More CLI commands and options
  • Language server
  • Code formatter

Future Plans

  • Package Registry
  • Build system support for the package registry
  • IR-level optimizer

Dependencies

~20–32MB
~476K SLoC