Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Compiler from Rebol to JavaScript.
branch: master
Failed to load latest commit information.
README improved readme
primo.r added support for contexts/js-objects and block/js-arrays

README

What is RebToStatic
===================

Compiler for a subset of rebol to more static (FP-ish) languages, concretely 
this means JavaScript for now.

Example of current state:
=========================

This REBOL:
---
sum: func [ a1 b1 ] [ ret: add a1 join "something" b1 ]
a: mod 100 200
c: "bobo"
blk: func [ a ] [ add a 100 ]
---

compiles to:
---
var sum =  function(a1,b1){var ret = add(a1,join("something",b1));}; 
var a = mod(100,200);var c = "bobo";var blk =  function(a){add(a,100)};
---

And This:
---
person: context [
	name: "Jimy"
	sayHi: func [ a ] [ join "hi, " a ]
	tags: [ "jojo" 123 ]
	subobj: context [
		a: 10
		b: [ "jo" "no" [ 1 2 3 ] ]
	]
]
---

to this:
---
var person = {name:"Jimy",sayHi: function(a){join("hi, ",a)},tags:["jojo",123,],
subobj:{a:10,b:["jo","no",[1,2,3,],],},};
---

The code is very early in development. As you can see the generated JavaScript 
is not perfect. there are no returns for now and "," separators shouldn't be there
after the last element of array or object.


MIT License
===========

Copyright (c) 2010 Janko Metelko

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.