Skip to content

Code emission #418

@StoneCypher

Description

@StoneCypher

This is one of the really big deals. This is also one of the things that makes peg so powerful, and what almost got me to leave it for canopy and antlr to get semiportability.

Basically, this is a proper compiler, rather than an inline compiler, whose product is source code rather than a live object. This leaves a whole lot of questions open around hooks #255 and guards #412; still, this is progressively becoming more and more clear as the right next step, rather than another VM for target languages.

Properly, this should compile some intermediary, which in turn gets compiled down by a language driver. C, SQL, JS, and Erlang should be sufficiently different to make that doable.

This is different than Transcompile to other existing state machines #563 because this produces code for a single machine in another language, rather than a datastructure for a generic machine.

  • Emit JSSM compiled
  • Emit DOT Create to-dot button #170
  • Emit SVG Create to-svg button #169
  • Emit JS
  • Emit C
    • Should there be a specialized C++?
  • 🔥 Emit UML state chart
  • 😮 Emit Amazon States Language Amazon States Language #496
  • Emit Python
  • Emit Ruby
  • Emit Java
  • Emit Erlang
  • Emit some awful .NET thing
  • Emit some awful AWS thing
  • Emit a fully conceived Github Action machine
  • Emit PHP
  • Emit SQL
    • Emit MySQL
    • Emit PostgreSQL
    • Emit Oracle PL/I
    • Emit mssql
    • Emit sqlite
  • Emit Swift
  • Emit Go
  • Emit shells
    • Emit bash
    • Emit batch
    • Emit powershell
    • Emit dockerfile
  • Emit rust
  • Emit C#
  • Emit some kind of Unity nonsense
  • Emit some kind of Unreal3d nonsense
  • Emit Haskell, to keep the hipsters happy
  • Emit Harel state chart

Who knows? Even Fortran and COBOL would make the case for a legacy path out

Might be smart to target existing state machine libraries...

Lol can you imagine if this emitted assemblies or Verilog or VHDL or whatever