Exercise 5:

Grammar for Pascal type definitions
A Pascal program is structured in blocks. A block consists of several sections, one of which is the type declaration section. In this section, the user can define new types, ranging from just alias of already existing types, to complex data structures.

The set of tokens is {;, :, .., ,, ^, =, (, ), [, ], IDENT, NATURAL_LIT, REAL_LIT, CHAR_LIT, STRING_LIT, of, end, type, packed, array, set, file, record, case}. Most of the tokens are keywords or special symbols, except for the uppercase-named ones, whose associated regular languages are:

The type declaration section starts with the keyword type, followed by one or more type definitions. Each type definition consists of an identifier, the token “=”, a type denoter, and a semicolon.

Type denoters can be grouped in three categories:

Remarks about AST construction:
Authors: Nil Mamano / Documentation:
To be able to submit you need to either log in, register, or become a guest.