Language Articulation Graph G R A I L Rendering Innovation
Motivation Company ● Represent complex graphs with syntactic simplicity ● Allow users to define flexible data-types ● Type-inference allows for concise representation of data
Key Features Intuitive Syntax Primitive Types & Control Flows Basic Types if ... else … c = {station: "49th St Station", line: "1", lat:39.9436, lon:75.2167, Int, float, char, str, bool if … else if … service: [0,1,1,1,1,1,1]}; while … d = {station: "116th St Station", line: Binary & Unary Ops for (...;...;...;) … "1", lat:39.56, lon:75.456, service: Arithmetic: +, -, *, / for ( … in … ) ... [0,1,1,1,1,1,0]}; Logical: >, >=, <, <=, =, == g = (c -- d) with {distance: 1};
Key Features Graphical Data Structures & Operations Derived Types List Edge List size(c.service); u -- v with e Edges Dot Graph Graphs c.station = “168th”; g =(a, b, c -- d) with {test:1} Records Record display() e = {test:1}; display(g) y = e.test;
Key Features Structural Comparison Deep Copy lance = {name: "Lancelot", quest: x = [[1, 2], [3,4]]; "grail", colors:["blue"])}; y .= x; robin ={name: "Robin", quest: y[0] = [8, 9]; "grail", colors:["blue", "yellow"]}; fsty = y[0]; lance == {name: "Lancelot", quest: fstx = x[0]; "grail", colors:["blue"])); printint(fsty[0]); lance.colors == robin.colors; printint(fstx[0]);
Key Features Type Inference f(x, y){ h(x){ main(){ return x + y; return x; x = f(1,2); } } y = x + g(3); g(z){ p(x){ hi = h("hi"); y = 0; return x.school; z = h(3); if(z == "hello"){ } a = {school: 3}; y = 5; p(a); } } return y; }
Implementation
Compiler Architectures Source Codes GNU Plot display.c Library Scanner Output executables Tokens .lli files Parser Linker AST Code Inference Typer Generation ll module SAST (.ll files)
Testing
General Compiler Testing Plan ● Start from basics, like arithmetic operators, and move on to advanced features Feed unit test case codes for new-implemented features with expected ● outputs/errors ● Check for exceptions or errors ○ Unit test cases syntax correct? What kind of exceptions? ○ ○ Scanner, Parser, Typer, or Codegen? ○ Send through type-tester ● Use LLVM Interpreter Implemented testing programs that can get outputs from parser or typer if we ● feed the testers with test code files
Demo
Petersen Graph
Thank You!
Recommend
More recommend