Skip to content

Google Summer of Code 2014 submission state

Pre-release
Pre-release
Compare
Choose a tag to compare
@lucaswerkmeister lucaswerkmeister released this 27 Aug 19:17
· 642 commits to master since this release
gsoc-2014

This is the state of ceylon.ast as of 2014-08-18 19:00 UTC, the Google Summer of Code 2014 deadline.

The following syntactic elements of Ceylon have not yet been added:

  • interfaces
  • some types of named arguments
  • switch/case
  • try/catch/finally
  • comprehensions
  • dynamic blocks
  • element expressions (x[i], s[x..y])
  • different member operators: ., ?., *.
  • most decs (detyped metamodel literals)
  • interface and type aliases (class aliases might change too)
  • operator-style expressions

For all other syntactic elements of Ceylon, the following features are
available:

  • An immutable Ceylon class representing the syntactic element (node), feasible for creation using named arguments (a highly readable syntax)
  • Means to attach any amount of arbitrary information to any node, in a typesafe way (for example, a parser might attach tokens, a compiler may attach model information, etc.)
  • A mechanism to operate on and transform nodes (Transformer), including
    • a way to implement any operations on nodes (Visitor) (transformation into nothing)
    • a scaffolding to edit and change nodes (Editor) (transformation into a copy of the same type)
  • A transformation of nodes into their textual representation: a Ceylon expression that, when evaluated, yields an exact copy of the node (CeylonExpressionVisitor, Node.string)
  • Transformation of nodes to and from the RedHat compiler’s AST (RedHatTransformer)
  • Compilation of nodes from a code string, using the RedHat compiler’s parser and the aforementioned transformation

The core functionality resides in the ceylon.ast.core module, which is implemented in pure Ceylon and backend-independent. The RedHat AST conversion and compilation resides in the ceylon.ast.redhat module and naturally depends on the RedHat compiler; therefore, it is, like the RedHat compiler itself, only available for the Java backend.

The ceylon.ast.samples module contains sample ASTs for illustratory, educational or testing purposes. Currently, the only sample available is the ceylon.ast.samples.helloworld package, containing ASTs for a module descriptor, a package descriptor and a regular compilation unit which together form a complete "Hello, World!" program.