Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Ada95 ANTLR v3 Target

I currently have a very basic Ada95Target.java file which produces package bodies and specifications using the GNAT filename convention. In conjunction with this, I've taken the Java.stg file from codegen/templates/Java and started to modify this to produce a lexical analyser package.

Currently, a very basic scanner is produced with a tagged type in the specification. This won't compile as there is no runtime and I've not quite decided on how to implement the runtime as yet.

As I'm currently learning ANTLR and StringTemplate, this will probably take some time to achieve.

Runtime

  • Ada95 doesn't support mutually dependent packages, so this must be avoided at all costs.
  • Also, Ada95 doesn't have support for interfaces, so mix-in inheritance will be used where appropriate.

Ada 2005

I decided not to target Ada 2005 as there is only 1 compiler that support the new standard, and as it's so new, it doesn't do it very well (yet). Ada 2005 would've made the runtime easier to port, as it would be possible to provide an almost 1:1 correlation from Java to Ada.

What does Ada 2005 provide on top of Ada95?

  • Interfaces, a la Java. Yup multiple inheritance of interface types.
  • Mutually dependent packages, finally!
  • Dot notation for tagged types (that's classes in C++/Java speak), this makes it a bit less clumsy, so instead of typing:

ANTLR.Lexer.Match(Self, 'A');

we can write

Self.Match('A');

which is a bit nicer.

  • No labels