StoneCypher / fsl

Finite State Language specification
9 stars 1 forks source link

Code emission #418

Open StoneCypher opened 4 years ago

StoneCypher commented 4 years ago

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.

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

StoneCypher commented 4 years ago

It may be nice for the machines to be in at least some rudimentary sense interoperable, which probably just means taking transitions, actions, and providing end states as strings