Download presentation
Presentation is loading. Please wait.
1
DEVIL Device configuration language By Boklyn Wong Pranay Tigga Vishal Kumar Singh
2
Agenda Motivation. Language overview Examples Compiler Design and Implementation Front End Back End Conclusion and Lessons Learnt.
3
Why DEVIL? Ease of Device Configuration. Too many UI’s and command line interfaces for various devices. Compiler handles complexity and abstracts device idiosyncrasies. Architecture independence.
4
Language Overview Data Types No data types – decides based on value and usage, can be directly assigned. No declarations, Only Assignment. Internally – Integer, Double and String. E.g. a=10; or a=“abc” ; Internally makes a variable of type String or Integer. Tuples ( kind of Arrays) allow for various kinds of data types, can be restricted).e.g. a[1]=10;a[2]=“Linux”; // is allowed.
5
Language Overview Expressions similar to C Arithmetic {“+”,”-”,”*”,”/”,”++”,”--”} and Relational {“ ”,” =”} operators If then else For loop While loop Functions Inbuilt functions Scoping : Local and Global Scope.
6
Language Overview Example 1 Simple.devil i = 10; func add(i,j) { i= i + j; } func main(i) { x =1; x = 2 + 3 * 4; y = x +1; add (x, y); } main(i); print x; Example 2 generate.devil ip1 = “128.12.59.10”; port = 80; block ip; if(port==80) { unblock port; } else { block port; } for (i=0;i<10;i++){ a[i] =I; print a[i]; }
7
Compiler design Lexer Parser WalkerInterpreter DevilDataType DevilVariable (name) DevilInteger DevilDouble DevilFloat Compiler
8
Compiler Implementation devil.g (function_def | statement ) statement – function statement and others. DevilWalker.g expr returns [ DevilDataType x ] { #(FUNC_CALL fname:ID params=get_var ) { interpreter.call_func(fname.getText(),params ); } }
9
Compiler Implementation Symbol Tables Global and Local ( Per Function ) Symbol Table for variables Stack of Symbol Tables per function while walking to handle scoping. Function Tables(Stores the Function AST) Main() Local Variables Function() called by Main() Local vars Innermost Function Variables
10
Conclusion Lessons Learnt compiler design. Good design is very important. Consult Teammates when in doubt. Always finish the hard part earlier.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.