-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
execution after parsing for templates WIP
- Loading branch information
Showing
7 changed files
with
422 additions
and
311 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,38 @@ | ||
option goil_options { | ||
|
||
@string target_platform : 't', "target" -> "Specifies target platform. Available target platform are located in machines/ directory. Targets are specifies using a path like avr/arduino." | ||
@string project_dir : 'p', "project" -> "Specifies project directory (by default, the project directory is the name of the oil file, without the .oil extension)" | ||
@string template_dir : '\0', "templates" -> "Specifies template directory (used by goil for code generation)" | ||
@bool warnMultiple : '\0', "warn-multiple" -> "Emit a warning if an object not defined for the first time in the implementation does not have the same multiple attribute as in the first definition" | ||
@string config : 'c', "config" -> "Specifies the OIL config file used by goil" default "config" | ||
@string target_platform : | ||
't', | ||
"target" | ||
-> "Specifies target platform. Available target platform are located in machines/ directory. Targets are specified using a path like avr/arduino." | ||
|
||
@string project_dir : | ||
'p', | ||
"project" | ||
-> "Specifies project directory (by default, the project directory is the name of the oil file, without the .oil extension)" | ||
|
||
@string template_dir : | ||
'\0', | ||
"templates" | ||
-> "Specifies template directory (used by goil for code generation)" | ||
|
||
@bool warnMultiple : | ||
'\0', | ||
"warn-multiple" | ||
-> "Emit a warning if an object not defined for the first time in the implementation does not have the same multiple attribute as in the first definition" | ||
|
||
@string config : | ||
'c', | ||
"config" | ||
-> "Specifies the OIL config file used by goil" default "config" | ||
|
||
#@bool orti_on : '\0', "orti" -> "Generate an ORTI file" ; | ||
#@uint corrected_bits : '\0', "crc" -> "Generate correcting code" default 0 ; | ||
|
||
#--- Added by PM for new templates | ||
@bool generate_log : 'l', "logfile" -> "generate a goil.log file containing the a log of the compilation" | ||
@bool generate_log : | ||
'l', | ||
"logfile" | ||
-> "generate a goil.log file containing the a log of the compilation" | ||
} | ||
|
||
# vim:ft=ggs:ts=4:sw=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#---------------------------------------------------------------------------* | ||
# * | ||
# GOIL Template parser * | ||
# * | ||
# Copyright (C) 2014+ IRCCyN. * | ||
# * | ||
# This program is free software; you can redistribute it and/or modify it * | ||
# under the terms of the GNU General Public License as published by the * | ||
# Free Software Foundation. * | ||
# * | ||
# This program is distributed in the hope it will be useful, but WITHOUT * | ||
# ANY WARRANTY; without even the implied warranty of MERCHANDIBILITY or * | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * | ||
# more details. * | ||
# * | ||
#---------------------------------------------------------------------------* | ||
|
||
abstract class @gtlData {} | ||
class @gtlInt : @gtlData { @sint64 value } | ||
class @gtlFloat : @gtlData { @double value } | ||
class @gtlString : @gtlData { @string value } | ||
|
||
map @map { | ||
@gtlData field | ||
insert set error message "member %K already exists in %L" | ||
search get error message "member %K does not exists in %%" | ||
remove del error message "member %K does not exists in %%" | ||
} | ||
|
||
list @list { @map value } | ||
|
||
class @gtlStruct : @gtlData { @map value } | ||
class @gtlList : @gtlData { @list value } | ||
class @gtlMap : @gtlData { @map value } | ||
|
||
#---------------------------------------------------------------------------* | ||
# abstract classes for an expression | ||
#---------------------------------------------------------------------------* | ||
abstract class @gtlExpression {} | ||
abstract class @gtlUnaryExpression { @gtlExpression son } | ||
abstract class @gtlBinaryExpression { | ||
@gtlExpression lSon | ||
@gtlExpression rSon | ||
} | ||
|
||
abstract getter @gtlExpression eval -> @gtlData result | ||
|
||
#---------------------------------------------------------------------------* | ||
# classe for a literal terminal | ||
#---------------------------------------------------------------------------* | ||
class @gtlTerminal : @gtlExpression { @gtlData value } | ||
|
||
override getter @gtlTerminal eval -> @gtlData result { result = value } | ||
|
||
|
||
#---------------------------------------------------------------------------* | ||
# abstract class for a template instruction | ||
#---------------------------------------------------------------------------* | ||
abstract class @gtlInstruction {} | ||
|
||
abstract method @gtlInstruction execute | ||
?!@TfieldMap gtlVariableMap | ||
|
||
#---------------------------------------------------------------------------* | ||
# let instructions | ||
#---------------------------------------------------------------------------* | ||
abstract class @gtlAssign : @gtlInstruction { | ||
@TvarPath LValue | ||
@gtlExpression RValue | ||
} | ||
class @gtlLet : @gtlAssign {} | ||
class @gtlLetAdd : @gtlAssign {} | ||
class @gtlLetSubstract : @gtlAssign {} | ||
class @gtlLetMultiply : @gtlAssign {} | ||
class @gtlLetDivide : @gtlAssign {} | ||
class @gtlLetModulo : @gtlAssign {} | ||
class @gtlLetShiftLeft : @gtlAssign {} | ||
class @gtlLetShiftRight : @gtlAssign {} | ||
class @gtlLetAnd : @gtlAssign {} | ||
class @gtlLetOr : @gtlAssign {} | ||
class @gtlLetXor : @gtlAssign {} | ||
|
||
override method @gtlLet execute ?!@TfieldMap gtlVariableMap {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters