URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog:
2008-09-24 Maxime van Noppen <yabo(a)lrde.epita.fr>
Handle static function calls
* cxx-syn/CxxType.sdf: Allow litteral expressions as template
* parameters.
* scoolt/Declaration.str: Consider types as being static expressions
* rather than just simple types.
* scoolt/Expression.str: Handle the StaticFunctionCall constructor.
* scoolt/Function.str: Handle the case where the parameters are not
* optional and therefore not in a Some() construct.
cxx-syn/CxxType.sdf | 3 +++
scoolt/Declaration.str | 16 ++++++++--------
scoolt/Expression.str | 6 ++++++
scoolt/Function.str | 5 ++++-
4 files changed, 21 insertions(+), 9 deletions(-)
Index: branches/scool-ng/src/scoolt/Expression.str
===================================================================
--- branches/scool-ng/src/scoolt/Expression.str (revision 96)
+++ branches/scool-ng/src/scoolt/Expression.str (revision 97)
@@ -49,3 +49,9 @@
StaticExpressionToCxx:
SimpleType(type) -> CxxType(type)
+
+ StaticExpressionToCxx:
+ StaticFunctionCall(idf, params) -> CxxType(cxx_idf, cxx_params)
+ where
+ <IdentifierToCxx> idf => cxx_idf
+ ; <ParametersToCxx> params => cxx_params
Index: branches/scool-ng/src/scoolt/Declaration.str
===================================================================
--- branches/scool-ng/src/scoolt/Declaration.str (revision 96)
+++ branches/scool-ng/src/scoolt/Declaration.str (revision 97)
@@ -11,29 +11,29 @@
DeclarationToCxx:
|[ ~idf : ~type; ]| -> ![ const ~cxx_type ~cxx_idf; ]!
where
- <TypeToCxx> type => cxx_type
- ; <IdentifierToCxx> idf => cxx_idf
+ <IdentifierToCxx> idf => cxx_idf
+ ; <StaticExpressionToCxx> type => cxx_type
DeclarationToCxx:
// |[ var ~i : ~t; ]| -> ![ ~cxx_t ~cxx_i; ]!
SimpleDeclaration(Some("var"), idf, type, None()) -> ![ ~cxx_type
~cxx_idf; ]!
where
- <TypeToCxx> type => cxx_type
- ; <IdentifierToCxx> idf => cxx_idf
+ <IdentifierToCxx> idf => cxx_idf
+ ; <StaticExpressionToCxx> type => cxx_type
DeclarationToCxx:
|[ ~idf : ~type = ~exp:exp; ]| -> ![ const ~cxx_type ~cxx_idf = ~exp:cxx_exp; ]!
where
- <TypeToCxx> type => cxx_type
- ; <IdentifierToCxx> idf => cxx_idf
+ <IdentifierToCxx> idf => cxx_idf
+ ; <StaticExpressionToCxx> type => cxx_type
; <ExpressionToCxx> exp => cxx_exp
DeclarationToCxx:
// |[ var ~i : ~t = ~exp:exp; ]| -> ![ ~cxx_t ~cxx_i = ~exp:cxx_exp; ]!
SimpleDeclaration(Some("var"), idf, type, Some(Initialiser(exp))) -> ![
~cxx_type ~cxx_idf = ~exp:cxx_exp; ]!
where
- <TypeToCxx> type => cxx_type
- ; <IdentifierToCxx> idf => cxx_idf
+ <IdentifierToCxx> idf => cxx_idf
+ ; <StaticExpressionToCxx> type => cxx_type
; <ExpressionToCxx> exp => cxx_exp
Index: branches/scool-ng/src/scoolt/Function.str
===================================================================
--- branches/scool-ng/src/scoolt/Function.str (revision 96)
+++ branches/scool-ng/src/scoolt/Function.str (revision 97)
@@ -38,7 +38,10 @@
// Parameters in function calls
ParametersToCxx:
- Some(Parameters(params)) -> <map (StaticExpressionToCxx)> params
+ Some(params) -> <ParametersToCxx> params
+
+ ParametersToCxx:
+ Parameters(params) -> <map (StaticExpressionToCxx)> params
Index: branches/scool-ng/src/cxx-syn/CxxType.sdf
===================================================================
--- branches/scool-ng/src/cxx-syn/CxxType.sdf (revision 96)
+++ branches/scool-ng/src/cxx-syn/CxxType.sdf (revision 97)
@@ -8,7 +8,10 @@
context-free syntax
CxxId -> CxxType {cons("CxxType")}
+
CxxId "<" {CxxType ","}* ">" ->
CxxType {cons("CxxType")}
+ CxxId "<" {CxxExp ","}* ">" ->
CxxType {cons("CxxType")}
+
"const" CxxType -> CxxType {cons("CxxConstType")}
CxxType "&" -> CxxType {cons("CxxRefType")}
--
\__/ \__/
(00) Maxime `yabo` van Noppen (00)
___) \ Epita 2009 / (___
(_____/ \_____)