A parser will take an input source file and produce a parse tree. The parse tree can then be used to do some context-sensitive analysis of the language, i.e. making sure that variables are declared before they are used, or that break statements occur within loops.
Usually this type of analysis is done by attaching attributes to each of the nodes in the parse tree, and calculating the values of these attributes using information from the lexer, and the structure of the tree.
You can compute some attributes in a bottom-up fashion. That is, the attribute at a particular node is computed using information from its children. Such attributes are said to be synthesized attributes. We can do a bottom-up walk through the tree using a depth-first search type traversal. You can compute some attributes in a top-down fashion. The attribute at a particular node inherits its value from its parent. These attributes are referred to as inherited attributes. We can do a top-down talk through the tree with a breadth-first search type traversal.
Sometimes things get more complicated then that. Sometimes things get much more complicated then that.
This site is dead. Check out my new web site A Funkaoshi Production.
A simple blog of sorts. Updated sporadically at best. Here you will find my opinions on various topics of interest to me, or the goings on of my day. Yes, it's quite exciting I know.
Next: This is Sippey.