[Cardinal-devel] Cardinal Design Document - Overview

mark sparshatt msparshatt at yahoo.co.uk
Mon Aug 9 15:43:28 EDT 2004


This is the first of three design documents for the Cardinal project, 
summarising how I currently intend to implement the program.

The next two are about code generation and the class library

These notes are still rather sketchy and hand wavey, so if you want me 
to elaborate on any areas then let me know.

======================

h1. Overview

An overview of the cardinal system.

When Cardinal is run it reads the source code and creates a compiler
object referencing that code.

It then creates the correct backend object and passes the compiler
object to it.

When the backend is run it calls Compiler#parse to generate the AST
and then processes that AST.

The reason that the backend is responsible for parsing the sourcecode
is that it might decide that it can skip this stage.

e.g. Using the ParrotBackend, if there is already an up todate .imc
file then it won't create a new one.

Most backends use the TreeWalker class to examine the tree. It visits
each node in turn and calls a method in the backend with a name based
on the class of the node.

h2. Parsing

Cardinal uses the Ripper library to convert the ruby code into an
abstract syntax tree. 

====================================

--
Mark Sparshatt





More information about the Cardinal-devel mailing list