ceylon.ast initial release

89 views
Skip to first unread message

Lucas Werkmeister

unread,
Oct 16, 2014, 11:59:46 AM10/16/14
to ceylon...@googlegroups.com
Hello everyone!

I’m very proud and happy to announce the initial release of ceylon.ast, a collection of modules that can be used to create, modify, analyze, and generally operate on Ceylon Abstract Syntax Trees (ASTs). This was my Google Summer of Code 2014 project. (Central European Summer Time hasn’t ended yet, so it’s still summer… right?)

The following modules are available on the Herd for the JVM backend:

Except for ceylon.ast.redhat, they’re all backend-independent, but I forgot to add JS artifacts to my upload, so only the JVM versions are on the Herd. Sorry about that :/

For more details on ceylon.ast, see the module documentations, especially the ceylon.ast.core documentation.

The source code can be found on GitHub; you can also report issues there. (There are also lots of tests that you can check out for more usage samples.)

I look forward to seeing what you all will do with this :)

Best regards,

Lucas Werkmeister

Gavin King

unread,
Oct 16, 2014, 12:15:05 PM10/16/14
to ceylon...@googlegroups.com
Great!

This opens up some very interesting possibilities. For example, one of
the things that we've been discussing among the team is integrating
this with the compiler as a macro system for Ceylon, would would form
a useful foundation for stuff including:

- LINQ-like database queries
- typesafe interceptors and proxies
- other stuff we haven't thought of

Of course, any kind of macro system for Ceylon would be something of
quite limited capabilities, with rather modest goals, in order to not
conflict with other goals of the language like readability,
predictability, easy toolability, and explicit, understandable
semantics.
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-users...@googlegroups.com.
> To post to this group, send email to ceylon...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ceylon-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-users/b7dd948c-33f9-4fc3-9b6f-9ca2a10107e9%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org

Renato Athaydes

unread,
Oct 16, 2014, 5:45:02 PM10/16/14
to ceylon...@googlegroups.com
This is really cool!!

I was looking for something like this! I've played a bit with Groovy ASTTransformations and this is pretty awesome.
Things like @ToString and @Immutable, or @Bindable in Groovy are really useful, can you achieve something like that with your project??

I think these would not conflict with Ceylon philosophy... even Haskell has something like this...

I implemented this nearly-crazy project using ASTTransformation (write JVM instructions directly in your code! Why not?!): https://github.com/renatoathaydes/Grasmin

Will try your project later.

Renato

Lucas Werkmeister

unread,
Oct 17, 2014, 6:16:16 AM10/17/14
to ceylon...@googlegroups.com
I think @ToString and @Immutable are mostly covered by ceylon-spec#971… but implementing that using ceylon.ast and macros (ceylon-compiler#1865) is a great idea.


can you achieve something like that with your project??

In principle, yes, but note that AST transformations aren’t yet a part of compilation (see macros, above), so you’d have to rig it up yourself somehow: either by writing your own compiler tool that transforms the AST before passing it to typechecker + backend, or by parsing + transforming + formatting the code on disk and then compiling it with the normal compiler tool.

Renato Athaydes

unread,
Oct 17, 2014, 3:21:00 PM10/17/14
to ceylon...@googlegroups.com
Yep: http://groovy.codehaus.org/gapi/groovy/transform/EqualsAndHashCode.html

Just copy what Groovy did and you'll have it perfectly done :)

Renato

Renato Athaydes

unread,
Oct 17, 2014, 3:34:43 PM10/17/14
to ceylon...@googlegroups.com
I would like to try to write this https://github.com/ceylon/ceylon-herd/issues/172 with ceylon.ast.

Do you think that's a good use case for this? As FroMage commented, one difficulty might be to take into consideration polymorphism. With a full AST to play with, that would be a non-issue.... I think....

Renato

Renato Athaydes

unread,
Oct 17, 2014, 3:45:55 PM10/17/14
to ceylon...@googlegroups.com
Actually, I don't think ceylon.ast would help... we don't need to parse programs (AST), just types :) Got confused there....

Lucas Werkmeister

unread,
Oct 17, 2014, 5:40:58 PM10/17/14
to ceylon...@googlegroups.com
I don’t think ceylon.ast is the right tool for this. ceylon.ast is only concerned with the syntax, and for that feature you need a type model, i. e.:
  • match type names ("String") to fully qualified names ("ceylon.language::String")
  • resolve import aliases
  • determine type equality, which in general is a hard problem

I think it would be better to use the typechecker for this, which already has a type model and type equality.

Reply all
Reply to author
Forward
0 new messages