AAda Compiler Parser Package

8
Feb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
with aada_compiler_token_package;
with aada_text_input_package;
with aada_compiler_error_package;
 
package aada_compiler_parser_package is
  -- trying to unget too many tokens
  parser_unget_buffer_full_error: exception;
 
  type compiler_parser_type is limited private;
  type unget_index is range 0 .. 3;
 
  procedure next_token(p: in out compiler_parser_type;
                       t: out aada_compiler_token_package.compiler_token_type);
  procedure unget_token(p: in out compiler_parser_type;
                        t: in aada_compiler_token_package.compiler_token_type);
 
  procedure error(p: in out compiler_parser_type;
                  code: in aada_compiler_error_package.errcode;
                  token: aada_compiler_token_package.compiler_token_type;
                  message: in string);
 
private
  type unget_array is array(unget_index'first + 1 .. unget_index'last)
                      of aada_compiler_token_package.compiler_token_type;
 
  type compiler_parser_type is
    record
      -- tokenized input file
      f: aada_compiler_token_package.compiler_token_input_type;
 
      -- compiler errors
      e: aada_compiler_error_package.aada_compiler_error;
 
      -- once in a while we need a look-ahead and then we want to unget a few tokens
      unget_count: unget_index;
      unget: unget_array;
    end record;
 
end aada_compiler_parser_package;
 
-- vim: ts=2 sw=2 et syntax=ada
Project aada v1.0-338 (Project id #3)
Process Done (Last compiled on 2012/01/13 01:21:26)
Description Alexis Ada Compiler written in Ada (my first attempt was in C++ which is not correct for an Ada compiler.)