القليل اللثغة مترجم ( リトル LISP コンパイラ ) دانيال تو مايو كين ( ダニエル · 火月の親 族 ) يوهان حزقيل (a 洋平ハスケル )
LL Compiler Igor Dultsev Danil Tumaykin Winter School NSU-Intel Lab
Project Specification How we saw our project at the beginning: Source Language: LL(Lisp Dialect – Little Lisp) Target: C, maybe our VM Code Project Language: C# VCS: git/github.com License: CC Deadline: 2012/02/04 Key features: standard types, list, string, λ-functions Standard library Interface: – Console, GUI Unit Tests
Architecture & Design Four phases – four classes: Lexic analyzer – Lexer Syntax analyzer - Parser Semantic analyzer Code generator
Lexer Performs lexical analysis of LL language source code. Input: String containing LL source. Output: Collection of IToken ’s.
Lexer use sample (defun sqr (x) (* x x))
Parser Parses a collection of IToken ’s into a collection of IParsedValue ’s. Input: Collection of IToken ’s.. Output: Collection of IParsedValue.
Parser Use Sample (defun f (x y) (+ (* x y) 7))
Semantic analyzer Adds semantic information to the parse tree and builds the symbol table & computes types information. Input: Collection of IParsedValue. Output: List of Function ’s.
Semantic analyzer use sample
Type System Any IntCharStringList Nothing
Code generator Generates code from a Function’s. CG also generates code snippets for standart functions. Input: List of Function ’s. Output: List of GeneratedCFunction ’s, string or file.
Code generation sample
GUI
Features we didn’t implemented (yet) Our VM Bytecode Generator λ-functions Standard Library Good IDE :o
Why did we do it at all? Projects reasons-to exists Future – Intel-NSU Laboratory compiler project
Thank you! Q&A Section begins here