From 3a51a1bda55c5d7fad6b0c4fac2f99cbe53f03cc Mon Sep 17 00:00:00 2001 From: grammarware Date: Fri, 20 Nov 2009 18:07:04 +0000 Subject: [PATCH] raw (unfinished) EDD->DCG->RGF->BGF extractor git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@717 ab42f6e0-554d-0410-b580-99e487e6eeb2 --- shared/edd/slps-edd.sln | 2 ++ shared/xsl/edd2dcg.xslt | 28 +++++++++++++++++----------- shared/xsl/rgf2bgf.xslt | 23 +++++++++++++++++++++++ 3 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 shared/xsl/rgf2bgf.xslt diff --git a/shared/edd/slps-edd.sln b/shared/edd/slps-edd.sln index 2acf1ce7..83aa54db 100644 --- a/shared/edd/slps-edd.sln +++ b/shared/edd/slps-edd.sln @@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastru ProjectSection(SolutionItems) = preProject ..\xsd\edd.xsd = ..\xsd\edd.xsd ..\xsl\edd2dcg.xslt = ..\xsl\edd2dcg.xslt + ..\xsd\rgf.xsd = ..\xsd\rgf.xsd + ..\xsl\rgf2bgf.xslt = ..\xsl\rgf2bgf.xslt EndProjectSection EndProject Global diff --git a/shared/xsl/edd2dcg.xslt b/shared/xsl/edd2dcg.xslt index 52ab6e17..fe96cc4c 100644 --- a/shared/xsl/edd2dcg.xslt +++ b/shared/xsl/edd2dcg.xslt @@ -7,7 +7,7 @@ encoding="UTF-8" omit-xml-declaration="yes" /> - + grammar(g(Ps)) --> productions(Ps). productions([H|T]) --> production(H), productions(T). @@ -74,8 +74,7 @@ symbolchoices([S]) --> symbols(S). - symbol(opt(nt(N))) --> name(N), optionalitysymbol. -symbol(opt(br(S))) --> groupstart, symbolchoices(S), groupend, optionalitysymbol. + symbol(opt) --> optionalitysymbol. @@ -96,11 +95,19 @@ symbol(r(R,br(S))) --> groupstart, symbolchoices(S), groupend, repetition(R). - - symbol(t(Y)) --> terminalstart, string(V), {\+ member(34, V), string_to_list(Y,V)}, terminalend. + + + + + symbol(t(Y)) --> terminalstart, string(V), {\+ member(34, V), string_to_list(Y,V)}, terminalend. terminalstart --> [34]. terminalend --> [34]. + + + Unsupported terminal quoting! + + @@ -150,8 +157,7 @@ writesymbolchoices([H1,H2|T]) :- writesymbols(H1), writechoicesymbol, writesymbo writesymbolchoices([S]) :- writesymbols(S). writechoicesymbol :- write(''), nl. writeoptionalitysymbol :- write(''), nl. -writesymbol(opt(nt(N))) :- writent(N), writeoptionalitysymbol. -writesymbol(opt(br(S))) :- writegroupstart, writesymbolchoices(S), writegroupend, writeoptionalitysymbol. +writesymbol(opt) :- writeoptionalitysymbol. writesymbol(r(R,nt(N))) :- writent(N), writerepetition(R). writesymbol(r(R,br(S))) :- writegroupstart, writesymbolchoices(S), writegroupend, writerepetition(R). writerepetition(R) :- write(''), write(R), write(''), nl. @@ -218,9 +224,9 @@ eof([10|T],R) :- eof(T,R).]]> ( - - - + + + ; epsilon) @@ -253,4 +259,4 @@ eof([10|T],R) :- eof(T,R).]]> . - + \ No newline at end of file diff --git a/shared/xsl/rgf2bgf.xslt b/shared/xsl/rgf2bgf.xslt new file mode 100644 index 00000000..37c69c46 --- /dev/null +++ b/shared/xsl/rgf2bgf.xslt @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file