Crate phile [] [src]

This library provides the programmatic interface for the PHiLe Compiler and Domain-Specific Language. The crate is composed of several modules, each of which roughly corresponds to a single step in the compilation pipeline:

Depending on how you are willing to use PHiLe, you may be looking for…

Modules

ast

This module contains types for building Abstract Syntax Trees (ASTs). ASTs describe the syntactic structure of PHiLe programs. Defined here are various kinds of AST nodes that the parser module emits from a sequence of tokens produced by the lexer module. AST nodes, like tokens, contain source location data in order to easily map them to the original source code.

dalgen

DALGen, the backend of the PHiLe compiler. This is the part that generates actual code in your programming language of choice for a Database Abstraction Layer from optimized SQIR.

error

This module defines types for representing possible errors that may be generated during the compilation of some PHiLe source code. It also provides useful macros for reporting errors in a way that is consistent across modules.

lexer

This module contains type definitions and functions for breaking up unstructured source text into lexemes and tokens. It also provides types for mapping tokens to their original location within the source code in a human-readable manner.

parser

This module provides a function, parse(), for building an Abstract Syntax Tree out of a flat sequence of Tokens, itself generated by the lexer module. The module depends on the ast module for providing the emitted node types.

sqir

Defines SQIR, the Schema and Query Intermediate Representation. SQIR is the intermediate language of PHiLe, on which optimizations are performed. SQIR is also the starting point of code generation for database abstraction layers.

sqirgen

This module provides functionality to convert an Abstract Syntax Tree into PHiLe's intermediate language, SQIR (short for Schema and Query Intermediate Representation).

sqiropt

This module provides facilities for optimizing PHiLe programs in SQIR format.

util

The util module provides various useful helper functions, types and macros, used extensively throughout the PHiLe source tree. Generic reference-counted smart pointers, string manipulation specific to the syntax of PHiLe, and commonly-used constants are all part of this file.