Created
April 19, 2016 01:54
-
-
Save JeOam/fe78ab80482c6d411455db09d0e3dbd2 to your computer and use it in GitHub Desktop.
Compilers Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Formally, given a context-free grammar, a parse tree according to the grammar is a tree with the following properties:
- The root is labeled by the start symbol.
- Each leaf is labeled by a terminal or by €
- Each interior node is labeled by a nonterminal.
-
- If A is the nonterminal labeling some interior node and Xl , X2 , • • • , Xn are the labels of the children of that node from left to right, then there must be a production
A -> XIX2···Xn
. Here, XI,X2,... ,Xn each stand for a symbol that is either a terminal or a nonterminal. As a special case, ifA -> €
is a production, then a node labeled A may have a single child labeled €.
- If A is the nonterminal labeling some interior node and Xl , X2 , • • • , Xn are the labels of the children of that node from left to right, then there must be a production
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Definition of Grammars
A context-free grammar has four components: