Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vilsol/go-mlog
Go to Mindustry (MLOG) compiler, runtime and decompiler (WIP)
https://github.com/vilsol/go-mlog
compiler go golang mindustry mindustry-logic mlog transpiler
Last synced: 4 days ago
JSON representation
Go to Mindustry (MLOG) compiler, runtime and decompiler (WIP)
- Host: GitHub
- URL: https://github.com/vilsol/go-mlog
- Owner: Vilsol
- License: gpl-3.0
- Created: 2020-12-21T22:03:07.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T02:38:11.000Z (over 1 year ago)
- Last Synced: 2024-06-20T15:00:18.930Z (5 months ago)
- Topics: compiler, go, golang, mindustry, mindustry-logic, mlog, transpiler
- Language: Go
- Homepage: https://vilsol.github.io/go-mlog-web/
- Size: 14.9 MB
- Stars: 24
- Watchers: 2
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Funding: FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
![](./.github/logo.png)
# go-mlog
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/vilsol/go-mlog/build)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/vilsol/go-mlog)
[![codecov](https://codecov.io/gh/Vilsol/go-mlog/branch/master/graph/badge.svg?token=LFNKYWS0N2)](https://codecov.io/gh/Vilsol/go-mlog)
[![CodeFactor](https://www.codefactor.io/repository/github/vilsol/go-mlog/badge)](https://www.codefactor.io/repository/github/vilsol/go-mlog)
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/vilsol/go-mlog)
[![Go Reference](https://pkg.go.dev/badge/github.com/Vilsol/go-mlog.svg)](https://pkg.go.dev/github.com/Vilsol/go-mlog)## Web IDE
A Web IDE is available [here](https://vilsol.github.io/go-mlog-web/?1)
## Examples
There are several example programs available on [the wiki](https://github.com/Vilsol/go-mlog/wiki/Examples).
## 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
* Statement labeling
* `goto` 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
* Full variable block scoping## In Progress
* MLOG Runtime
* MLOG to Go decompiler## Roadmap
* Nested sub-selector support
* Merged compiler and decompiler registries
* Constant string and number slices## Planned Optimizations
* Simple jump instructions
* Recursive constant propagation
* Write directly to function return variable
* Write directly to function parameters before jump
* Single-reference function inlining## Design Limitations
* Only hardcoded (translated) imports allowed
* Single file support only
* No recursion ([more info here](RECURSION.md))## Endgame Roadmap
* Transpilation optimizations
* Support tail-recursion## CLI Usage
```
Usage:
go-mlog [command]Available Commands:
completion generate the autocompletion script for the specified shell
decompile Decompile MLOG to Go
execute Execute MLOG
help Help about any command
transpile Transpile Go to MLOG
trex Transpile Go to MLOG and execute it
typings Output typings as JSON
version Print current go-mlog versionFlags:
--colors Force log output with colors
--comment-offset int Comment offset from line start (default 60)
--comments Output comments
-h, --help help for go-mlog
--log string The log level to output (default "info")
--metrics Output source metrics after execution
--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
```