Changes between Version 3 and Version 4 of compiler/newdesign


Ignore:
Timestamp:
Mar 15, 2010, 4:59:29 PM (9 years ago)
Author:
eamiri
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • compiler/newdesign

    v3 v4  
     1== Visitor Pattern ==
     2Usually compiler has a number of passes and each pass traverses the code line by line and each line of code has a specific type from among a few different types. The work that a pass does on each line of code depends on the type of the line. The simplest implementation for this is that each pass, checks the type of each line of code. The main drawback of this solution is that the compiler code cannot be extended easily by introducing new operations.
     3
     4The solution to this problem is visitor pattern. A good explanation of visitor pattern is available [http://www.butunclebob.com/ArticleS.UncleBob.IuseVisitor here]. To implement it a python ideas suggested [http://chris-lamb.co.uk/2006/12/08/visitor-pattern-in-python/ here] and [http://nice.sourceforge.net/visitor.html here] are useful. Also python AST module has a visitor method that might have similar functionality.
     5
     6
     7
     8
    19== Symbol Table ==
    2101- Must support line numbering and collapsing.[[BR]]
     
    917if line m is an if statement then m-0-i refers to line i in the true branch and m-1-i refers to line i in false branch[[BR]]
    1018Implementation of line numbers will use tuples. [[BR]]
     19