Commit aa4c7c97 authored by pouill_n's avatar pouill_n
Browse files

from Nicolas Pouillard <ertai@lrde.epita.fr>

	* src/specs-renamed/Makefile.am: Update.
	* src/specs-renamed/rename.meta: Add.
	* src/specs-renamed/rename.str: Use concrete syntax.
	* src/strategospecs/Makefile.am: Use sdf-astgen/str-concrete.
	* src/strategospecs/StrategoSPECSGen.pl: Remove.
	* src/syn/Makefile.am: Distribute purified definition (.af).
	* src/sdf/Makefile.am: Update.
	* Makefile.am: Remove an import.
parent a1ec3794
2004-05-12 Nicolas Pouillard <ertai@lrde.epita.fr>
* src/specs-renamed/Makefile.am: Update.
* src/specs-renamed/rename.meta: Add.
* src/specs-renamed/rename.str: Use concrete syntax.
* src/strategospecs/Makefile.am: Use sdf-astgen/str-concrete.
* src/strategospecs/StrategoSPECSGen.pl: Remove.
* src/syn/Makefile.am: Distribute purified definition (.af).
* src/sdf/Makefile.am: Update.
* Makefile.am: Remove an import.
2004-05-07 Nicolas Pouillard <ertai@lrde.epita.fr>
* lib/AstBoxedSdf2.sdf: Add.
......
......@@ -4,5 +4,4 @@ ACLOCAL_AMFLAGS = -I config
SUBDIRS = config lib src
BOOTCLEAN_SUBDIRS = src
EXTRA_DIST = bootstrap ChangeLog
XTC_IMPORT = $(STRATEGOXT)/share/strategoxt/XTC \
$(CXX_GRAMMAR)/share/cxx-grammar/XTC
XTC_IMPORT = $(CXX_GRAMMAR)/share/cxx-grammar/XTC
include $(top_srcdir)/config/Makefile.xt
pkgdata_DATA = sdf
SDFS = \
Expressions/AllocationExpressions.sdf \
Expressions/OperatorsExpressions.sdf \
Expressions/PostfixExpressions.sdf \
Expressions/Expressions.sdf \
Dummy.sdf \
Keywords.sdf \
TypeDeclarations.sdf \
NamespacesDeclarations.sdf \
Classes.sdf \
Declarations.sdf \
Declarators.sdf \
Operators.sdf \
Exceptions.sdf \
ObjectDeclarations.sdf \
Statements.sdf \
Layout.sdf \
Literals.sdf \
FunctionDeclarations.sdf \
Templates.sdf \
Names.sdf \
Identifiers.sdf \
SPECS.sdf
sdf: $(top_builddir)/src/syn/SPECS.def
unpack $(top_builddir)/src/syn/SPECS.def sdf
pkgdata_DATA = $(SDFS)
CLEANFILES = */*.sdf *.sdf
$(SDFS): $(top_builddir)/src/syn/SPECS.def
$(STRATEGO_FRONT)/bin/unpack-sdf -i $(top_builddir)/src/syn/SPECS.def
CLEANFILES = $(SDFS)
......@@ -20,21 +20,23 @@ include $(top_srcdir)/config/Makefile.xt
-include rename.c.dep
SCFLAGS = --main $* --verbose 0
SDF2RTG_FLAGS = --main $*
STRINCLUDES = -I $(SDF_FRONT)/share/sdf-front \
-I $(STRATEGO_FRONT)/share/sdf/sdf-front
bin_PROGRAMS = rename
noinst_PROGRAMS = rename
pkgdata_DATA = SPECS-Renamed.sdf
pkgdata_DATA = SPECS-Renamed.sdf SPECS-Renamed.def SPECS-Renamed.rtree
SPECS-Renamed.sdf: SPECS-Renamed.def
unpack $< sdf
$(STRATEGO_FRONT)/bin/unpack-sdf -i $<
SPECS-Renamed.def: rename
sglri -p `xtc get Sdf2-Syntax.tbl` -i ../syn/SPECS.def | \
./rename | \
pp-sdf -o $@
SPECS-Renamed.def: rename ../syn/SPECS.def.af
./rename -i ../syn/SPECS.def.af | \
$(STRATEGO_FRONT)/bin/pp-sdf -o $@
nodist_rename_SOURCES = rename.c
nodist_rename_SOURCES = rename.c
CLEANFILES = SPECS-Renamed.def \
*.sdf \
SPECS-Expressions/*.sdf \
......
Meta ([Syntax ("Stratego-Sdf2")])
......@@ -2,20 +2,26 @@ module rename
imports
lib
Sdf2-Syntax
Sdf2
rules
Rename: sort(s) -> sort(<conc-strings>("SPECS-", s))
Rename: |[ S ]| -> |[ S' ]|
where <conc-strings>("SPECS-", S) => S'
Rename: |[ module Mid [ A* ] is* s* ]| -> |[ module Mid' [ A* ] is* s* ]|
where <RenameSPECS <+ RenameModuleName> Mid => Mid'
Rename: Module(name, m1, m2) -> Module(name', m1, m2)
where <RenameModuleName>name => name'
Rename: Imports(list) -> Imports(<map(RenameSPECS <+ RenameModuleName)>list)
Rename: |[ module Mid is* s* ]| -> |[ module Mid' is* s* ]|
where <RenameSPECS <+ RenameModuleName> Mid => Mid'
RenameSPECS: "SPECS" -> "SPECS-Renamed"
Rename: 'imports(i*) -> 'imports(<map(RenameImports)>i*)
RenameImports: i|[ Mid ]| -> i|[ Mid' ]|
where <RenameModuleName> Mid => Mid'
RenameModuleName: s -> s'
where <explode-string>s => char-list
; <map(try(?47; !95))>char-list => mapped
......
......@@ -2,21 +2,18 @@ include $(top_srcdir)/config/Makefile.xt
PGEN_FLAGS = -m $*
SCFLAGS = --main io-$* --verbose 0 $(XTCFLAGS) \
-I $(STRATEGO_FRONT)/share/sdf/sdf-front
SDFINCLUDES = -I $(STRATEGO_FRONT)/share/sdf/stratego-front \
-I $(CXX_GRAMMAR)/share/sdf/cxx-grammar \
-I $(top_srcdir)/src/specs-renamed
SRCS = StrategoSPECSGen.str
-I $(top_builddir)/src/specs-renamed
pkgdata_DATA = StrategoSPECS.tbl StrategoSPECS.def #StrategoSPECS.pp
bin_PROGRAMS = StrategoSPECSGen
pkgdata_DATA = StrategoSPECS.tbl StrategoSPECS.def
StrategoSPECS.sdf: StrategoSPECSGen ../syn/SPECS.def
sglri -p `xtc get Sdf2-Syntax.tbl` -i ../syn/SPECS.def | ./StrategoSPECSGen | pp-sdf -o $@
StrategoSPECS.sdf: ../syn/SPECS.ppdef.af
$(BUNDLED_ASTGEN)/bin/str-concrete -i $< \
--fmt '"|$$T$${" SPECS-$$S$$ "}|"' \
--main StrategoSPECS --var 'SPECS-$$S$$' \
-p StrategoRenamed -p StrategoCxx -p SPECS-Renamed \
| $(SDF_FRONT)/libexec/sdf-desugar \
| $(SDF_FRONT)/bin/pp-sdf -o $@
BOOTCLEANFILES = StrategoSPECSGen.c
EXTRA_DIST = $(SRCS)
CLEANFILES = StrategoSPECS.* */*.sdf */*.str *.sdf StrategoSPECSGen.c.dep
CLEANFILES = $(pkgdata_DATA) StrategoSPECS.sdf
#!/usr/bin/perl
#
# This program is free software; you can redistribute it and/or modif
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Written by Nicolas Pouillard <pouill_n@lrde.epita.fr>.
#
my $seen_sorts;
my @sorts;
while ( <> )
{
next if /^\s*$/;
$seen_sorts = 0 if /(?:imports|exports|context|lexical|hiddens)/;
if ( $seen_sorts == 1 ) {
s/\s//g;
push @sorts, $_;
next
};
$seen_sorts = 1 if /\bsorts\b/;
}
sub mkfile {
print <<EOF;
module StrategoSPECS
imports
StrategoRenamed
StrategoCxx
SPECS-Renamed
EOF
# SPECS [
# print " $_ => SPECS-$_$/" for ( @sorts );
# ]
print <<EOF;
exports
context-free syntax
EOF
print " \"|SPECS-${_}[\" SPECS-$_ \"]|\" -> StrategoTerm {cons(\"ToTerm\"), prefer}$/" for ( @sorts );
print <<EOF;
context-free syntax
"~" StrategoTerm -> Expression {cons("FromTerm"), prefer}
variables
EOF
print " \"$_\"[0-9]*[\\']* -> SPECS-$_ { prefer }$/" for ( @sorts );
}
mkfile();
......@@ -4,7 +4,7 @@ PGEN_FLAGS = -m $*
SPECS = SPECS
pkgdata_DATA = $(SPECS).def $(SPECS).tbl $(SPECS).pp.af $(SPECS).ppdef.af
pkgdata_DATA = $(SPECS).def $(SPECS).tbl $(SPECS).pp.af $(SPECS).ppdef.af $(SPECS).def.af
EXTRA_DIST = $(SDFS)
......@@ -36,9 +36,11 @@ $(SPECS).ppdef: $(SPECS).ppdef.af
$(SDF_TOOLS)/bin/sdf-bracket -i $< | \
$(BOXEDSDF)/bin/pp-boxedsdf -o $@
$(SPECS).def: $(SPECS).ppdef.af
$(ESDF)/bin/sdf-purify -i $< | \
$(GPP)/bin/pp-sdf -o $@
$(SPECS).def: $(SPECS).def.af
$(GPP)/bin/pp-sdf -i $< -o $@
$(SPECS).def.af: $(SPECS).ppdef.af
$(ESDF)/bin/sdf-purify -i $< -o $@
$(SPECS).pp: $(SPECS).ppdef.af
$(BOXEDSDF)/bin/boxed2pp-table -i $< | \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment