Jump to: navigation, search

Difference between revisions of "ETrice/GSoC/2012/GACL"

Line 27: Line 27:
 
=== Type Declaration ===
 
=== Type Declaration ===
  
   "type" typename [ '''type''' | "{" TypeCode "}"]
+
   "type" typename [ existingtype | "{" TypeCode "}"]
  
 
=== VariableDeclaration ===
 
=== VariableDeclaration ===
  
   ['''type'''] varname [ "=" { varname2 | '''Expression''' } ] { ";" | "\n" }
+
   ['''type'''] varname [ "=" { varname2 | [[ETrice/GSoC/2012/GACL#Expression | Expression]] } ] { ";" | "\n" }
  
 
=== Expression ===
 
=== Expression ===
  
   { '''ArithmeticExpression''' | '''LogicalExpression''' }
+
   { [[ETrice/GSoC/2012/GACL#ArithmeticExpression | ArithmeticExpression] | [[ETrice/GSoC/2012/GACL#LogicalExpression | LogicalExpression] }
  
 
==== ArithmeticExpression ====
 
==== ArithmeticExpression ====
  
   { '''Expression''' { "+" | "-" | "*" | "/" | "**" | "^" | "%" | "div" } '''Expression''' }  
+
   { [[ETrice/GSoC/2012/GACL#Expression | Expression] { "+" | "-" | "*" | "/" | "**" | "^" | "%" | "div" } [[ETrice/GSoC/2012/GACL#Expression | Expression] }  
  | {'''Expression''' { "++" | "--" } } | { { "++" | "--" } '''Expression''' }
+
  | {[[ETrice/GSoC/2012/GACL#Expression | Expression] { "++" | "--" } } | { { "++" | "--" } [[ETrice/GSoC/2012/GACL#Expression | Expression] }
  
 
==== LogicalExpression ====
 
==== LogicalExpression ====
  
   { '''Expression''' { "<" | "<=" | "==" | ">" | ">=" | "|" | "||" | "&" | "&&" | "^" } '''Expression''' }
+
   { [[ETrice/GSoC/2012/GACL#Expression | Expression] { "<" | "<=" | "==" | ">" | ">=" | "|" | "||" | "&" | "&&" | "^" } [[ETrice/GSoC/2012/GACL#Expression | Expression] }
  
 
=== Statement ===
 
=== Statement ===
  
   { '''Expression''' | '''VariableDeclaration''' }
+
   { [[ETrice/GSoC/2012/GACL#Expression | Expression] | [[ETrice/GSoC/2012/GACL#Expression | Expression] }
  
 
=== StatementList ===
 
=== StatementList ===
  
   { [[ETrice/GSoC/2012/GACL#Empty|Empty]] | '''Statement''' '''StatementList''' }
+
   { [[ETrice/GSoC/2012/GACL#Empty|Empty]] | [[ETrice/GSoC/2012/GACL#Statement | Statement] [[ETrice/GSoC/2012/GACL#Statementlist | Statementlist] }
  
 
=== Program ===
 
=== Program ===
  
   { '''StatementList'''}
+
   { [[ETrice/GSoC/2012/GACL#Statementlist | Statementlist]}
  
 
<br>  
 
<br>  

Revision as of 20:04, 30 March 2012

Generic Action Code Language (GACL)

GACL is the language to describe the Detail Code for execution of ROOM Models in eTrice plugin . GACL aims at dealing with all features commonly available in imperative languages , especially Java , C/C++ . It will act as complement of current version of eTrice which uses code written in target language stored in a string as execution code . GACL would make user able to write execution code independent of target language .

Development Details and Core Information

Features of GACL

  • Variable Declarations ( with optional initializers ) and Function Declaration .
  • Comparison & arithmetic expressions .
  • Basic types , and user defined types .
  • If-else blocks and ladders .
  • For , while , for each , enhanched for each .
  • Support for iterators (that can be used by for each loops ) .
  • Function Calls with arguments & diff types i.e. ref/value/address .
  • type checking and as much as possible implicit type casting .
  • Casts corresponding to static casts in C .

Thoughts on Syntax

Although syntax for GACL is still being designed but here are few thought regarding syntax .

Empty

 {}

Type Declaration

 "type" typename [ existingtype | "{" TypeCode "}"]

VariableDeclaration

 [type] varname [ "=" { varname2 |  Expression } ] { ";" | "\n" }

Expression

 { [[ETrice/GSoC/2012/GACL#ArithmeticExpression | ArithmeticExpression] | [[ETrice/GSoC/2012/GACL#LogicalExpression | LogicalExpression] }

ArithmeticExpression

 { [[ETrice/GSoC/2012/GACL#Expression | Expression] { "+" | "-" | "*" | "/" | "**" | "^" | "%" | "div" } [[ETrice/GSoC/2012/GACL#Expression | Expression] } 
| {[[ETrice/GSoC/2012/GACL#Expression | Expression] { "++" | "--" } } | { { "++" | "--" } [[ETrice/GSoC/2012/GACL#Expression | Expression] }

LogicalExpression

 { [[ETrice/GSoC/2012/GACL#Expression | Expression] { "<" | "<=" | "==" | ">" | ">=" | "|" | "||" | "&" | "&&" | "^" } [[ETrice/GSoC/2012/GACL#Expression | Expression] }

Statement

 { [[ETrice/GSoC/2012/GACL#Expression | Expression] | [[ETrice/GSoC/2012/GACL#Expression | Expression] }

StatementList

 { Empty | [[ETrice/GSoC/2012/GACL#Statement | Statement] [[ETrice/GSoC/2012/GACL#Statementlist | Statementlist] }

Program

 { [[ETrice/GSoC/2012/GACL#Statementlist | Statementlist]}


Disambiguation

The syntax used to specify the grammar in brief is

  • Things written in double quotes ("") stand as string written in source .
  • Content inside braces ({}) represents required content .
  • Content inside square brackets ([]) represents optional content .
  • Everything rest is either terminal or non-terminals .
  • Empty and statement list need a more thought to be done . We would surely finally come up with a better solution .

Project Proposal

Click Here to see the project proposal at gsoc's website .

Click Here to see the project proposal in my github repository .

Useful Links