-
Notifications
You must be signed in to change notification settings - Fork 295
The OIL Compiler
Jean-Luc Béchennec edited this page Nov 6, 2015
·
9 revisions
By default, after having parsed an oil file, goil executes the root.goilTemplate template which is located in the templates directory. It is possible to specify another template file by using the --root option. The template file has to be located in the templates directory. This allows to perform custom computations on the abstract syntax tree of the oil file.
Suppose for instance you want to count the number of tasks declared in an oil file. On the templates side, this information is the number of objects in the TASK list. So we could add a taskcount.goilTemplate file with the following content:
%
println [TASK length]
In this case, goil would be invoked with the --root=taskcount or -r= taskcount option.