Skip to content

Commit

Permalink
execution after parsing for templates WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jlbirccyn committed Dec 8, 2014
1 parent 31aa0cb commit 448f974
Show file tree
Hide file tree
Showing 7 changed files with 422 additions and 311 deletions.
232 changes: 116 additions & 116 deletions goilv2/build/output/all-declarations-0.cpp

Large diffs are not rendered by default.

372 changes: 186 additions & 186 deletions goilv2/build/output/all-declarations-1.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions goilv2/build/output/option-goil_options-cocoa.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// *
// File 'option-goil_options-cocoa.m' *
// Generated by version 3.0.0 *
// december 7th, 2014, at 15h59'45" *
// december 8th, 2014, at 9h33'19" *
// *
//---------------------------------------------------------------------------------------------------------------------*

Expand Down Expand Up @@ -63,7 +63,7 @@ void enterOptionsFor_goil_5F_options (NSMutableArray * ioBoolOptionArray,
identifier:@"target_platform"
commandChar:116
commandString:@"target"
comment:@"Specifies target platform. Available target platform are located in machines/ directory. Targets are specifies using a path like avr/arduino."
comment:@"Specifies target platform. Available target platform are located in machines/ directory. Targets are specified using a path like avr/arduino."
defaultValue:@""
] ;
[ioStringOptionArray addObject:option] ;
Expand Down
35 changes: 29 additions & 6 deletions goilv2/galgas-sources/goil_options.galgas
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
84 changes: 84 additions & 0 deletions goilv2/galgas-sources/template_instructions.galgas
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 {}

3 changes: 2 additions & 1 deletion goilv2/galgas-sources/template_parser.galgas
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,8 @@ rule <template_instruction>
?!@TfieldMap ioTemplateVariableMap
?!@string unused ioResultingString
!@Tvalue returnedValue
!@Ttype returnedType {
!@Ttype returnedType
{
@TvarPath path
$let$ <variable> !inPrefix !inPath !inTemplateDirectory !ioTemplateVariableMap ?path
@Tvalue enumeratedValue
Expand Down
3 changes: 3 additions & 0 deletions goilv2/goil.galgasProject
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ project (2:1:8) -> "goil" {
%makefile-x86linux64-on-macosx
%makefile-win32-on-macosx
%makefile-msys32-on-windows

#specific for Mac Cocoa Version:
%LatestMacOS
%applicationBundleBase : "fr.irccyn.str"

#
# New templates (added by PM)
#
Expand All @@ -46,6 +48,7 @@ project (2:1:8) -> "goil" {
"galgas-sources/template_invocation.galgas"
"galgas-sources/template_routines.galgas"
"galgas-sources/template_functions.galgas"
# "galgas-sources/template_instructions.galgas"

"galgas-sources/goil_lexique.galgas"
"galgas-sources/goil_options.galgas"
Expand Down

0 comments on commit 448f974

Please sign in to comment.