Commit 8cf9af3d authored by pouill_n's avatar pouill_n
Browse files

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

	* configure.ac: Add str-concrete.
	* lib/sdf-pgen/Makefile.am: Update.
	* src/pp/pp-astsdf.str: Fix copyright.
	* src/mancmds: Add str-concrete, and sdf-astgen.
	* src/sig/Makefile.am: Update.
	* src/str-concrete/str-concrete.str: Add.
	* src/str-concrete/Makefile.am: Add.
	* src/str-concrete/str-concrete.meta: Add.
	* src/Makefile.am: Add str-concrete.
	* src/sdf-astgen/sdf-astgen.str: Typo.
	* src/parser/parse-astsdf-module.str: Fix copyright.
	* src/parser/parse-astsdf-definition.str: Fix copyright.
parent aa4c7c97
2004-05-12 Nicolas Pouillard <ertai@lrde.epita.fr>
* configure.ac: Add str-concrete.
* lib/sdf-pgen/Makefile.am: Update.
* src/pp/pp-astsdf.str: Fix copyright.
* src/mancmds: Add str-concrete, and sdf-astgen.
* src/sig/Makefile.am: Update.
* src/str-concrete/str-concrete.str: Add.
* src/str-concrete/Makefile.am: Add.
* src/str-concrete/str-concrete.meta: Add.
* src/Makefile.am: Add str-concrete.
* src/sdf-astgen/sdf-astgen.str: Typo.
* src/parser/parse-astsdf-module.str: Fix copyright.
* src/parser/parse-astsdf-definition.str: Fix copyright.
2004-05-10 Nicolas Pouillard <ertai@lrde.epita.fr>
* lib/sdf-pgen/Makefile.am,
......
......@@ -72,6 +72,7 @@ AC_CONFIG_FILES([Makefile
src/pp/Makefile
src/parser/Makefile
src/sdf-astgen/Makefile
src/str-concrete/Makefile
])
AC_OUTPUT
......@@ -50,7 +50,7 @@ noinst_DATA = $(SDFS) $(SDFS2)
CLEANFILES = $(SDFS) $(SDFS2)
$(SDFS): $(SDF_FRONT)/share/sdf/sdf-front/Sdf2.def
unpack-sdf -i $<
$(STRATEGO_FRONT)/unpack-sdf -i $<
$(SDFS2): $(SDF_FRONT)/share/sdf/sdf-front/Stratego-Sdf2.def
unpack-sdf -i $<
$(STRATEGO_FRONT)/unpack-sdf -i $<
......@@ -6,7 +6,8 @@ SUBDIRS = syn \
sig \
pp \
parser \
sdf-astgen
sdf-astgen \
str-concrete
BOOTCLEAN_SUBDIRS = $(SUBDIRS)
......
parse-astsdf-definition
parse-astsdf-module
pp-astsdf
sdf-astgen
str-concrete
/*
* parse-astsdf-definition.str: this file is a part of Sdf-AstGen from the
* Transformers project.
* Copyright (C) 2003, 2004 EPITA Research and Development Laboratory.
* Copyright (C) 2004 EPITA Research and Development Laboratory.
*
* 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
......
/*
* parse-astsdf-module.str: this file is a part of Sdf-AstGen from the
* Transformers project.
* Copyright (C) 2003, 2004 EPITA Research and Development Laboratory.
* Copyright (C) 2004 EPITA Research and Development Laboratory.
*
* 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
......
/*
* pp-astsdf.str: this file is a part of Sdf-AstGen from the Transformers
* project.
* Copyright (C) 2003, 2004 EPITA Research and Development Laboratory.
* Copyright (C) 2004 EPITA Research and Development Laboratory.
*
* 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
......
......@@ -109,7 +109,7 @@ rules
strategies
short-description(p) = !["sdf-astgen is a take a AstSdf definition file ",
short-description(p) = !["sdf-astgen take a AstSdf definition file ",
"and generate a stratego file, which translate ",
"a basic ast to a new one conforming to ",
"Annotations.\n\n",
......@@ -127,5 +127,5 @@ strategies
ArgOption
("-f" + "--fmt",
where( <set-config> ("--fmt", <id>) ),
!"-f|--fmt Use tihs format string (ex : '|$S$[ $T$ ]c++|')")
!"-f|--fmt Use this format string (ex : '|$S$[ $T$ ]c++|')")
......@@ -2,12 +2,10 @@
include $(top_srcdir)/config/Makefile.xt
SDF2RTG_FLAGS = -m $*
AstSdf2.def: $(top_builddir)/src/syn/AstSdf2.def
cp $< $@
AstSdf2.str: AstSdf2.def
$(STRATEGO_REGULAR)/bin/sdf2rtg -i $< -m AstSdf2 | \
$(STRATEGO_REGULAR)/bin/rtg2sig -o $@
pkgdata_DATA = AstSdf2.rtree
CLEANFILES = $(pkgdata_DATA) *.str AstSdf2.def
# Makefile.am -*-Makefile-*-
include $(top_srcdir)/config/Makefile.xt
-include str-concrete.c.dep
SRCS = \
str-concrete.str
SCFLAGS = --main io-$* --verbose 0
STRINCLUDES = -I $(SDF_FRONT)/share/sdf-front \
-I $(STRATEGO_FRONT)/share/sdf/sdf-front
bin_PROGRAMS = str-concrete
EXTRA_DIST = $(SRCS)
nodist_str_concrete_SOURCES = str-concrete.c
CLEANFILES = str-concrete.{c.dep,c}
Meta ([Syntax ("Stratego-Sdf2")])
module str-concrete
imports
lib
xtc-lib
Sdf2
AsFix
rules
Init: a -> a
where rules(ToTerms: () -> [])
; rules(Variables: () -> [])
GetSorts: 'sorts(s) -> 'sorts(s)
where < map(GetSort) > s
// fmt ex: "|$S$[ $T$ ]c++|" or "$S$|[ $T$ ]|" or "|$S${ $T$ }|"
// var ex: "SPECS-$S$"
GetSort: sort(s) -> sort(s)
where
< get-config > "--fmt" => fmt
; < string-tokenize >([36], fmt) => tok-l
; < map(try( (?"S"; !s) + (?"T"; !s) )) > tok-l => tok-l2
; < concat-strings > tok-l2 => t
; !|[ ~t -> StrategoTerm { cons("\"ToTerm\""), prefer } ]| => prod1
; < ToTerms > () => tt
; rules(ToTerms: () -> [ prod1 | tt ])
; (< get-config > "--var") <+ "$S$" => var
; < string-tokenize >([36], var) => tok-l3
; < map(try(?"S"; !s)) > tok-l3 => tok-l4
; < concat-strings > tok-l4 => t2
; < concat-strings >["\"", s, "\""] => quoted-s
; !|[ ~quoted-s [0-9]* [\']* -> ~t2 { prefer } ]| => prod2
; < Variables > () => v
; rules(Variables: () -> [ prod2 | v ])
strategies
io-str-concrete =
xtc-io-wrap (fmt-option + var-option + main-option + imports-option, read-from ;
// check that -f is given.
{| ToTerms, Variables:
Init
; bottomup (try (GetSorts))
; < ToTerms > () => p1*
; < Variables > () => p2*
; (< get-config > "--main" <+ !"Main") => M
; < get-config > "--imports" => i*
; !|[ module M
imports i*
exports
context-free syntax
"\"~\"" StrategoTerm -> Expression {cons("\"FromTerm\""), prefer}
p1*
exports
variables
p2*
]|
//; xtc-transform(!"sdf-desugar", pass-verbose)
; write-to
|})
fmt-option =
ArgOption
("-f" + "--fmt",
where( <set-config> ("--fmt", <id>) ),
!"-f str | --fmt str Use this format string (ex : '\"|$S$[\" $T$ \"]c++|\"')")
var-option =
ArgOption
("-v" + "--var",
where( <set-config> ("--var", <id>) ),
!"-v str | --var str Use this format string (ex : 'SPECS-$S$')")
main-option =
ArgOption
("-m" + "--main",
where( <set-config> ("--main", <id>) ),
!"-m mod | --main mod Specify module name for output sdf definition [Main]")
imports-option' = <get-config> "--imports" <+ ![]
imports-option =
ArgOption
("-p" + "--imports",
where( <set-config> ("--imports", [ <id> | <imports-option'> ])),
!"-p mod | --imports mod Specify a module to imports in the output sdf definition")
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