Saturday, March 6, 2010

Building a simple compiler Series (2)

Postfix Notation
A syntax-directed definition associates
  1. With each grammar symbol, a set of attributes and,
  2. With each production, a set of semantic rules for computing the values of the attributes associated with the symbols appearing in the production.
Parsing
Parsing is the process of determining how a string of terminals can be generated by a grammar.Most parsing methods fall into one of two classes, called the top-down and buttom-up methods. These terms refer to the order in which nodes in the parse tree are constructed.Top-down is easy to do by hand, but for software tools for generating parsers directly from grammars often use bottom-up methods, because this method can handle a larger class of grammars and translation schemes.
A Translator for simple Expressions
This simple translator is translating the infix expression to postfix expression. But the expression only includes "+","-" and single digit.


No comments:

Post a Comment