This module contains global definitions. All of these definitions are exported to other modules.
The type alfa is used to represent the identifiers of the grammar. The length of these identifiers is determined by the constant alfaleng, which is also defined by this module, and is currently equal to 31. An empty identifier is represented by the constant empty alfa.
The type input line is used to represent input lines from the input file. The length is determined by the constant max buffer length, which is also defined by this module, and is currently equal to 125.
The type dtstring is only used to declare two global variables in this module (see section 3).
There are a number of options that influence the behaviour of the program. Most of the options determine the amount of information sent to the terminal and the listing. In the following subsections we will deal with each of the options, explain its name, where it is assigned, and where it is used.
The names of the options are equal to the global variables exported by this module.
This option determines whether questions are asked for the values of certain options, instead of taking their values. This option is set when the options are read from the input file. It is used by the procedure user request [main 10] which controls whether a question should be sent on the terminal or not.
These options determine whether and how the identifier tree is printed on the listing. The option with names determines whether the identifier tree should be printed or not. The option with all names controls whether all the predefined PASCAL keywords are also printed or not. These options are set when the options are read from the input file. The option with names is used in the finalization phase of the main program [main 8], to determine whether the procedure print binary tree [printtree 1] has to be called or not. The option with all names is used in the procedure print name tree [printtree 3.7], which is called by the procedure print binary tree.
This option determines whether trace information is displayed on the screen or not. It is set when the options are read from the input file, but has currently no effect at all, although it is given as an argument to the procedure transform [trans 1], called in the main program [main 4.3]
This option determines whether statistics are printed on the listing file or not. It is set when the options are read from the input file. It is used to decide whether the procedure print performance [perform 1] is called in the main program [main 8]
This option is set when the options are read from the input file, but is not used.
This option determines whether information about the dependency graph have to be added in the listing. It is assigned in the main program during the third pass [main 5,10.4]. It is used in the dependency generation module [depend] and in the dependency printing procedures [allsmp 2.1].
This option determines whether the input file is echoed on the terminal, and the scanning process is being displayed. It is assigned in the main program during the first pass [main 10.2], and is used by the procedure read line [scanner 5.3,7.2].
The global variables now and today are used in the listing module to print the creation time and date of the listing on the listing. See [listing].
In this section we give the listing of the definitions module. Nothing is hidden so this is also the list of all the things that are exported by this module.
[ENVIRONMENT ('definitions.pen')] MODULE definitions; (* This module contains a great number of definitions that are used in *) (* most of the other modules for the parser generator. *) CONST version = 'ATTRIBUTED PARSER GENERATOR Version-1'; alfaleng = 31; (* maximum length of identifiers *) empty_alfa = ''; max_buffer_length = 125; TYPE alfa = VARYING[alfaleng] OF char; dtstring = PACKED ARRAY [1..11] OF char; input_line = VARYING [max_buffer_length] OF char; VAR now, today : dtstring; (* the current time and current day *) (* the options *) ask , (* TRUE if questions should be asked *) with_names , with_all_names , (* TRUE if alphabetic list of names wanted *) with_tracing , (* TRUE if trace of the process is wanted *) with_statistics , (* TRUE if performance analysis wanted *) with_orthogonal , with_dep_info , with_scan_echo , with_gen_echo : boolean; END.
My life as a hacker | My home page