Skip to content

Vilsol/go-mlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d44242f · Mar 19, 2022

History

69 Commits
Mar 19, 2022
Mar 14, 2022
Aug 30, 2021
Jan 26, 2022
Jan 22, 2022
Mar 14, 2022
Jan 22, 2022
Jan 22, 2022
Mar 15, 2022
Mar 19, 2022
Mar 14, 2022
Apr 8, 2021
Aug 24, 2021
Mar 19, 2022
Dec 21, 2020
Mar 14, 2022
Dec 24, 2020
Mar 19, 2022
Dec 21, 2020
Dec 29, 2020
Mar 14, 2022
Mar 14, 2022
Jan 26, 2022

Repository files navigation

go-mlog

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

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
  • 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)

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 version

Flags:
      --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