Skip to content

BasedUser/go-mlog

 
 

Repository files navigation

go-mlog

GitHub Workflow Status GitHub release (latest SemVer) codecov CodeFactor GitHub go.mod Go version Go Reference

Go to MLOG transpiler.

Web IDE

A Web IDE is available here

Examples

There are several example programs available on the wiki.

Supports

  • Functions
  • Multiple function parameters/arguments
  • Multiple function return values
  • return from functions
  • for loops
  • if/else if/else statements
  • switch statement
  • break/continue/fallthrough statements
  • Binary and Unary math
  • Function level variable scopes
  • Contextual errors
  • Tree-shaking unused functions
  • Multi-pass pre/post-processing
  • Stackless functions
  • Comment generation including source mapping
  • Sub-selector support
  • Type checking

In Progress

  • MLOG Runtime

Roadmap

  • Full variable block scoping
  • Nested sub-selector support

Planned Optimizations

  • Simple jump instructions

Design Limitations

  • Only hardcoded (translated) imports allowed
  • Single file support only
  • No recursion (more info here)

Endgame Roadmap

  • Transpilation optimizations
  • MLOG to Go decompiler

CLI Usage

Usage:
  go-mlog transpile [flags] <program>

Flags:
  -h, --help   help for transpile

Global Flags:
      --colors               Force log output with colors
      --comment-offset int   Comment offset from line start (default 60)
      --comments             Output comments
      --log string           The log level to output (default "info")
      --numbers              Output line numbers
      --output string        Output file. Outputs to stdout if unspecified
      --source               Output source code after comment
      --stacked string       Use a provided memory cell/bank as a stack

About

Go to Mindustry (MLOG) compiler and runtime

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%