Skip to content

OMeta JS 2.0 #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
josher19 opened this issue Jan 1, 2010 · 3 comments
Closed

OMeta JS 2.0 #25

josher19 opened this issue Jan 1, 2010 · 3 comments
Labels

Comments

@josher19
Copy link
Contributor

josher19 commented Jan 1, 2010

#1)
Started a JavaScript version of the compiler using OMeta JS 2.0:
http://www.tinlizzie.org/ometa-js/#Coffee

Currently sub-classing the Javascript Compiler, so it can execute CoffeeScript aliases or JavaScript, but may need to redo it as a complete compiler in order to do CoffeeScript Statements.
Not sure how much time I'll have to work on this, so anyone else is welcome to to take it over.

#2)
Suggest that Objects should be either CoffeeScript format OR standard JSON format to make it easier to read JSON directly without parsing to CoffeeScript or visa versa.

With the newlines it looks good, but I think
ages: {max: 10, ida: 9, tim: 11 }
is slightly more legible than
ages: { max: 10 ida: 9 tim: 11 }

#3)
In your Docs [ http://jashkenas.github.com/coffee-script/#array_comprehensions ]
Suggest you change the example from:

Eat lunch.

lunch: food.eat() for food in ['toast', 'cheese', 'wine'].

to something like:

Eat lunch.

lunch: eat(food) for food in ['toast', 'cheese', 'wine'].
eat: edible => log("yum: " + edible).
log: msg => if (window && window.console) console.log(msg) else alert(msg).

This works better than having to define eat in String.prototype.eat
Otherwise you end up eating Strings instead of Food! ;-)

@jashkenas
Copy link
Owner

  1. Awesome! It's not often you can ask for something on a wishlist and have it come true.
    1. Leaving out the commas in array and object literals is only allowed in the newline form. I quite agree with you -- it doesn't make any sense in single-line objects. Note that you're allowed to mix and match:

      matrix: [
      0, 1, 1
      1, 1, 0
      1, 0, 1
      ]

  2. I've changed the example -- it'll go out with the next release. Thanks for the doc fix.

@jashkenas
Copy link
Owner

This ticket has been superseded by the "CoffeeScript in CoffeeScript" one, which may or may not use OMeta for the parser.

http://github.com/jashkenas/coffee-script/issues#issue/8

Closing...

@veged
Copy link

veged commented Jan 11, 2010

you can use ometajs narwhal's module http://github.com/veged/ometa-js/tree/narwhal/

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants