Syntactical Analysis is responsible for checking the that the tokens follow a set of rules (the syntax rules). In some compilers, the syntactical analysis is responsible for converting the source code into the intermediate language. The sharp compiler reads the lexical boundary points (the tokens or LBPs) and creates a list of syntactical boundary points (SBPs). The SBPs indicates the type of language used. This includes declarative, statements, expressions, Preprocessor directives, Attributes, CodeBlocks. This helps the compiler learn what it needs to build in the intermediate language.

It takes the identifiers and stores each namespace, class, interface, struct, field, method, property in tree structure. Even the temporary types inside methods are recorded in this tree. This helps the compiler work out the context in which source code references types. Understanding contextual references are key to ensuring the compiler does not get confused with two references that have the same name.

Example of multiple references that have the same name:
class Node
{
    int TreeSize;
    Node()
    {
        Node Node = new Node();
        Node.Treesize = Treesize;
    }
}


Last edited May 17, 2013 at 1:01 PM by danieljsamson, version 5

Comments

No comments yet.