wiki:compiler/dideas

Version 5 (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.