User Tools

Site Tools


lara:docs:sheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lara:docs:sheet [2017/10/10 17:32]
joaobispo
lara:docs:sheet [2019/09/22 15:47] (current)
Line 183: Line 183:
  
 <code lara> <code lara>
-call optimizer: OptimizeFunctions(functions,​ optimizations);​+// Current syntax 
 +var optimizer = call OptimizeFunctions(functions,​ optimizations);​ 
 + 
 +// Previous syntax 
 +call optimizer : OptimizeFunctions(functions,​ optimizations);​
  
 var changedFuncs = optimizer.optFuncs;​ var changedFuncs = optimizer.optFuncs;​
Line 194: Line 198:
 var optimizer = new OptimizeFunctions(functions,​ optimizations);​ var optimizer = new OptimizeFunctions(functions,​ optimizations);​
  
-call optimizer();​+call optimizer(); ​// or optimizer.call()
  
 var changedFuncs = optimizer.optFuncs;​ var changedFuncs = optimizer.optFuncs;​
Line 238: Line 242:
     $loop.exec tile(8); ​ // performed on the same loop as above     $loop.exec tile(8); ​ // performed on the same loop as above
 end end
 +</​code>​
 +
 +
 +If the action returns a result, we can use the following syntax:
 +
 +<code lara>
 +   var result = $jp.exec <​action_name>;​
 +</​code>​
 +
 +If '​result'​ is a variable that already exists, '​var'​ can be omitted:
 +
 +<code lara>
 +   ​result = $jp.exec <​action_name>;​
 +</​code>​
 +
 +The keyword '​.exec'​ can be omitted if you prefix the name of the action with the target join point, and add parenthesis:​
 +
 +<code lara>
 +  result = $jp.<​action_name>​();​
 </​code>​ </​code>​
  
Line 326: Line 349:
  
 </​code>​ </​code>​
 +
 +Or you can also use the **match** boolean operator ( **~=** ):
 +
 +<code lara>
 +
 +'​aaaa'​ ~= /a*/ // Returns true
 +
 +</​code>​
 +
 +==== Importing LARA Files ====
 +
 +LARA supports importing LARA files that are present in the include path using the keyword **import**. To import a file, you have to use the path to the file from the include folder, using *.* as separator and omitting the extension of the file. For instance, if you add as include the folder *~/foo* and you want to import the file *~/​foo/​bar/​Aspect.lara*,​ you can write the following code:
 +
 +<code lara>
 +
 +import bar.Aspect;
 +
 +</​code>​
 +
 +Import statements must be the first statements in a LARA file. LARA weavers come bundled with support for a set of imports, which are part of their API (e.g., [[http://​specs.fe.up.pt/​tools/​clava/​doc/​|Clava API]]).
 +
  
  
lara/docs/sheet.1507649541.txt.gz · Last modified: 2019/09/22 15:46 (external edit)