ALBS Suhani Singhal - ss4925 Brennan Wallace - bgw2119
Steep learning curve LLVM OCaml = + 2000+ LOC 88 test cases MicroC++ 100+ commits +Arrays +Structs +Printing +Casting
Features ● Arrays ● Multiline Comments ● Procedural ● Structs ● Implicit casting ● Functions ● Operators ● I/O functions ● Data Types ○ Binary ○ Mutable ○ Unary ○ Static typing ○ Primitives ■ Integers { : int} main = [ ■ Floats print("Hello World!"); ■ Characters rtn 0; ■ Booleans ] ■ Void
AST Global vars Program Structs Functions Name vars Datatype Name Formals Locals Body
Compiler Architecture Program file Scanner Paser .sb extension File to Tokens Tokens to AST Semantic Codegen LLVM code Checker AST to LLVM .ll extension Checks AST
Arrays I/O chr c; flt[] array; array = new flt[2]; while(c != '\r'){ array[0] = 2.3; c = getchar(); array[1] = 5.2; print(c); } print(arr[0]); Implicit casting Datatypes int i; int j; int i; i = 2; chr c; bln b; j = i + ‘a’; flt f;
Structs Functions struct Person[ {int flt bln : chr} helloWorld = i f b [ int age; if(b){ flt weight; print(“Hello”); chr gender; print(f); ] } rtn ‘a’; ] {:int}main = [ {flt[] bln : chr} helloWorld = f_arr b [ struct Person p; if(b){ print(“Hello”); p.age = 20; print(f_arr[0]); p.gender = ‘f’; } p.weight = 120.5; rtn 0; rtn ‘a’; ] ]
Demo Time Credits: Prof. Stephen Edwards, Jacob Graff
Recommend
More recommend