Ada How to Get Input Character by Character
I am New to Ada and I am attempting to convert the code in a compiler tutorial on Recursive Decent Parser to Ada. Porting the tutorial, "Let's Build a Compiler" by Jack W Crenshaw has been a favorite way for me to learn many languages. I had everything working up to Chapter three, using single character tokens. The move to multi-character tokens has been troublesome.

I have code something like this sudo code:

procedure GetName is
  token: Ada.Strings.Unbounded;
begin
  while IsAlNum(Look) loop
    Token := Token & Look;
    GetChar;
  end loop
end GetName;

Now I know Ada intended for strings to be static. But I need to be able to concatenate each new character taken from the input to the collection of characters in Token. Look is the global look-ahead value (the last character inputted). 

Thanks for you help. Also, are there any good Ada tutorials or recipes sites on the net? I've read Lovelace and Ada for C programmers. The Ada RMs are a bit formal and only show specifications not use...

Thanks again!


    
Ada How to Get Input Character by Character
===

I am New to Ada and I am attempting to convert the code in a compiler tutorial on Recursive Decent Parser to Ada. Porting the tutorial, "Let's Build a Compiler" by Jack W Crenshaw has been a favorite way for me to learn many languages. I had everything working up to Chapter three, using single character tokens. The move to multi-character tokens has been troublesome.

I have code something like this sudo code:

procedure GetName is
  token: Ada.Strings.Unbounded;
begin
  while IsAlNum(Look) loop
    Token := Token & Look;
    GetChar;
  end loop
end GetName;

Now I know Ada intended for strings to be static. But I need to be able to concatenate each new character taken from the input to the collection of characters in Token. Look is the global look-ahead value (the last character inputted). 

Thanks for you help. Also, are there any good Ada tutorials or recipes sites on the net? I've read Lovelace and Ada for C programmers. The Ada RMs are a bit formal and only show specifications not use...

Thanks again!


    