Skip to content

Commit

Permalink
docs(readme): add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hanks committed May 14, 2017
1 parent c3c970f commit 46907be
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
[![Build Status](https://travis-ci.org/hanks/another-super-tiny-compiler.svg?branch=master)](https://travis-ci.org/hanks/another-super-tiny-compiler) [![Coverage Status](https://coveralls.io/repos/github/hanks/another-super-tiny-compiler/badge.svg)](https://coveralls.io/github/hanks/another-super-tiny-compiler)

# another-super-tiny-compiler
Python version of the super tiny compiler project

Python version of [the super tiny compiler](https://github.com/thejameskyle/the-super-tiny-compiler) project.

# Why

Just for study, and I am interested in compiler implementation, so I follow this tiny project to
study the basic ideas to implement a small compiler:)

# Implementation

In this project, the object is to transform `Lisp-style` code to `C-style` code. And there are four phases implemented:

* tokenizer, similar to `lexer` to generate token from source code
* parser, conduct tokens to AST(abstract syntax tree)
* transformer, change AST v1 to AST v2
* code generator, output target code from AST v2

# Demo

```
> compiler("(add 2 (subtract 4 2))")
add(2, subtract(4, 2));
```

# Licence

MIT Licence

0 comments on commit 46907be

Please sign in to comment.