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
#![feature(box_syntax)]
#![feature(uniform_paths)]
#![warn(
    clippy::print_stdout,
    clippy::unimplemented,
    clippy::doc_markdown,
    clippy::items_after_statements,
    clippy::match_same_arms,
    clippy::similar_names,
    clippy::use_self
)]

//! This module implements type checking on the AST. The type checking
//! produces an instance of `type_system::TypeSystem`, which is later used by
//! the `firm` module for IR graph construction.
//!
//! ## `$` Types (`builtin_types`)
//!
//! `MiniJava` suffers from the fact that its specification was stripped down
//! from the Java language report.  A good example is the handling of the main
//! method's arguments: `String[] args` must not be used, and according to the
//! spec, `String[]` within the main method's parameter list is not a type.
//! However, it is possible for users to define a `class String` in `MiniJava`,
//! which ,in Java, would shadow the `java.lang.String` that is part of the
//! main method's parameter type. Not so in `MiniJava` - at least that's the
//! result of the discussion we had in the lecture.
//!
//! To accomodate this and other spec quirks, we define built-in types using
//! `$String` or similar: Since a class definition beginning with `$` is
//! rejected by the lexer, we can safely introduce such definitions during type
//! analysis for the built-in types.

pub mod builtin_types;
pub mod checker;
pub mod method_body_type_checker;
pub mod semantics;
pub mod type_analysis;
pub mod type_system;

pub use self::checker::check;