Version 6 (modified by eamiri, 9 years ago) (diff)


This page has ideas that may be useful during re-design of the compiler.

1- For each variable we want to have a single object of class bitexpr.Var. All occurrences of this variable in the code should be pointers to this object. Hopefully this will reduce the time spent on copying code in the compiler using copy.deepcopy()

2- An independent component for common subexpression elimination is needed.

3- After the abstract tree is built, we need a checker pass that checks the syntax of the input.

4- We may use intermediate names for functions and variables in the compiler and keep a mapping from the intermediate name to original name. Then when we want to generate the final code, we use the map to generate final names similar to original names so that programmers can connect input and output of the compiler. This removes the complexity of name handling.

5- Keep the internal representation of the program in the compiler consistent with Python as long as possible. This allows us to use tools developed for Python.

6- We need a single component that has knowledge of boolean algebra and is called whenever needed. We many need to make it highly abstract so it can be used in different places of the compiler.

7- Bitutil functions may have different implementations in the output language (Example: Advance). Compiler should be configurable so that it generates output code that uses desired implementation.

8- Ideally, the output architecture should be given to the compiler as part of configuration and compiler should be able to generate code proper for that configuration. While this might be too complicated to implement, it is good to know the boundaries of architectureal changes that does not need a new Back End in the compiler.

9- Compiler should have three independent parts: Front End - Optimizer - Back End. The three should be completely independent so that they can be changed with no side effect on other parts. A suggestion is that each part has its own input and output language read from and written to a file. One should be able to rewrite one part of the compiler even in a new language.