On 1/2/07, Phlip <phlip2005 / gmail.com> wrote:
> spooq wrote:
>
> I might go with Javascript-Pure-Perl - see below. The following is just
> wrap-ups.
>
> > http://lxr.mozilla.org/mozilla/source/js/src/js.c
>
> > Have a look around line 2315.
>
> Interesting, but I don't get It. The IT object ... exists at debug
> time, and traces all its calls?

It just makes a pre-defined object that you can poke at when you run
scripts in that interpreter. The implication was that you could
recreate the Ajax.* methods and use them to log.

> > Not sure exactly how you want to improve on lex?
>
> Regexp is itself also a "little language". However, to get to the
> language, we don't need to write a .regex file, compile it with special
> compilers, produce a .c file, compile this, link into it, bind to it,
> yack yack yack, and so on just to use it.

Lex generates C and lives by the rules of that coding universe. Doing
stuff at run-time can be difficult and wierd there. Much easier to
transform to a familiar language and compile and link with exactly the
same tools you use for the rest of your project. Yack (yacc) is an
entirely different project ;)

> So, I envision Ruby lines like Lex.new.e(' LetterE -> E | e'). Instead
> of externally compiling the little language, we just host it.

Which would be living by the rules and expectations of the Ruby
universe. Not that theres anything wrong with that; I happen to quite
like living there myself. It's just useful to remember there's more
than one way of doing things.

> That is not important for the current project...

Agreed.

> > > Can I add a parser to the Syntax library? It only does Ruby, XML, and
> > > YAML so far...
> >
> > I don't see how that's better than grabbing the Javascript grammar off
> > the web in BNF :
>
> In theory, I only need a dirt-simple way to spot-check the source; I'm
> not writing a JavaScript interpreter. But it could be better if it
> doesn't force me to externally compile the lexer.
>
> > http://corion.net/perl-dev/Javascript-PurePerl.html does javascript to
> > xml
>
> Righteous! The project already uses XML (and unit tests with
> assert_xpath), so that will fit right in!

Not sure what assert_path is, guess it's a function from some kind of
test harness.

> Thanks! I honestly would never have thought to try Perl...

It's not exactly my first choice either, but any port will do in a
storm. At least you found one acceptable suggestion in my ramblings :)