Download - Simple Compiler - SCL
Simple Compiler - SCL
Notes on implementation details
High-level architecture
Operating system abstraction layerC++ STL Other external
SW (e.g. Boost)
Asserts
LogsIntrusive lists
Memory manager
Graph
Command line parser
Memory-Managed Containers
High-Level IR Backend IR Machine Description
ASTNFA & DFA
Frontend High-level optimizations Backend
Symbol Table
Translation phases
Representations
Data structures
Dynamic Memory Allocation
Utils
Low-level Utils
Memory Pools (Specialized/Default) Smart Pointers
Low Level Utils
• Assert macros– ASSERT(cond) just checks the condition while ASSERT_X(cond, where, what) prints out additional info on failure
– ASSERT/ASSERTD, ASSERT_X/ASSERT_XD for release/debug build
– Most of the time ASSERT_XD should be used• Usage of STL is allowed– Below and including UTILS level– For non-critical functionality above UTILS
• BOOST usage possibilty has not been studied yet
Utils
• Intrusive lists– Double-linked lists that built peer pointers into the object
via inheritance– An object can be involved in multiple lists
• Command line options parser– Supports boolean, integer, floating-point and string options– Supports long and short forms of options
• Logging support– Logging to file– Logs can form tree-like hierarchy
Intrusive ListsDoubly-liked lists. One object can participate in multiple list. The peer pointers are stored within the client object.
Intrusive lists are created by subclassing instance of SListIface ( or MListIface for multiple lists) template corresponding to user class.
Typical syntax example:
class MyClass: public SListIface<MyClass>{ …};
MyClass
User Data
SListItem
next
prev
MyClass
User Data
SListItem
next
prev
NULL