Blog Post RSS ?

Blogs » PHP » J4P5: Javascript For PHP5
 

J4P5: Javascript For PHP5

by Harry Fuecks

Need a distraction? Check out J4P5;

J4P5 is a JavaScript interpreter written in PHP 5, that allows to run untrusted scripts in a sandbox on your server. It aims to implement most of Ecma-262 3d edition.

I kid you not. In fact this looks like a pretty serious attempt. You’ll need to download and run yourself. There’s grammar rules for Javascript in there and a Javascript runtime written in PHP. It passes the “it works” test – the examples run straight out of $ unzip. Looking at what it does and the TODO list, aside from the Unicode issue strikes me J4P5 is already more than 50% of the way there.

Aside from novelty, one real world use might be an extension to SimpleTest’s web testing capabilities. With a little work there’s also potential to create an awesome Javascript source compressor – the lexing patterns are all there.

Need yet more distraction? Try metaphp from which J4P5 got it’s parser generator. Quite what metaphp was (is?) trying to achieve I’m not sure – seems to be attempting to build a higher level language on top of PHP with some ORM and functional programming in there for good measure (the FP stuff in the download is pretty interesting). Anyway – it produced a parser generator good enough implement a Javascript parser.

Anyone for R4P5? ;)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Ping.fm
  • Twitthis

Related posts:

  1. Google Releases its JavaScript Closure Tools Do we need more JavaScript libraries and tools? Perhaps not,...
  2. Cross-browser JSON Serialization in JavaScript JSON serialization can be incredibly useful, but few browsers support...
  3. Server-side JavaScript Will Be as Common as PHP Despite the fact that JavaScript has been typecast as the...
  4. Will Server-Side JavaScript ever catch on? Server-side JavaScript appears to be a logical choice for web...
  5. Implementing Event Latency in JavaScript Craig provides some useful JavaScript code to slow down event...

This post has 64 responses so far

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Follow SitePoint on...