alexwarth/ometa-js

Support for exponent form of number literal

veged opened this issue · 2 comments

Here is my patch (but I think you can write better ;-)):

   number       = ``0x'' hexLit:n                                                     -> [#number, n]
+               | <digit+ (('e' | 'E') ('-' | '+')? digit+)?>:f                       -> [#number, parseFloat(f)]
                | <digit+ ('.' digit+)?>:f                                            -> [#number, parseFloat(f)],

My "Javascript" parser was never supposed to support all of Javascript -- rather, it was meant to be a useful subset of the language that could be parsed with relatively little effort. I think there is value in that, and for that reason I am not planning on adding more features to my parser.

But I understand that it would be really useful for the semantic actions in OMeta/JS and also the OMeta/JS workspace to support all of Javascript. One of the items on my to-do list is to use the full ECMAScript 5 parser that was developed by Tom van Cutsem and Mark Miller at Google (see http://code.google.com/p/es-lab/) as the JS parser in the OMeta/JS implementation. This won't take much doing, but I've got quite a few other things going on right now, so I probably won't get around to doing it until the end of the month. Please remind me if I haven't done it by then :)

Cheers,
Alex

wow, it's only now clear for me that Ometa/JS js-parser "never supposed to support all of Javascript" ;-) ok

I hurt that I only just learned of the existence of another JavaScript parser in Ometa/JS. Some time ago I start writing my own https://github.com/veged/krasota.js/blob/master/src/parser.ometajs -- but it's for ES3 and, most importantly, it preserve all input semantics, including comments and whitespaces.

Now that you have to have plans to make such big changes, it may be possible to take the work out of my fork -- https://github.com/veged/ometa-js ? I just might try to replace used parser to es5parser.ojs. What you think?