jcc1 Compiler Framework

Design Overview

This section provides an overview of the directory structure under lib/, which contains the core compiler functionality:

ast/

AST node definitions

grammar/

Flex and Bison grammar files, and support classes

parsetree/

Parse tree node definitions and visitor pattern

passes/

Compiler pass definitions. The important ones are:

   transform/

All IR transformation passes

   CompilerPasses.cc

Front-end parsing and AST builder passes

   IRContextPass.cc

Pass to hold the IR context lifetime

   SemanticPasses.cc

Semantic analysis passes

semantic/

Semantic analysis passes, checks the semantics of JOOSC code.

   AstValidator.cc

Misc checks on AST (i.e., if condition must be bool, etc.)

   CFGBuilder.h

Builds the control flow graph (CFG) for dataflow analysis

   DataflowAnalysis.cc

Dataflow analysis

   ExprStaticChecker.h

Checks expressions for illegal static/non-static uses

   ExprResolver.cc

Huge file, resolves names in expressions + misc. checks

   ExprTypeResolver.cc

Context-free type checks on a single expression

   HierarchyChecker.cc

Builds + validates class inheritance hierarchy

   NameResolver.cc

Builds import + package resolution trees for each CU

   Semantic.cc

AST node builder + basic semantic checking

third-party/

Contains CLI11 command arguments parser and backtrace libraries

utils/

Support code, like exceptions and macros.

The joosc compiler as well as a jcc1 compiler are under tools/. jcc1 is used to test locally as it has more verbose error reporting and a rich command line feature set. joosc is only for submission.