Commit 055b5c1a authored by david_v's avatar david_v
Browse files

2003-06-20 Valentin David <valentin@lrde.epita.fr>

	* src/xtc/parse-detboxedsdf.str,
	* src/xtc/det-gen.str,
	* src/syn/DetBoxedSdf.sdf,
	* src/detgen/detgen.str:
	Add comment headers.

	* src/det2sdf/det2sdf.str: New.
	* src/det2sdf/Makefile.am: New.

	* src/xtc/pp-detboxedsdf.str: New.
	* src/pp/DetBoxedSdf-pretty.pp: New.
	* src/pp/Makefile.am: New.

	* configure.ac,
	* src/Makefile.am: Add new directories.

	* src/xtc/Makefile.am: Add new program.
parent d2926c15
2003-06-20 Valentin David <valentin@lrde.epita.fr>
* src/xtc/parse-detboxedsdf.str,
* src/xtc/det-gen.str,
* src/syn/DetBoxedSdf.sdf,
* src/detgen/detgen.str:
Add comment headers.
* src/det2sdf/det2sdf.str: New.
* src/det2sdf/Makefile.am: New.
* src/xtc/pp-detboxedsdf.str: New.
* src/pp/DetBoxedSdf-pretty.pp: New.
* src/pp/Makefile.am: New.
* configure.ac,
* src/Makefile.am: Add new directories.
* src/xtc/Makefile.am: Add new program.
2003-06-19 Valentin David <valentin@lrde.epita.fr>
Initial checkin.
......@@ -7,10 +7,10 @@ AC_CONFIG_FILES(config/Makefile)
AM_INIT_AUTOMAKE([foreign 1.7.1 dist-bzip2])
USE_XT_PACKAGES
test "x$prefix" = xNONE && prefix=$ac_default_prefix
USE_XT_PACKAGES
AC_ARG_WITH(boxedsdf,
[ --with-boxedsdf=DIR Specify location of BOXEDSDF, [PREFIX]],
BOXEDSDF="$withval",
......@@ -27,6 +27,8 @@ AC_CONFIG_FILES([Makefile
lib/boxedsdf/Makefile
src/Makefile
src/syn/Makefile
src/pp/Makefile
src/detgen/Makefile
src/det2sdf/Makefile
src/xtc/Makefile])
AC_OUTPUT
......@@ -2,7 +2,9 @@ include $(top_srcdir)/config/Makefile.xt
SUBDIRS = \
syn \
pp \
detgen \
det2sdf \
xtc
BOOTCLEAN_SUBDIRS = $(SUBDIRS)
include $(top_srcdir)/config/Makefile.xt
-include det2sdf.c.dep
bin_PROGRAMS = det2sdf
SCFLAGS = --main $* --verbose 0
STRINCLUDES = -I $(top_builddir)/src/syn
BOOTCLEANFILES = det2sdf.c
CLEANFILES = det2sdf.c.dep
EXTRA_DIST = det2sdf.str
/**
* DetGen
* Copyright (C) 2003 LRDE
*
* 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; 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
*
* This module clean all the "dettag" entries so as to generate a BoxedSdf
* AST.
*
* Author: Valentin David <valentin@lrde.epita.fr>
*/
module det2sdf
imports lib DetBoxedSdf
strategies
det2sdf = iowrap(
topdown(
try(attrs(filter(not(dettag2(id,id) <+ dettag(id))))
; try(attrs([]); !no-attrs))
)
)
/**
* DetGen
* Copyright (C) 2003 LRDE
*
* 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; 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
*
* This program generate the corresponding deterministic grammar module
* extension AST of a definition grammar AST.
*
* Author: Valentin David <valentin@lrde.epita.fr>
*/
module gendet
imports lib DetBoxedSdf sdf-2-pp-lib
......@@ -36,11 +59,9 @@ strategies
at-pp(s) = oncetd(BoxedAttr(pplist(s)))
at-cons(s) = oncetd(cons(s))
at-dettag(s1,s2) = oncetd(dettag(s1,s2))
at-dettag(s1,s2) = oncetd(dettag2(s1,s2))
at-dettag(s) = oncetd(dettag(s))
keep(s) = rec x([] <+ ([s|id]; [id|x]) <+ \ [_|l] -> l \; x)
rules
/**
* :: String -> String
......@@ -75,7 +96,7 @@ rules
; <ToBegin> tag => btag
; <ToEnd> tag => etag
; <concat> [[lit(btag)], a, [lit(etag)]] => a'
; <attrs(keep(not(dettag(id))))> c => c'
; <attrs(filter(not(dettag(id))))> c => c'
// Try to get the current pp-entry and add the tags.
; ((<prod(id,id,at-pp(?pl))> prod(a, b, c')
; !pl
......@@ -113,7 +134,7 @@ rules
; drop-while(lit(id))
; take(?1) => e
; <concat> [h, hl,[lit(btag)], e, [lit(etag)], t] => a'
; <attrs(keep(not(dettag(id, id))))> c => c'
; <attrs(filter(not(dettag2(id, id))))> c => c'
; ((<prod(id,id,at-pp(?pl))> prod(a, b, c')
; !pl
; rec x([Pathed(None,id)|id]; Hd <+ \ [_|l] -> l \; x)
......@@ -129,7 +150,7 @@ rules
; conc
; !(H([SOpt(HS,"0")],<id>))))
; ?pp
; <attrs(keep(not(BoxedAttr(id))))> c'
; <attrs(filter(not(BoxedAttr(id))))> c'
; attrs(\ x -> [BoxedAttr(pplist(pp))|x] \) => c''
strategies
......
[
dettag2 -- H hs=0[KW["dettag("] _1 KW[","] _2 KW[")"]],
dettag -- H hs=0[KW["dettag("] _1 KW[")"]]
]
include $(top_srcdir)/config/Makefile.xt
pkgdata_DATA = DetBoxedSdf-pretty.pp.af
sdfdata_DATA = DetBoxedSdf-pretty.pp
EXTRA_DIST = DetBoxedSdf-pretty.pp
CLEANFILES = DetBoxedSdf-pretty.pp.af
%%
%% DetGen
%% Copyright (C) 2003 LRDE
%%
%% 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; 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
%%
%%
%% This is the grammar extension of DetGen.
%%
%% Author: Valentin David <valentin@lrde.epita.fr>
%%
module DetBoxedSdf
imports BoxedSdf2
exports
context-free syntax
"dettag" "(" SdfLiteral ")" -> Attribute {cons("dettag")}
"dettag" "(" SdfLiteral "," NatCon ")" -> Attribute {cons("dettag")}
"dettag" "(" SdfLiteral "," NatCon ")" -> Attribute {cons("dettag2")}
include $(top_srcdir)/config/Makefile.xt
-include det-gen.c.dep
-include parse-detboxedsdf.c.dep
-include pp-detboxedsdf.c.dep
bin_PROGRAMS = det-gen parse-detboxedsdf
bin_PROGRAMS = det-gen parse-detboxedsdf pp-detboxedsdf
SCFLAGS = --main $* --verbose 0
STRINCLUDES = -I $(XTC)/share/xtc
BOOTCLEANFILES = det-gen.c parse-detboxedsdf.c
CLEANFILES = det-gen.c.dep parse-detboxedsdf.c.dep
EXTRA_DIST = det-gen.str parse-detboxedsdf.str
BOOTCLEANFILES = det-gen.c parse-detboxedsdf.c pp-detboxedsdf.c
CLEANFILES = det-gen.c.dep parse-detboxedsdf.c.dep pp-detboxedsdf.c.dep
EXTRA_DIST = det-gen.str parse-detboxedsdf.str pp-detboxedsdf.str
/**
* DetGen
* Copyright (C) 2003 LRDE
*
* 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; 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
*
* Give a definition of grammar as input, it will generate the corresponding
* extension grammar module as output.
*
* Author: Valentin David <valentin@lrde.epita.fr>
*/
module det-gen
imports xtc-lib stratego-xt-xtc-tools
strategies
det-gen =
xtc-io-wrap(import-option,
xtc-transform(!"parse-detboxedsdf")
......
/**
* DetGen
* Copyright (C) 2003 LRDE
*
* 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; 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
*
* DetGen parser.
*
* Author: Valentin David <valentin@lrde.epita.fr>
*/
module parse-detboxedsdf
imports xtc-lib stratego-xt-xtc-tools
strategies
parse-detboxedsdf =
xtc-io-wrap(
xtc-sglr(!"DetBoxedSdf.tbl")
......
/**
* DetGen
* Copyright (C) 2003 LRDE
*
* 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; 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
*
* DetGen pretty-printer.
*
* Author: Valentin David <valentin@lrde.epita.fr>
*/
module pp-detboxedsdf
imports xtc-lib stratego-xt-xtc-tools
strategies
pp-detboxedsdf =
xtc-io-wrap(
xtc-transform(!"ast2abox", ![
"-p", <xtc-find> "sdf.cons.pp.af",
"-p", <xtc-find> "Box.pp.af",
"-p", <xtc-find> "pp-table.pp.af",
"-p", <xtc-find> "BoxedSdf2-pretty.pp.af",
"-p", <xtc-find> "DetBoxedSdf-pretty.pp.af"])
; xtc-abox-format
; xtc-abox2text
)
Supports Markdown
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