Download presentation
Presentation is loading. Please wait.
1
EcoSL Lalit K Kanteti SomenathSrinivas Economical Spreadsheet Language
2
Feeling like this?? Image from: www.spreadsheet-factory.com/presentation.html
3
We have EcoSL for you!! Image from: www.spreadsheet-factory.com/presentation.html
4
What’s this Language? A language which allows users to manipulate on sets of data in a spreadsheet like manner Key features of Spreadsheets: Data Interpretations Software should be more than Scientific Cal Mathematical Computations on data Graphical representations No need to know too much of Programming concepts EcoSL was motivated and had started with above goals EcoSL is not a compiler. It’s an Interpreter
5
Tired of hello world? Let’s have some different fodder for the newbie! { /* /* * A Sample program * A Sample program */ */ func max(a,b){ if (a>=b) if (a>=b) return a; return a; else else return b; return b;} [1:2] = 2; [3:5] = 6; max(5,99); c = max(5,99); println(c); println(c); print(max([1:2],[3:5])); print(max([1:2],[3:5]));} The adjacent sample program prints the following output 99 99 6
6
Does the previous code look cool. Guess why??? EcoSL is characterized by a simple syntax. EcoSL is characterized by a simple syntax. [x:y] defines a basic unit of computation in a spreadsheet called a cell [x:y] defines a basic unit of computation in a spreadsheet called a cell Not to annoy the seasoned programmer we also support the traditional identifiers. Not to annoy the seasoned programmer we also support the traditional identifiers. Built in functions of Sigma, Avg, Print, Println Built in functions of Sigma, Avg, Print, Println In addition the user can easily define any function In addition the user can easily define any function of his choice of his choiceObserve No declarations for identifiers No return type defined for functions Built-in functions synonymous to mathematical operations
7
Converts stream of program input to tokens An example comment matching rule COMMENT: "/*" ( options { generateAmbigWarnings = false; }: { LA(2) != '/' }? '*' COMMENT: "/*" ( options { generateAmbigWarnings = false; }: { LA(2) != '/' }? '*' | "\r\n"{ newline(); } | ( '\r' | '\n' ){ newline(); } | ~( '*'| '\r' | '\n' ) )* "*/"{ $setType(Token.SKIP); } ; EcoSL-Lexer
8
Ecosl Parser Our entry point into the parser is shown below program: LBRACE! (statement)+ RBRACE! { RBRACE! { #program = #([PROGRAM, #program = #([PROGRAM, "program"], program); "program"], program); } ; } ; Some key parser productions Statement : …… | (LBRACE! (statement)+ | (LBRACE! (statement)+ RBRACE!) { RBRACE!) { #statement = #([STMT_BLOCK, #statement = #([STMT_BLOCK, "stmt_block"], statement); }) "stmt_block"], statement); }) Contd… func_decl : "func"! ID LPAREN! (formal_args)* RPAREN! LBRACE! (statement)* RPAREN! LBRACE! (statement)* RBRACE! { RBRACE! { #func_decl = #([FUNC_DECL, #func_decl = #([FUNC_DECL, "func_decl"], func_decl); "func_decl"], func_decl); } ; } ; coordinate : LBRAC! (expr) COLON! (expr) RBRAC! { #coordinate = #([COORDINATE, #coordinate = #([COORDINATE, "coordinate"], coordinate); "coordinate"], coordinate);}
9
Walker – Ecosl runs!!! program returns [Program prog] { prog=null;Stmt s = null; } { prog=null;Stmt s = null; } : #(PROGRAM { prog = new Program();} : #(PROGRAM { prog = new Program();} (s = statement (s = statement { prog.addStmt(s); prog.addStmt(s); } )* )* ); ); #(FUNC_DECL ID (args=formal_args)? { s1 = new StmtBlock(); s1 = new StmtBlock();} (s2=statement { ((StmtBlock)s1).addStmt(s2); } (s2=statement { ((StmtBlock)s1).addStmt(s2); } )* )* { s = new FunctionDecl (#ID.getText(), args, s1); s = new FunctionDecl (#ID.getText(), args, s1); } formal_args returns [java.util.Vector formalArgs] {formalArgs = null; } : #(FORMAL_ARGS { formalArgs = new java.util.Vector(); } (ID { formalArgs.add (new Variable(#ID.getText())); })*); : #(FORMAL_ARGS { formalArgs = new java.util.Vector(); } (ID { formalArgs.add (new Variable(#ID.getText())); })*); #(COORDINATE a=expr b=expr { e = new Coordinate(a, b); e = new Coordinate(a, b); } )
10
Program Statements Expr StatementWhileForBreakIfContinue PlusMinusModFunc CallVariableIntConstant....................
11
Looking for the same old features?? It is there in EcoSL!! User defined functions Built-in functions Iterations (while, for) Comments Conditional statements (if else) Scope Data types (Integer, float) Basic arithmetic operations Break,continue
12
Looking for the something new?? It is there in EcoSL!! Coordinates Operations on coordinates String operations No types Functions returns
13
Problem in coordination?? We have a repository!!!!!!!!!! CVS through Clic machines Google Code (svn)
14
Thanks!!!!! Let's explore EcoSL. Time for Demo!!!!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.