simple compiler - scl

5
Simple Compiler - SCL Notes on implementation details

Upload: alika-tillman

Post on 30-Dec-2015

31 views

Category:

Documents


4 download

DESCRIPTION

Simple Compiler - SCL. Notes on implementation details. High-level architecture. Frontend. High-level optimizations. Backend. Translation phases. NFA & DFA. AST. High-Level IR. Backend IR. Machine Description. Representations. Symbol Table. Memory-Managed Containers. Graph. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Simple Compiler - SCL

Simple Compiler - SCL

Notes on implementation details

Page 2: Simple Compiler - SCL

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

Page 3: Simple Compiler - SCL

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

Page 4: Simple Compiler - SCL

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

Page 5: Simple Compiler - SCL

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