Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
timbl committed Jan 22, 2008
1 parent 18d4ad3 commit 586a2a0
Show file tree
Hide file tree
Showing 7 changed files with 2,641 additions and 767 deletions.
14 changes: 7 additions & 7 deletions grammar/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ n3-yacc.c : n3-selectors.n3-yacc.y

n3-selectors.n3-yacc.y : n3-selectors.n3

n3-checked.txt: n3-selectors.n3
n3-checked.txt: n3-selectors.n3 n3.n3
$(CG) --grammar=n3-selectors.n3 \
--as=http://www.w3.org/2000/10/swap/grammar/n3#document \
--parse=n3.n3 && touch $@

n3-selectors.n3 : n3.n3 bnf-rules.n3
time $P $C n3.n3 bnf-rules.n3 --think --purge --data --quiet > $@
n3-selectors.n3 : n3.n3 cfg2bnf.n3 bnf-rules.n3
time $P $C n3.n3 cfg2bnf.n3 bnf-rules.n3 --think --purge --data --quiet > $@

n3-i18n-selectors.n3 : n3-re.n3 bnf-rules.n3
time $P $C n3-re.n3 bnf-rules.n3 --think --purge --data --quiet > $@

n3-report.big: n3.n3 bnf2html.n3
time $P $C n3.n3 bnf2html.n3 --chatty=21 --think --data --quiet > $@
n3-report.big: n3.n3 bnf2html.n3 cfg2bnf.n3
time $P $C n3.n3 cfg2bnf.n3 bnf2html.n3 --chatty=21 --think --data --quiet > $@

n3-report.html : n3-report.big
time $P $C n3-report.big --strings > $@

n3-ietf.txt : n3-kludge.n3 bnf2ietf.n3
time $P $C ,n3-kludge.n3 bnf2ietf.n3 --chatty=21 --think --strings > $@
n3-ietf.txt : ,n3-kludge.n3 cfg2bnf.n3 bnf2ietf.n3
time $P $C ,n3-kludge.n3 cfg2bnf.n3 bnf2ietf.n3 --chatty=21 --think --strings > $@

,n3-kludge.n3: n3.n3
sed -e 's/\\[uU]/#x/g' < n3.n3 > ,n3-kludge.n3
Expand Down
27 changes: 11 additions & 16 deletions grammar/bnf-rules.n3
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,19 @@
@prefix string: <http://www.w3.org/2000/10/swap/string#>.
@keywords a, is, of.

#_____________________________________

# Shorthand expansion into BNF
<> rdfs:comment

"""This set of rules process a BNF graph in its basic
cfg:mustBeOneOf BNF form and create the branching tables to drive a
predictive parser.

See also cfg2bnf.n3 which expands the shothand ontology into the basic
BNF terms.
""".

#_____________________________________

#{ ?x bnf:zeroOrMore ?y } => {
# ?x bnf:mustBeOneSequence (
## ( )
# ( ?y ?x )
# )
#}.
#
#{ ?x bnf:mustBe ?y } => {?x bnf:mustBeOneSequence ((?y))}.
#
# Axioms relating the definite (open world) form to the indefinte (closed world)
#(better words?) form:
#
#{ ?x bnf:mustBe ?y } => { ?x bnf:mustBeOneSequence (( ?y )) }.
#

# Enumerate options:

Expand Down
15 changes: 13 additions & 2 deletions grammar/n3-ietf.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
barename ::= [A-Z_a-z#x00c0-#x00d6#x00d8-#x00f6#x00f8-#x02ff#x0370-#x037d#x037f-#x1fff#x200c-#x200d#x2070-#x218f#x2c00-#x2fef#x3001-#xd7ff#xf900-#xfdcf#xfdf0-#xfffd#x00010000-#x000effff][\-0-9A-Z_a-z#x00b7#x00c0-#x00d6#x00d8-#x00f6#x00f8-#x037d#x037f-#x1fff#x200c-#x200d#x203f-#x2040#x2070-#x218f#x2c00-#x2fef#x3001-#xd7ff#xf900-#xfdcf#xfdf0-#xfffd#x00010000-#x000effff]*
barename_csl ::= | barename barename_csl_tail
| void
barename_csl_tail ::= | "," barename barename_csl_tail
| void
boolean ::= | "@false"
| "@true"
decimal ::= [-+]?[0-9]+(\.[0-9]+)?
declaration ::= | "@base" explicituri
| "@keywords" barename_csl
| "@prefix" prefix explicituri
document ::= | statements_optional EOF
double ::= [-+]?[0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)
dtlang ::= | "@" langcode
| "^^" symbol
| void
existential ::=explicituri ::= <[^>]*>
existential ::= | "@forSome" symbol_csl
explicituri ::= <[^>]*>
expression ::= | pathitem pathtail
formulacontent ::= | statementlist
integer ::= [-+]?[0-9]+
Expand Down Expand Up @@ -56,7 +62,12 @@ string ::= ("""[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*""")|("[^"\\]*(?:\\.[^"\\]*)*")
subject ::= | expression
symbol ::= | explicituri
| qname
universal ::=verb ::= | "<="
symbol_csl ::= | symbol symbol_csl_tail
| void
symbol_csl_tail ::= | "," symbol symbol_csl_tail
| void
universal ::= | "@forAll" symbol_csl
verb ::= | "<="
| "="
| "=>"
| "@a"
Expand Down
Loading

0 comments on commit 586a2a0

Please sign in to comment.