ALBS Suhani Singhal - ss4925 Brennan Wallace - bgw2119 Steep - - PowerPoint PPT Presentation

albs
SMART_READER_LITE
LIVE PREVIEW

ALBS Suhani Singhal - ss4925 Brennan Wallace - bgw2119 Steep - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

ALBS

Suhani Singhal - ss4925 Brennan Wallace - bgw2119

slide-2
SLIDE 2

LLVM OCaml + = Steep learning curve

+Arrays +Structs +Printing +Casting

2000+ LOC 100+ commits 88 test cases MicroC++

slide-3
SLIDE 3

Features

  • Procedural
  • Functions
  • Data Types

○ Mutable ○ Static typing ○ Primitives ■ Integers ■ Floats ■ Characters ■ Booleans ■ Void

{ : int} main = [ print("Hello World!"); rtn 0; ]

  • Arrays
  • Structs
  • Operators

○ Binary ○ Unary

  • Multiline Comments
  • Implicit casting
  • I/O functions
slide-4
SLIDE 4

Program Global vars Functions Structs

AST

Datatype Name Formals Locals Body vars Name

slide-5
SLIDE 5

Program file .sb extension Scanner File to Tokens Paser Tokens to AST Codegen AST to LLVM Semantic Checker Checks AST

Compiler Architecture

LLVM code .ll extension

slide-6
SLIDE 6

Arrays I/O

flt[] array; array = new flt[2]; array[0] = 2.3; array[1] = 5.2; print(arr[0]);

Implicit casting

int i; int j; i = 2; j = i + ‘a’; chr c; while(c != '\r'){ c = getchar(); print(c); }

Datatypes

int i; chr c; bln b; flt f;

slide-7
SLIDE 7

{int flt bln : chr} helloWorld = i f b [ if(b){ print(“Hello”); print(f); } rtn ‘a’; ] {flt[] bln : chr} helloWorld = f_arr b [ if(b){ print(“Hello”); print(f_arr[0]); } rtn ‘a’; ]

Structs Functions

struct Person[ int age; flt weight; chr gender; ] {:int}main = [ struct Person p; p.age = 20; p.gender = ‘f’; p.weight = 120.5; rtn 0; ]

slide-8
SLIDE 8

Demo Time

Credits: Prof. Stephen Edwards, Jacob Graff