Skip to content
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

choose your own syntax rules #888

Closed
thurt opened this issue May 13, 2016 · 7 comments
Closed

choose your own syntax rules #888

thurt opened this issue May 13, 2016 · 7 comments

Comments

@thurt
Copy link

thurt commented May 13, 2016

I would like to slowly transition into livescript by selectively "turning on" certain rules. Could this be possible with livescript or some other tool? How might I get started down this path? Thanks!

@vendethiel
Copy link
Contributor

That's far, far, far too complex. Just look at the lexer's complexity. It's insane.

@robotlolita
Copy link
Contributor

Instead of "turning on certain rules" you could have a layered language (like Racket and Oz). But that would require LiveScript to be completely redesigned, from scratch.

A middleground would be implementing layers as macros (see Racket again, but also Dylan), but again, LiveScript's syntax is far too complicated for macros to work well.

In either case, you're way better off just designing your own minimal language and building optional features on top of that by using macros or something, really. It's going to be a ton less work.

@vendethiel
Copy link
Contributor

And sweetjs is not nearly ready to use whitespace-sensitive readtables...

@rightfold
Copy link

rightfold commented May 13, 2016

You can pass string literals to the LiveScript compiler, then call Function(result)() where result is the code generated by the LiveScript compiler.

Or put your LiveScript and ECMAScript code in different files.

@thurt
Copy link
Author

thurt commented May 13, 2016

@vendethiel @robotlolita @rightfold thanks for the ideas
No parentheses for function calls was my primary interest. Also I wasn't aware that these kinds of lexers are so rigid.

@JoyKrishnaMondal
Copy link

just curious as to why livescript doesn't have macros - wouldn't it make it easier for people like @thurt to write their own extensions as they please ?

@robotlolita
Copy link
Contributor

We've discussed this at least a few times before (see #328), but no one has seriously worked on it afaik. Adding macros to the existing LiveScript compiler would be kind of impossible, writing a new compiler for it from scratch, that includes macros, is a lot of work given LiveScript's super flexible syntax, and the fact that LiveScript doesn't have a formal grammar or semantics (there's a lot of semantic work being done in the lexer :'D) makes it even harder, at least if you're looking to make it have the same semantics as existing LS :)

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

No branches or pull requests

5 participants