Hi - thanks for the interest
That sounds like it would be fun if you got it working. So, I haven't documented the compiler at all - it's complicated, and documenting it would double the amount of work I'd have to do. Even giving a rough outline would take a bunch of explaining, and leave even more questions. It might end up being easier to reimplement everything from scratch :/
But OK, let me try -
look at loadFile() in compiler.js
The syntax highlighter is super smart and builds up a lot of information into a state - so the highlighter code is reused for the first part of compilation ( all in the token method in parser.js ) - this is what the processor stuff is about
The state that this builds up is passed to the compiler (compiler.js)
then there are...16 stages of processing that simplify the rule data in various ways - replacing complicated rules with simpler rules, removing duplicate rules, generating *lots* of bitmasks, until it outputs the compiled code ('state') - if you use the debug prelude command you can see what the compiled rules look like ( search for ‘debug’ here - http://www.puzzlescript.net/documentation/prelude.html )
-
the interpreter is mostly in https://github.com/increpare/PuzzleScript/blob/master/js/engine.js IIRC. Most of the structure of this is described in the documentation - http://www.puzzlescript.net/documentation/executionorder.html, with some extra stuff here - http://www.puzzlescript.net/documentation/rigidbodies.html (this makes the engine complicated). All of the game code deals with bitmasks, which makes the code performant, but difficult to read sometimes.
(oh, you should definitely read the source code on github - https://github.com/increpare/PuzzleScript - rather than the compressed source code on puzzlescript.net - if you search the puzzlescript google group you might find some compilation instructions, but you don't need to compile it for it to work (mostly) )
--
You received this message because you are subscribed to the Google Groups "PuzzleScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.