Commit b1ba9c6d authored by david_v's avatar david_v
Browse files

from Valentin David <valentin@lrde.epita.fr>

	* lib/boxedsdf/Makefile.am: Update for the last boxedsdf syntax.

	* src/genfilters/Makefile.am, src/det2sdf/Makefile.am,
	* src/detgen/Makefile.am: Update include directories.

	* src/xtc/parse-detboxedsdf-definition.str,
	* src/xtc/parse-detboxedsdf-module.str,
	* src/detgen/detgen.str, src/lib/det-lib.str:
	Update to pgen-2.0 Sdf syntax.

	* src/syn/Makefile.am: Do not generate signature.
	* src/syn/DetBoxedSdf.str: New.
	* src/syn/unrename.sh: Delete.

	* test/Makefile.am: Add sdf-desugar pass.
	* test/d.str.ref, test/f.str.ref: Update.
parent 21de0000
2004-04-26 Valentin David <valentin@lrde.epita.fr>
* lib/boxedsdf/Makefile.am: Update for the last boxedsdf syntax.
* src/genfilters/Makefile.am, src/det2sdf/Makefile.am,
* src/detgen/Makefile.am: Update include directories.
* src/xtc/parse-detboxedsdf-definition.str,
* src/xtc/parse-detboxedsdf-module.str,
* src/detgen/detgen.str, src/lib/det-lib.str:
Update to pgen-2.0 Sdf syntax.
* src/syn/Makefile.am: Do not generate signature.
* src/syn/DetBoxedSdf.str: New.
* src/syn/unrename.sh: Delete.
* test/Makefile.am: Add sdf-desugar pass.
* test/d.str.ref, test/f.str.ref: Update.
2004-04-16 Valentin David <valentin@lrde.epita.fr>
* test/Makefile.am, config/Makefile.am, lib/Makefile.am,
......
......@@ -3,44 +3,48 @@
include $(top_srcdir)/config/Makefile.xt
SDFS = \
Alias-Sdf-Syntax.sdf \
ATerms.sdf \
Basic-Sdf-Syntax.sdf \
Box-Atoms.sdf \
Box-Base.sdf \
Box-Disambiguation.sdf \
BoxedSdf2.sdf \
Box-Layout.sdf \
Box-Lists.sdf \
Box-Literal.sdf \
Box-Operators.sdf \
Box.sdf \
CC-Sdf-Syntax.sdf \
Character-Class-Syntax.sdf \
Character-Syntax.sdf \
Grammar-Syntax.sdf \
IntCon.sdf \
Kernel-Sdf-Syntax.sdf \
Label-Sdf-Syntax.sdf \
Layout.sdf \
Literals.sdf \
Literals-Sdf-Syntax.sdf \
Modular-Sdf-Syntax.sdf \
pp-table-IntCon.sdf \
pp-table-PlaceHolder.sdf \
pp-table.sdf \
Priority-Sdf-Syntax.sdf \
RealCon.sdf \
Regular-Sdf-Syntax.sdf \
Renaming-Sdf-Syntax.sdf \
Restrictions-Sdf-Syntax.sdf \
Sdf-Disamb.sdf \
Sdf2-Syntax.sdf \
Sorts-Sdf-Syntax.sdf \
Symbols.sdf
Box-Atoms.sdf \
Box-Base.sdf \
Box-Disambiguation.sdf \
Box-Layout.sdf \
Box-Lists.sdf \
Box-Literal.sdf \
Box-Operators.sdf \
Box.sdf \
BoxedSdf2.sdf \
Sdf2.sdf \
basic/Comments.sdf \
basic/Whitespace.sdf \
languages/aterm/syntax/ATerms.sdf \
languages/aterm/syntax/IntCon.sdf \
languages/aterm/syntax/Literals.sdf \
languages/aterm/syntax/RealCon.sdf \
languages/sdf2/syntax/Aliases.sdf \
languages/sdf2/syntax/Basic.sdf \
languages/sdf2/syntax/CC.sdf \
languages/sdf2/syntax/Character-Class.sdf \
languages/sdf2/syntax/Character.sdf \
languages/sdf2/syntax/Grammars.sdf \
languages/sdf2/syntax/Kernel.sdf \
languages/sdf2/syntax/Labels.sdf \
languages/sdf2/syntax/Lifting.sdf \
languages/sdf2/syntax/Literals.sdf \
languages/sdf2/syntax/Modules.sdf \
languages/sdf2/syntax/Priority.sdf \
languages/sdf2/syntax/Regular.sdf \
languages/sdf2/syntax/Renaming.sdf \
languages/sdf2/syntax/Restrictions.sdf \
languages/sdf2/syntax/Sdf2-Syntax.sdf \
languages/sdf2/syntax/Sdf2.sdf \
languages/sdf2/syntax/Sorts.sdf \
languages/sdf2/syntax/Symbols.sdf \
pp-table-IntCon.sdf \
pp-table-PlaceHolder.sdf \
pp-table.sdf
noinst_DATA = $(SDFS)
CLEANFILES = $(SDFS)
$(SDFS): $(BUNDLED_BOXEDSDF)/share/boxedsdf/BoxedSdf2.def
$(SDF_TOOLS)/bin/unpack $(BUNDLED_BOXEDSDF)/share/boxedsdf/BoxedSdf2.def sdf
$(SDF_TOOLS)/bin/unpack-sdf \
-i $(BUNDLED_BOXEDSDF)/share/boxedsdf/BoxedSdf2.def
......@@ -6,7 +6,9 @@ include $(top_srcdir)/config/Makefile.xt
man_MANS = det2sdf.1
bin_PROGRAMS = det2sdf
SCFLAGS = --main $* --verbose 0
STRINCLUDES = -I $(top_builddir)/src/syn -I $(top_builddir)/config
STRINCLUDES = -I $(top_builddir)/src/syn \
-I $(top_builddir)/config \
-I $(BUNDLED_BOXEDSDF)/share/boxedsdf
CLEANFILES = det2sdf.{c.dep,c} $(man_MANS) det2sdf.inc
nodist_det2sdf_SOURCES = det2sdf.c
EXTRA_DIST = det2sdf.str
......
......@@ -7,6 +7,7 @@ libexec_PROGRAMS= detgen
SCFLAGS = --main $* --verbose 0
STRINCLUDES = -I $(top_builddir)/src/syn \
-I $(ASFIX_TOOLS)/share/asfix-tools \
-I $(BUNDLED_BOXEDSDF)/share/boxedsdf \
-I $(top_srcdir)/lib/ppgen \
-I $(top_srcdir)/src/lib
CLEANFILES = detgen.{c.dep,c}
......
......@@ -60,23 +60,26 @@ rules
; !pl
; rec x([Pathed(None,id)|id]; Hd <+ \ [_|l] -> l \; x)
; Pathed(id, \ x -> [H([SOpt(HS,"0")],l)]
where <concat> [[FBOX(KW,S(btag))],
where <concat> [[FBOX(KW,
S(<double-quote> btag))],
x,
[FBOX(KW,S(etag))]] => l \)
[FBOX(KW,
S(<double-quote> etag))]]
=> l \)
)
<+
// else generate the pp-entry.
(<prod(id,id,at-cons(un-double-quote))> prod(a, b, c')
; generate-pp-entries
( <generate-pp-entries> prod(a, b, c')
; Hd
; \ PP-Entry(_,b) -> Pathed(None,[H([SOpt(HS,"0")],b')])
where <concat> [[FBOX(KW,S(btag))],
where <concat> [[FBOX(KW,S(<double-quote> btag))],
b,
[FBOX(KW,S(etag))]] => b' \
[FBOX(KW,S(<double-quote> etag))]]
=> b' \
))
; ?pp
; <attrs(\ x -> [BoxedAttr(pplist(pp))|x] \)> c' => c''
ToDetProds : prod(a,b,c) -> [prod(a', b, c''),
prod(lit(btag),layout,attrs(reject)),
prod(lit(etag),layout,attrs(reject))]
......@@ -90,13 +93,14 @@ rules
; rec x([Pathed(None,id)|id]; Hd <+ \ [_|l] -> l \; x)
)
<+
(<prod(id,id,at-cons(un-double-quote))> prod(a, b, c')
; generate-pp-entries
( <generate-pp-entries> prod(a, b, c')
; Hd
; \ PP-Entry(_,b) -> Pathed(None, b) \
))
; Pathed(id, oncetd(Arg(where(try(string-to-int); ?i))
; !([FBOX(KW,S(btag))], [<id>], [FBOX(KW,S(etag))])
; !([FBOX(KW,S(<double-quote> btag))],
[<id>],
[FBOX(KW,S(<double-quote> etag))])
; conc
; !(H([SOpt(HS,"0")],<id>))))
; ?pp
......@@ -111,12 +115,12 @@ strategies
*/
det-gen-prods =
collect(prod(id,id,attrs(at-dettag(id) <+ at-dettag(id,id))))
; map(ToDetProds)
; map(debug(!"blah"); ToDetProds)
; concat
; !Module("Det",[],[Exports(context-free-syntax(<id>))])
; !'module("Det",[],['exports(context-free-syntax(<id>))])
detgen = det-iowrap((id, det-gen-prods)
; try((option-defined(Import(?imp)), id)
; (id,Module(?name; <concat-strings> [name, imp]
,![Imports([imp])],id))), import-option)
; (id,'module(?name; <concat-strings> [name, imp]
,!['imports([imp])],id))), import-option)
......@@ -7,6 +7,7 @@ libexec_PROGRAMS= genfilters
SCFLAGS = --main $* --verbose 0
STRINCLUDES = -I $(top_builddir)/src/syn \
-I $(ASFIX_TOOLS)/share/asfix-tools \
-I $(BUNDLED_BOXEDSDF)/share/boxedsdf \
-I $(top_srcdir)/src/lib
CLEANFILES = genfilters.{c.dep,c}
nodist_genfilters_SOURCES = genfilters.c
......
......@@ -69,7 +69,7 @@ strategies
mydrop(isn) = mynzip0(id); drop-until((isn,id)); map(Snd)
at-pp(s) = oncetd(BoxedAttr(pplist(s)))
at-cons(s) = oncetd(cons(s))
at-cons(s) = oncetd(term(cons(s)))
at-dettag(s1,s2) = oncetd(dettag2(s1,s2))
at-dettag(s) = oncetd(dettag(s))
......@@ -81,8 +81,7 @@ rules
*/
ToBegin : lit -> lit'
where <Beginize> lit
; ToLayout
; double-quote => lit'
; ToLayout => lit'
/**
* :: String -> String
......@@ -91,8 +90,7 @@ rules
*/
ToEnd : lit -> lit'
where <Endize> lit
; ToLayout
; double-quote => lit'
; ToLayout => lit'
strategies
......@@ -110,11 +108,11 @@ strategies
; <mydrop(?num)> a => end
; !(<concat> [h, h'], elt, end)
get-tags = attrs(at-dettag(un-double-quote; ?tag))
get-tags = attrs(at-dettag(qlit(un-double-quote; ?tag)))
; !tag
; !(<ToBegin>, <ToEnd>)
get-tags = attrs(at-dettag(un-double-quote; ?tag, id))
get-tags = attrs(at-dettag(qlit(un-double-quote; ?tag), id))
; !tag
; !(<ToBegin>, <ToEnd>)
......@@ -122,8 +120,7 @@ strategies
* This strategy try to find how to write comments.
*/
find-layout = where(
collect(prod([lit(un-double-quote),id,lit(un-double-quote)],
layout,id))
collect(prod([lit(id),id,lit(id)],layout,id))
; (Hd <+ !"No good comments in this grammar"; debug; giving-up)
; ?prod([lit(begin),_,lit(end)],_,_)
; rules(ToLayout : lit -> lit'
......
module DetBoxedSdf
imports BoxedSdf2
signature
constructors
dettag : SdfLiteral -> Attribute
dettag2 : SdfLiteral * NatCon -> Attribute
......@@ -2,42 +2,7 @@
include $(top_srcdir)/config/Makefile.xt
STRS = Alias-Sdf-Syntax.str \
ATerms.str \
Basic-Sdf-Syntax.str \
Box-Atoms.str \
Box-Base.str \
Box-Disambiguation.str \
Box-Layout.str \
Box-Lists.str \
Box-Literal.str \
Box-Operators.str \
Box.str \
BoxedSdf2.str \
CC-Sdf-Syntax.str \
Character-Class-Syntax.str \
Character-Syntax.str \
Grammar-Syntax.str \
IntCon.str \
Kernel-Sdf-Syntax.str \
Label-Sdf-Syntax.str \
Layout.str \
Literals-Sdf-Syntax.str \
Literals.str \
Modular-Sdf-Syntax.str \
pp-table-IntCon.str \
pp-table-PlaceHolder.str \
pp-table.str \
Priority-Sdf-Syntax.str \
RealCon.str \
Regular-Sdf-Syntax.str \
Renaming-Sdf-Syntax.str \
Restrictions-Sdf-Syntax.str \
Sdf-Disamb.str \
Sdf2-Syntax.str \
Sorts-Sdf-Syntax.str \
Symbols.str \
DetBoxedSdf.str
STRS = DetBoxedSdf.str
RTREES = $(STRS:.str=.rtree)
pkgdata_DATA = DetBoxedSdf.tbl DetBoxedSdf.def $(RTREES)
......@@ -45,7 +10,8 @@ sdfdata_DATA = DetBoxedSdf.sdf
PGEN_FLAGS = -m $*
SDFINCLUDES = -I $(top_builddir)/lib/boxedsdf
CLEANFILES = $(STRS) $(pkgdata_DATA)
EXTRA_DIST = DetBoxedSdf.sdf unrename.sh
EXTRA_DIST = DetBoxedSdf.sdf
#FIXME: Signature generation broken.
$(STRS): DetBoxedSdf.def
$(top_srcdir)/src/syn/unrename.sh $< | $(STRATEGO_TOOLS)/bin/sdf-to-sig
touch DetBoxedSdf.str
#!/bin/sh
#
# This script is used because of implosion problem with the Sdf grammar (there
# is no constructor name for the renamings)
#
# Author: Valentin David <valentin@lrde.epita.fr>
#
F=$1
while grep -q "^[[:space:]]*\[[[:space:]]*$" $F; do
BEGIN=`cat $F| grep -n "^[[:space:]]*\[[[:space:]]*$" | cut -d: -f1 | head -n 1`
END=`cat $F| grep -n "^[[:space:]]*][[:space:]]*$" | cut -d: -f1 | head -n 1`
cat $F | sed "${BEGIN},${END}d" >tmp1
mv tmp1 tmp
F=tmp
done
cat $F
rm tmp
......@@ -36,6 +36,7 @@ strategies
parse-detboxedsdf-definition =
xtc-io-wrap(
xtc-sglr(!"DetBoxedSdf.tbl", !"SDF-GrammarID")
xtc-sglr(!"DetBoxedSdf.tbl", !"SDF")
; xtc-implode-asfix
; xtc-transform(!"sdf-desugar", pass-verbose)
)
......@@ -35,6 +35,7 @@ strategies
parse-detboxedsdf-module =
xtc-io-wrap(
xtc-sglr(!"DetBoxedSdf.tbl", !"Module-GrammarID")
xtc-sglr(!"DetBoxedSdf.tbl", !"Module")
; xtc-implode-asfix
; xtc-transform(!"sdf-desugar", pass-verbose)
)
......@@ -20,17 +20,20 @@ CLEANFILES = \
gen.sdf: $(top_builddir)/src/syn/DetBoxedSdf.tbl $(srcdir)/Test.ppdef $(top_builddir)/src/detgen/detgen
$(ASFIX_TOOLS)/bin/sglri -p $(top_builddir)/src/syn/DetBoxedSdf.tbl \
-i $(srcdir)/Test.ppdef | \
$(SDF_TOOLS)/libexec/sdf-desugar | \
$(top_builddir)/src/detgen/detgen | \
$(BUNDLED_BOXEDSDF)/bin/pp-boxedsdf -o $@
f.str: $(top_builddir)/src/syn/DetBoxedSdf.tbl $(srcdir)/Test.ppdef $(top_builddir)/src/genfilters/genfilters
$(ASFIX_TOOLS)/bin/sglri -p $(top_builddir)/src/syn/DetBoxedSdf.tbl \
-i $(srcdir)/Test.ppdef | \
$(SDF_TOOLS)/libexec/sdf-desugar | \
$(top_builddir)/src/genfilters/genfilters -f | \
$(STRATEGO_FRONT)/bin/pp-stratego -a -o $@
d.str: $(top_builddir)/src/syn/DetBoxedSdf.tbl $(srcdir)/Test.ppdef $(top_builddir)/src/genfilters/genfilters
$(ASFIX_TOOLS)/bin/sglri -p $(top_builddir)/src/syn/DetBoxedSdf.tbl \
-i $(srcdir)/Test.ppdef | \
$(SDF_TOOLS)/libexec/sdf-desugar | \
$(top_builddir)/src/genfilters/genfilters -d | \
$(STRATEGO_FRONT)/bin/pp-stratego -a -o $@
......@@ -2,32 +2,25 @@ module Convert
imports lib asfix
rules
Tr :
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C"))], cf(sort("D")), ), [ , , , , ]) ->
appl(prod([lit("/*[foo]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),lit("/*[/foo]*/")], cf(sort("D")), ), [ appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 102 ]),char-class([ 111 ]),char-class([ 111 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[foo]*/"), no-attrs()), [ 47 , 42 , 91 , 102 , 111 , 111 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , , , , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 102 ]),char-class([ 111 ]),char-class([ 111 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/foo]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 102 , 111 , 111 , 93 , 42 , 47 ]) ])
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C"))], cf(sort("D")), ), [ , , , , ]) -> appl(prod([lit("/*[foo]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),lit("/*[/foo]*/")], cf(sort("D")), ), [ appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 102 ]),char-class([ 111 ]),char-class([ 111 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[foo]*/"), no-attrs()), [ 47 , 42 , 91 , 102 , 111 , 111 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , , , , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 102 ]),char-class([ 111 ]),char-class([ 111 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/foo]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 102 , 111 , 111 , 93 , 42 , 47 ]) ])
Tr :
appl(prod([cf(sort("A"))], cf(sort("D")), ), [ ]) ->
appl(prod([lit("/*[bar]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),lit("/*[/bar]*/")], cf(sort("D")), ), [ appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 97 ]),char-class([ 114 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[bar]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 97 , 114 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 97 ]),char-class([ 114 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/bar]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 97 , 114 , 93 , 42 , 47 ]) ])
appl(prod([cf(sort("A"))], cf(sort("D")), ), [ ]) -> appl(prod([lit("/*[bar]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),lit("/*[/bar]*/")], cf(sort("D")), ), [ appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 97 ]),char-class([ 114 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[bar]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 97 , 114 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 97 ]),char-class([ 114 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/bar]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 97 , 114 , 93 , 42 , 47 ]) ])
Tr :
appl(prod([], cf(sort("D")), ), [ ]) ->
appl(prod([lit("/*[baz]*/"),cf(opt(layout())),cf(opt(layout())),lit("/*[/baz]*/")], cf(sort("D")), ), [ appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 97 ]),char-class([ 122 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[baz]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 97 , 122 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 97 ]),char-class([ 122 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/baz]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 97 , 122 , 93 , 42 , 47 ]) ])
appl(prod([], cf(sort("D")), ), [ ]) -> appl(prod([lit("/*[baz]*/"),cf(opt(layout())),cf(opt(layout())),lit("/*[/baz]*/")], cf(sort("D")), ), [ appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 97 ]),char-class([ 122 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[baz]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 97 , 122 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 97 ]),char-class([ 122 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/baz]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 97 , 122 , 93 , 42 , 47 ]) ])
Tr :
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , , , , , ]) ->
appl(prod([cf(sort("A")),cf(opt(layout())),lit("/*[blah]*/"),cf(opt(layout())),[sort("B")],cf(opt(layout())),lit("/*[/blah]*/"),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 97 ]),char-class([ 104 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[blah]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 108 , 97 , 104 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 97 ]),char-class([ 104 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/blah]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 108 , 97 , 104 , 93 , 42 , 47 ]) , , , , ])
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , , , , , ]) -> appl(prod([cf(sort("A")),cf(opt(layout())),lit("/*[blah]*/"),cf(opt(layout())),[sort("B")],cf(opt(layout())),lit("/*[/blah]*/"),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 97 ]),char-class([ 104 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[blah]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 108 , 97 , 104 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 97 ]),char-class([ 104 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/blah]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 108 , 97 , 104 , 93 , 42 , 47 ]) , , , , ])
Tr :
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),lit("c"),cf(opt(layout())),cf(sort("D")),cf(opt(layout())),cf(sort("E"))], cf(sort("F")), ), [ , , , , , , ]) ->
appl(prod([cf(sort("A")),cf(opt(layout())),lit("c"),cf(opt(layout())),lit("/*[blih]*/"),cf(opt(layout())),[sort("D")],cf(opt(layout())),lit("/*[/blih]*/"),cf(opt(layout())),cf(sort("E"))], cf(sort("F")), ), [ , , , , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 105 ]),char-class([ 104 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[blih]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 108 , 105 , 104 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 105 ]),char-class([ 104 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/blih]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 108 , 105 , 104 , 93 , 42 , 47 ]) , , ])
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),lit("c"),cf(opt(layout())),cf(sort("D")),cf(opt(layout())),cf(sort("E"))], cf(sort("F")), ), [ , , , , , , ]) -> appl(prod([cf(sort("A")),cf(opt(layout())),lit("c"),cf(opt(layout())),lit("/*[blih]*/"),cf(opt(layout())),[sort("D")],cf(opt(layout())),lit("/*[/blih]*/"),cf(opt(layout())),cf(sort("E"))], cf(sort("F")), ), [ , , , , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 105 ]),char-class([ 104 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[blih]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 108 , 105 , 104 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 105 ]),char-class([ 104 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/blih]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 108 , 105 , 104 , 93 , 42 , 47 ]) , , ])
Tr :
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C"))], cf(sort("D")), ), [ , , , , ]) ->
appl(prod([lit("/*[foo2]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),lit("/*[/foo2]*/")], cf(sort("D")), ), [ appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 102 ]),char-class([ 111 ]),char-class([ 111 ]),char-class([ 50 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[foo2]*/"), no-attrs()), [ 47 , 42 , 91 , 102 , 111 , 111 , 50 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , , , , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 102 ]),char-class([ 111 ]),char-class([ 111 ]),char-class([ 50 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/foo2]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 102 , 111 , 111 , 50 , 93 , 42 , 47 ]) ])
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C"))], cf(sort("D")), ), [ , , , , ]) -> appl(prod([lit("/*[foo2]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),lit("/*[/foo2]*/")], cf(sort("D")), ), [ appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 102 ]),char-class([ 111 ]),char-class([ 111 ]),char-class([ 50 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[foo2]*/"), no-attrs()), [ 47 , 42 , 91 , 102 , 111 , 111 , 50 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , , , , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 102 ]),char-class([ 111 ]),char-class([ 111 ]),char-class([ 50 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/foo2]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 102 , 111 , 111 , 50 , 93 , 42 , 47 ]) ])
Tr :
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , , , , , ]) ->
appl(prod([cf(sort("A")),cf(opt(layout())),lit("/*[blah2]*/"),cf(opt(layout())),[sort("B")],cf(opt(layout())),lit("/*[/blah2]*/"),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 97 ]),char-class([ 104 ]),char-class([ 50 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[blah2]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 108 , 97 , 104 , 50 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 97 ]),char-class([ 104 ]),char-class([ 50 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/blah2]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 108 , 97 , 104 , 50 , 93 , 42 , 47 ]) , , , , ])
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , , , , , ]) -> appl(prod([cf(sort("A")),cf(opt(layout())),lit("/*[blah2]*/"),cf(opt(layout())),[sort("B")],cf(opt(layout())),lit("/*[/blah2]*/"),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 97 ]),char-class([ 104 ]),char-class([ 50 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[blah2]*/"), no-attrs()), [ 47 , 42 , 91 , 98 , 108 , 97 , 104 , 50 , 93 , 42 , 47 ]) , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , , appl(prod([], cf(opt(layout())), no-attrs()), [ ]) , appl(prod([char-class([ 47 ]),char-class([ 42 ]),char-class([ 91 ]),char-class([ 47 ]),char-class([ 98 ]),char-class([ 108 ]),char-class([ 97 ]),char-class([ 104 ]),char-class([ 50 ]),char-class([ 93 ]),char-class([ 42 ]),char-class([ 47 ])], lit("/*[/blah2]*/"), no-attrs()), [ 47 , 42 , 91 , 47 , 98 , 108 , 97 , 104 , 50 , 93 , 42 , 47 ]) , , , , ])
strategies
Convert =
iowrap(topdown(try(Tr)))
......@@ -2,32 +2,25 @@ module Convert
imports lib asfix
rules
Tr :
appl(prod([lit("/*[foo]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),lit("/*[/foo]*/")], cf(sort("D")), ), [ _ , _ , , , , , , _ , _ ]) ->
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C"))], cf(sort("D")), ), [ , , , , ])
appl(prod([lit("/*[foo]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),lit("/*[/foo]*/")], cf(sort("D")), ), [ _ , _ , , , , , , _ , _ ]) -> appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C"))], cf(sort("D")), ), [ , , , , ])
Tr :
appl(prod([lit("/*[bar]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),lit("/*[/bar]*/")], cf(sort("D")), ), [ _ , _ , , _ , _ ]) ->
appl(prod([cf(sort("A"))], cf(sort("D")), ), [ ])
appl(prod([lit("/*[bar]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),lit("/*[/bar]*/")], cf(sort("D")), ), [ _ , _ , , _ , _ ]) -> appl(prod([cf(sort("A"))], cf(sort("D")), ), [ ])
Tr :
appl(prod([lit("/*[baz]*/"),cf(opt(layout())),cf(opt(layout())),lit("/*[/baz]*/")], cf(sort("D")), ), [ _ , _ , _ , _ ]) ->
appl(prod([], cf(sort("D")), ), [ ])
appl(prod([lit("/*[baz]*/"),cf(opt(layout())),cf(opt(layout())),lit("/*[/baz]*/")], cf(sort("D")), ), [ _ , _ , _ , _ ]) -> appl(prod([], cf(sort("D")), ), [ ])
Tr :
appl(prod([cf(sort("A")),cf(opt(layout())),lit("/*[blah]*/"),cf(opt(layout())),[sort("B")],cf(opt(layout())),lit("/*[/blah]*/"),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , _ , _ , , _ , _ , , , , ]) ->
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , , , , , ])
appl(prod([cf(sort("A")),cf(opt(layout())),lit("/*[blah]*/"),cf(opt(layout())),[sort("B")],cf(opt(layout())),lit("/*[/blah]*/"),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , _ , _ , , _ , _ , , , , ]) -> appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , , , , , ])
Tr :
appl(prod([cf(sort("A")),cf(opt(layout())),lit("c"),cf(opt(layout())),lit("/*[blih]*/"),cf(opt(layout())),[sort("D")],cf(opt(layout())),lit("/*[/blih]*/"),cf(opt(layout())),cf(sort("E"))], cf(sort("F")), ), [ , , , , _ , _ , , _ , _ , , ]) ->
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),lit("c"),cf(opt(layout())),cf(sort("D")),cf(opt(layout())),cf(sort("E"))], cf(sort("F")), ), [ , , , , , , ])
appl(prod([cf(sort("A")),cf(opt(layout())),lit("c"),cf(opt(layout())),lit("/*[blih]*/"),cf(opt(layout())),[sort("D")],cf(opt(layout())),lit("/*[/blih]*/"),cf(opt(layout())),cf(sort("E"))], cf(sort("F")), ), [ , , , , _ , _ , , _ , _ , , ]) -> appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),lit("c"),cf(opt(layout())),cf(sort("D")),cf(opt(layout())),cf(sort("E"))], cf(sort("F")), ), [ , , , , , , ])
Tr :
appl(prod([lit("/*[foo2]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),lit("/*[/foo2]*/")], cf(sort("D")), ), [ _ , _ , , , , , , _ , _ ]) ->
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C"))], cf(sort("D")), ), [ , , , , ])
appl(prod([lit("/*[foo2]*/"),cf(opt(layout())),cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),lit("/*[/foo2]*/")], cf(sort("D")), ), [ _ , _ , , , , , , _ , _ ]) -> appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C"))], cf(sort("D")), ), [ , , , , ])
Tr :
appl(prod([cf(sort("A")),cf(opt(layout())),lit("/*[blah2]*/"),cf(opt(layout())),[sort("B")],cf(opt(layout())),lit("/*[/blah2]*/"),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , _ , _ , , _ , _ , , , , ]) ->
appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , , , , , ])
appl(prod([cf(sort("A")),cf(opt(layout())),lit("/*[blah2]*/"),cf(opt(layout())),[sort("B")],cf(opt(layout())),lit("/*[/blah2]*/"),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , _ , _ , , _ , _ , , , , ]) -> appl(prod([cf(sort("A")),cf(opt(layout())),cf(sort("B")),cf(opt(layout())),cf(sort("C")),cf(opt(layout())),cf(sort("D"))], cf(sort("E")), ), [ , , , , , , ])
strategies
Convert =
iowrap(topdown(try(Tr)))
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