0.1.7 • Published 11 years ago

jex v0.1.7

Weekly downloads
26
License
-
Repository
github
Last release
11 years ago

jex

Jex is a compiler that compiles scheme like language to javascript code.

usage example (in coffee script)

Jex = require 'jex'

console.log Jex.compile """
  (block
    (def f (func (x) (if (gt x 1000) "big number" "small number")))
    (f 50)
  )
"""

Jex.compile will return an object that contains the compiled code as string and array of variables the code uses, but not defines itself.

{ 
  code: '((f = (function(x) { return (gt(x, 1000))?("big number"):("small number"); })), f(50))',
  refs: [ 'gt' ] 
}

If you want a callable javascript function instead of a code text, call Jex.compileToFunction. It will return a javascript function object extended with field argNames which contains the refs (see Jex.compile above).

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago