-
Book Overview & Buying
-
Table Of Contents
LLVM Cookbook
By :
Parser analyzes a code syntactically according to the rules of the language's grammar. The parsing phase determines if the input code can be used to form a string of tokens according to the defined grammar. A parse tree is constructed in this phase. Parser defines functions to organize language into a data structure called AST. The parser defined in this recipe uses a recursive decent parser technique which is a top-down parser, and uses mutually recursive functions to build the AST.
We must have the custom-defined language, that is the TOY language in this case, and also a stream of tokens generated by the lexer.
Define some basic value holders in our TOY parser as shown in the following:
toy.cpp file as follows:$ vi toy.cpp
static int Current_token;
static...
Change the font size
Change margin width
Change background colour