.\" .\" UCSD p-System cross compiler .\" Copyright (C) 2006, 2007, 2012 Peter Miller .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 2 of the License, or (at .\" you option) any later version. .\" .\" This program is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU .\" General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License along .\" with this program. If not, see .\" .ad l .hy 0 Compilers and Factories, 1
Back Next

Parser Theory Revision

Tokenization: The process of partitioning the input text into tokens (the units of work for a grammar) and discarding white space and comments.
Grammar Productions:
expression
    : IDENTIFIER
    | expression PLUS expression
    | expression ASSIGN expression
    ;
A grammar is built up from many productions which describe the structure if the language. Parsing is the process of grouping tokens to match the specified productions of the grammar. These productions are usually similar to “BNF” notation. In yacc you can attach { C code in braces } to be executed when a production matches.
Abstract Syntax Tree: It is possible for a parser to build a series of dynamically allocated linked data structures which represent the input which has been parsed. Where these data structures correspond closely to the grammar, they are called abstract syntax trees.
.\" vim: set ts=8 sw=4 et :