170 likes | 335 Views
LL Compiler. Igor Dultsev Danil Tumaykin Winter School 2012 @ 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
E N D
LL Compiler Igor Dultsev DanilTumaykin Winter School 2012 @ 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 (defunsqr (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.
Type System Any Int Char String List 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.
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