Skip to content

Instantly share code, notes, and snippets.

@kosamari
Last active March 6, 2017 15:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosamari/6c610165c0f48c699679bc5a8bab6327 to your computer and use it in GitHub Desktop.
Save kosamari/6c610165c0f48c699679bc5a8bab6327 to your computer and use it in GitHub Desktop.
final compiler object for sbn compiler
var sbn = {}
sbn.VERSION = '0.0.1'
sbn.lexer = lexer
sbn.parser = parser
sbn.transformer = transformer
sbn.generator = generator
sbn.compile = function (code) {
return this.generator(this.transformer(this.parser(this.lexer(code))))
}
// call sbn compiler
var code = 'Paper 0 Pen 100 Line 0 50 100 50'
var svg = sbn.compile(code)
document.body.innerHTML = svg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment