Creating the project layout
The project layout for tinylang
follows the approach we laid out in Chapter 2, Touring the LLVM Source. The source code for each component is in a subdirectory of the lib
directory, while the header files are in a subdirectory of include/tinylang
. The subdirectory is named after the component. In Chapter 2, Touring the LLVM Source, we only created the Basic
component.
From the previous chapter, we know that we need to implement a lexer, a parser, an AST, and a semantic analyzer. Each is a component of its own, called Lexer
, Parser
, AST
, and Sema
. The directory layout that was used in the previous chapter looks like this:
The components have clearly defined dependencies. Here, Lexer
only depends on Basic
. Parser
depends on Basic
, Lexer
, AST
, and Sema
. Finally, Sema
only depends on Basic
and AST
. These well-defined dependencies help with reusing components.
Let...