[antlr-interest] Porting a runtime to Ada

Jim Idle jimi at temporal-wave.com
Tue May 22 07:51:31 PDT 2007



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Benjamin Niemann
> Sent: Tuesday, May 22, 2007 4:55 AM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Porting a runtime to Ada
> 
> Luke A. Guest wrote:
> 
> >> * You'll need a basic implementation of a character stream and base
> >> recognizer/lexer to get the example running. Just implement the
> methods
> >> that are actually needed to get the example running w/o errors.
> >
> > Yeah, I noticed that the Java implementation returns ints (32 bit),
> do
> > all the ports do this? It reads in UTF-8 and transforms it to 32 bit
> > characters? In Ada you have Character and Wide_Character.
> 

I suggest that you have your streams return UTF-32 characters, which you
should represent by the most sensible 32 bit type for the target
language. This means that your input streams can be anything, so long as
you can decode to UTF-32 and position to specific points in the stream
(it is best to use pointers for things like UTF-8, to avoid having to
traverse the actual string to get to character 'n'.

However, do you have an absolute requirement to use Ada95 in actions, or
just have callable lexers and parsers? You could just use the C target
and link with libraries.


Jim


More information about the antlr-interest mailing list