Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added rhino support

  • Loading branch information...
commit c54b9bc6c42533f0a41dde65692af967cc4c2edb 1 parent 8674624
@alexwarth authored
Showing with 26 additions and 0 deletions.
  1. +16 −0 ometa-rhino.js
  2. +10 −0 readme-rhino.txt
View
16 ometa-rhino.js
@@ -0,0 +1,16 @@
+load("lib.js")
+load("ometa-base.js")
+load("parser.js")
+load("bs-js-compiler.js")
+load("bs-ometa-compiler.js")
+load("bs-ometa-optimizer.js")
+load("bs-ometa-js-compiler.js")
+
+function translateCode(s) {
+ var translationError = function(m, i) { alert("Translation error - please tell Alex about this!"); throw fail },
+ tree = BSOMetaJSParser.matchAll(s, "topLevel", undefined, function(m, i) { throw fail.delegated({errorPos: i}) })
+ return BSOMetaJSTranslator.match(tree, "trans", undefined, translationError)
+}
+
+function ometa(s) { return eval(translateCode(s)) }
+
View
10 readme-rhino.txt
@@ -0,0 +1,10 @@
+To use OMeta under Rhino:
+
+Monad:~/prog/ometa-js awarth$ java org.mozilla.javascript.tools.shell.Main
+Rhino 1.7 release 1 2008 03 06
+js> load("ometa-rhino.js")
+js> ometa("ometa M { ones = 1* }")
+[object Object]
+js> M.matchAll([1, 1, 1, 1, 1], "ones")
+[1, 1, 1, 1, 1]
+
Please sign in to comment.
Something went wrong with that request. Please try again.