Re: [abc-users] Documantation about extending new frontend

From: Julian Tibble <>
Date: Fri, 28 Mar 2008 01:02:47 +0000

Hi Thomas,

> is there already documentation about how to extend the new abc
> front-end available?

I'm afraid the short answer is no at the moment.

However, there is documentation on how to use JastAdd (which the new
frontend is built with) at

> During my prevoius work where I extended abc's polyglot I were glad
> reading
> Is there a similar paper for the new frontend jastadd?

There is an upcoming paper at this AOSD 2008 in a few days time about
the new frontend (it's not yet on, but will be soon).

Another good "tutorial" on the new fronted is to compare the original
implementation of the EAJ extensions, discussed in the AOSD 2005 paper,
with the new implementation.

(the new implementation can be found in abc-full/abc-ja-exts/src-eaj
 the interesting bits are in src-eaj/abc/ja/eaj/jrag)

> And what of my prevoius work (polyglot visits, nodes etc.) can I reuse
> when I want to port my compiler extension to the new
> frontend-extension abc.ja?

You can re-use the AbcExtension class (so any new keywords are added to
the lexer in the same way as they were before), and if you have a parser
this should be fairly easy to adapt.

The node-classes can't be re-used directly, but it's fairly easy to
translate what you had before to use with the JastAdd system.

For example, in EAJ there is a cast-pointcut. You can write
"cast(SomeType+)" as a pointcut and it will match all casts to the a
type matching the pattern "SomeType+"

The polyglot node for the cast pointcut looks something like:

  class PCCast extends Pointcut
      protected TypePattern pattern;

      ... lots of methods...

With the new JastAdd system, the same AST node is created (in eaj.ast)
with one line:

  CastPointcutExpr : Pointcut ::= Pattern;

This means, "define a node called CastPointcutExpr, which is a subtype
of Pointcut; each CastPointcutExpr has a child called 'Pattern' of type
(note that CastPointcutExpr would also have any children that a Pointcut
does, but in this case Pointcut doesn't have any children)

I hope this gets you started. Feel free to e-mail the list with any
further questions you have. I'll put that paper up on the website

Received on Fri Mar 28 2008 - 01:03:00 GMT

This archive was generated by hypermail 2.2.0 : Fri Mar 28 2008 - 15:10:11 GMT