guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some observation of current ECMAScript implementation


From: Kan-Ru Chen
Subject: Some observation of current ECMAScript implementation
Date: Wed, 05 Jan 2011 23:37:32 +0800
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Hello list,

I originally wanted to use guile to simultaneously load some small js
library (~2K LOC) and the main program wrote in scheme.  But I found the
current ECMAScript still not suitable to run real world js library
because of its lexer/parser cannot handle some pattern that often appear
in real programs, and its compiled function object is not semantically
conforming to ECMAScript Function Object, etc.

Although I cannot use guile for ECMAScript now, I want to share some
observation with you.  After read the ES3.1 spec, I found the most
difficult part of parsing ECMAScript that guile is lacking are:

  - Unicode identifiers         (7.6 Identifiers)
  - Regular expression literals (7.8.5 Regular Expression Literals)
  - Semicolon insertion         (7.9 Automatic Semicolon Insertion)

RegularExpressionLiteral and Semicolon insertion are very hard to do
right while they need the grammar context to help to decide how to lex
next token.

Example that didn't parse or emit correct tree-il:

  a()/b();           // regexp literals may not contain newlines in
                     // form "b();"

And there is no Function object, where the spec says every built-in
object/constructor are either Function or Object class.  In practice new
objects are created/inherited from object object or function object.

The question is how to pull in the Function object semantic and retain
the interoperability between ECMAScript and scheme procedure?  OK, I'm
reading GOOPS in order to understand the magics happened in (language
ecmascript function)

Thanks,
Kanru
--
I'm very new to guile, but I believe it has future.
Currently reading R⁵RS and guile manual.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]