Showing posts with label ometa. Show all posts
Showing posts with label ometa. Show all posts
Thursday, January 8, 2009
Dr. OMeta
On December 23rd, 2008, I filed my Ph.D. dissertation, "Experimenting with Programming Languages"!
Saturday, September 6, 2008
Modified V8 Shell w/ translateCode
This week Dan Ingalls came down to visit us at VPRI, and we got to chat about V8 for a little bit. We're both really excited about it. "It's like they just gave you a new horse", he said. :)
So tonight I was looking at the source code of the V8 shell, and it turned out to be pretty easy to modify it to support my translateCode idea. In case you don't know what I'm talking about, there really isn't much to it: translateCode is just a user-defined function that's called (implicitly) by the shell/workspace. It takes as an argument the code that the user typed in, and returns the code that should run in its place. It's extremely useful for playing with source-to-source translators. Here's a link to my modified shell.cc, if you're interested.
The following transcript shows this modified shell in action. ometa-rhino.js is just a file that loads the OMeta/JS implementation and defines translateCode just like I do in the browser, i.e., so that both OMeta and JavaScript are accepted.
So tonight I was looking at the source code of the V8 shell, and it turned out to be pretty easy to modify it to support my translateCode idea. In case you don't know what I'm talking about, there really isn't much to it: translateCode is just a user-defined function that's called (implicitly) by the shell/workspace. It takes as an argument the code that the user typed in, and returns the code that should run in its place. It's extremely useful for playing with source-to-source translators. Here's a link to my modified shell.cc, if you're interested.
The following transcript shows this modified shell in action. ometa-rhino.js is just a file that loads the OMeta/JS implementation and defines translateCode just like I do in the browser, i.e., so that both OMeta and JavaScript are accepted.
./v8 ometa-rhino.js --shellNow if only these guys at Google would hurry up and get Chrome to work on my Mac...
V8 version 0.3.0
> ometa M { ones = (1 -> 2)* }
[object Object]
> M.matchAll([1, 1, 1, 1], "ones")
[2, 2, 2, 2]
Subscribe to:
Posts (Atom)