summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/context/third/bnf/NEWS28
-rw-r--r--Master/texmf-dist/doc/context/third/bnf/README39
-rw-r--r--Master/texmf-dist/doc/context/third/bnf/t-bnf.pdfbin0 -> 280331 bytes
-rw-r--r--Master/texmf-dist/tex/context/third/bnf/t-bnf.tex195
-rw-r--r--Master/texmf-dist/tpm/t-bnf.tpm31
-rw-r--r--Master/tlpkg/tlpsrc/collection-context.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/context-bnf.tlpsrc4
7 files changed, 298 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/context/third/bnf/NEWS b/Master/texmf-dist/doc/context/third/bnf/NEWS
new file mode 100644
index 00000000000..2849b0784c1
--- /dev/null
+++ b/Master/texmf-dist/doc/context/third/bnf/NEWS
@@ -0,0 +1,28 @@
+
+
+ BNF Module News
+
+
+
+VERSION 0.3
+
+ Nothing more than a clean-up of the project tree. Although the autotools
+ setup was working OK it was more confusing than helpful. People tend to
+ install these kinds of things in a much more ad hoc manner anyway.
+
+
+
+VERSION 0.2
+
+
+ Total rewrite of the logic. Much easier to specify grammars, as the need for
+ commas and full-stops has been lifted. Furthermore, there is now an
+ alternative way of specifying non-terminals, using '-pairs instead. The
+ output is a lot nicer now as well, albeit not as compact as before.
+
+
+
+VERSION 0.1
+
+
+ Initial release, nothing much to report here.
diff --git a/Master/texmf-dist/doc/context/third/bnf/README b/Master/texmf-dist/doc/context/third/bnf/README
new file mode 100644
index 00000000000..891661832f9
--- /dev/null
+++ b/Master/texmf-dist/doc/context/third/bnf/README
@@ -0,0 +1,39 @@
+
+
+ BNF Module README
+
+
+INTRODUCTION
+
+
+ The t-bnf module implements a way to easily write BNF grammars in CONTEXT.
+ Let's look at an example BNF grammar in a document:
+
+ \starttext
+
+ Here's a \BNF\ grammar. Enjoy.
+
+ \placebnfgrammar
+ [here]
+ [bnf:test]
+ {A test of the \BNF\ module}
+ {\startbnfgrammar[]
+ <S>: a<S>b
+ <S>: $\epsilon$
+ \stopbnfgrammar}
+
+ Which will match the language $L = \{\,a^nb^n \mid n \geq 0\,\}$.
+
+ \stoptext
+
+ You may try to generate module documenation embedded in t-bnf.tex with texexec
+ as well:
+
+ % texexec --interface=en --module --pdf t-bnf.tex
+
+ If you have any issues with creating the documentation this may be a result
+ of lacking the proper language format. You can look up the proper
+ information for generating these formats in minstall.pdf at PRAGMA-ADEs site
+ (http://www.pragma-ade.com/).
+
+ Enjoy!
diff --git a/Master/texmf-dist/doc/context/third/bnf/t-bnf.pdf b/Master/texmf-dist/doc/context/third/bnf/t-bnf.pdf
new file mode 100644
index 00000000000..863553fadc9
--- /dev/null
+++ b/Master/texmf-dist/doc/context/third/bnf/t-bnf.pdf
Binary files differ
diff --git a/Master/texmf-dist/tex/context/third/bnf/t-bnf.tex b/Master/texmf-dist/tex/context/third/bnf/t-bnf.tex
new file mode 100644
index 00000000000..3f40c3e7971
--- /dev/null
+++ b/Master/texmf-dist/tex/context/third/bnf/t-bnf.tex
@@ -0,0 +1,195 @@
+%D \module
+%D [ file=t-bnf,
+%D version=2004.6.23,
+%D title=\CONTEXT\ BNF Grammar Module,
+%D subtitle=Grammars,
+%D author={Nikolai Weibull},
+%D date=\currentdate,
+%D copyright={Nikolai Weibull}]
+%C
+%C This module is NOT part of the \CONTEXT\ macro||package.
+%C This module is free software; you can redistribute it and/or modify
+%C it under the terms of the GNU General Public License as published by
+%C the Free Software Foundation; either version 2 of the License, or
+%C (at your option) any later version.
+%C
+%C This module is distributed in the hope that it will be useful,
+%C but WITHOUT ANY WARRANTY; without even the implied warranty of
+%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%C GNU General Public License for more details.
+%C
+%C You should have received a copy of the GNU General Public License
+%C along with this program; if not, write to the Free Software
+%C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+\writestatus{loading}{BNF Macros / Initialization}
+
+\unprotect
+
+%M \usemodule[bnf]
+%D We define a new system variable for our settings:
+
+\definesystemvariable{bnf}
+
+%D We need some constants for the multi||lingual interface,
+
+\startconstants english dutch
+ terminalstart: terminalstart terminalstart
+ terminalstop: terminalstop terminalstop
+ nonterminalstart: nonterminalstart nonterminalstart
+ nonterminalstop: nonterminalstop nonterminalstop
+ is: is worden
+\stopconstants
+
+%D and while we're at it, lets define some variables.
+
+\startvariables english dutch
+ bnfgrammar: bnfgrammar bnfspraakleer
+ bnfgrammars: bnfgrammars bnfspraakleer
+\stopvariables
+
+%D Finally, we want the commands to be multi||lingually accessible, so we set
+%D that up as well:
+
+\startcommands english dutch
+ setupbnfgrammar: setupbnfgrammar stelbnfspraakleer
+ startbnfgrammar: startbnfgrammar startbnfspraakleer
+ stopbnfgrammar: stopbnfgrammar startbnfspraakleer
+\stopcommands
+
+%D \macros
+%D {startbnfgrammar, stopbnfgrammar}
+%D
+%D Now to the interesting parts, those that are actually useful to the outside
+%D world. First we have the \type{\startbnfgrammar} and \type{\stopbnfgrammar}
+%D pairs, which are of course used to delimit \BNF\ grammars. We would like to
+%D define \type{\startbnfgrammar} as \type{\def\startbnfgrammar[#1]}, but a bug
+%D in \CONTEXT\ prevents us from doing this, as the first character in the
+%D grammar may be active, for example \type{<}, but while checking for the
+%D presence of \type{[}, it gets ruined. A way around it is of course to
+%D require that the user pass an empty \type{[]} pair, and we will use this
+%D method at the moment.
+
+\def\complexstartbnfgrammar[#1]%
+ {\endgraf\nobreak\medskip
+ \begingroup
+ \setupbnfgrammar[#1]%
+ \chardef\bnfsinglequote=`'
+ \defineactivecharacter : {\@@bnfis}
+ \defineactivecharacter | {\@@bnfoption}
+ \defineactivecharacter " %
+ {\thinspace\bgroup\@@bnfterminalstart\setupinlineverbatim%
+ \defineactivecharacter " {\@@bnfterminalstop\egroup\thinspace}}
+ \defineactivecharacter ' %
+ {\thinspace\bgroup\@@bnfterminalstart\setupinlineverbatim%
+ \defineactivecharacter ' {\@@bnfterminalstop\egroup\thinspace}}
+ \catcode`<=13
+ \let\par=\bnfgrammarline
+ \obeylines}
+
+\def\stopbnfgrammar{\medbreak\checknextindentation[\@@bnfindentnext]}
+
+\definecomplexorsimpleempty\startbnfgrammar
+
+%D \macros
+%D {<>,bnfgrammarrule}
+%D
+%D We need a couple more macros to deal with the interior of a \BNF\ grammar.
+%D \type{\<>} is used for non||terminals, and \type{\bnfgrammarrule} is used
+%D later on in \type{\bnfgrammarswitch} for continuing a line.
+
+\def\<#1>{\leavevmode\hbox{\@@bnfnonterminalstart#1\/\@@bnfnonterminalstop}}
+
+\bgroup
+ \catcode`<=13
+ \global\let<=\<
+ \gdef\bnfgrammarrule<#1>{\endgraf\indent\<#1>}
+\egroup
+
+%D \macros
+%D {bnfgrammarline, bnfgrammarswitch, bnfgrammarcont}
+%D
+%D These macros deal with the ending of a line in a grammar.
+%D \type{\bnfgrammarline} is called whenever a new line begins, and invokes
+%D \type{\bnfgrammarswitch} to determine what to do next. If the next token is
+%D \type{\<}, we will call upon \type{\bnfgrammarrule} to deal with the new
+%D rule. If it is \type{\stopbnfgrammar}, we end the top||level group, and let
+%D it process \type{\stopbnfgrammar} afterwards. Otherwise we invoke
+%D \type{\bnfgrammarcont}, which will end the line and add some indentation to
+%D the continuing line.
+
+\def\bnfgrammarline{\futurelet\next\bnfgrammarswitch}
+\def\bnfgrammarswitch%
+ {\ifx\next\<
+ \let\next=\bnfgrammarrule
+ \else\ifx\next\stopbnfgrammar
+ \let\next=\endgroup
+ \else
+ \let\next=\bnfgrammarcont
+ \fi\fi
+ \next}
+\def\bnfgrammarcont{\hfil\break\indent\qquad}
+
+%D \macros
+%D {setupbnfgrammar}
+%D
+%D We want to allow our users to change the way the \BNF\ grammars are typeset,
+%D so we define a setup command for them to use.
+%D
+%D It allows you to define the start and stop sequence for terminals and
+%D non||terminals, as well as colons (lhs / rhs separator) and vertical bars
+%D (alternative), and commas. This has been multi||lingualized above, so
+%D choose your language.
+
+\def\dosetupbnfgrammar[#1]%
+ {\getparameters[\??bnf][#1]}
+
+\def\setupbnfgrammar%
+ {\dosingleargument\dosetupbnfgrammar}
+
+\setupbnfgrammar
+ [\c!terminalstart=\tttf,
+ \c!terminalstop=,
+ \c!nonterminalstart=\mathematics{\langle},
+ \c!nonterminalstop=\mathematics{\rangle},
+ \c!is={ \mathematics{\longrightarrow}},
+ \c!option=\mathematics{\vert},
+ \c!indentnext=\v!no]
+
+%D \macros
+%D {BNF}
+%D
+%D We also define a useful abbreviation to be used for header texts and labels.
+
+\logo[BNF]{bnf}
+
+%D And we use it here:
+
+\setupheadtext[\s!en][\v!bnfgrammar=\BNF\ Grammar]
+\setupheadtext[\s!en][\v!bnfgrammars=\BNF\ Grammars]
+\setuplabeltext[\s!en][\v!bnfgrammar=\BNF\ Grammar ]
+
+%D Finally we define a float to be use with \BNF\ grammars, so that we can
+%D finish off with something like this:
+%D
+%D \startbuffer
+%D \placebnfgrammar
+%D [][]
+%D {An example of a placed grammar.}
+%D {\startbnfgrammar[]
+%D <exp>: <num> | <num> "+" <num>
+%D <num>: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
+%D \stopbnfgrammar}
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D \getbuffer
+%D
+%D which looks kind of nice.
+
+\definefloat
+ [\v!bnfgrammar]
+ [\v!bnfgrammars]
+
+\protect \endinput
diff --git a/Master/texmf-dist/tpm/t-bnf.tpm b/Master/texmf-dist/tpm/t-bnf.tpm
new file mode 100644
index 00000000000..9b982d87393
--- /dev/null
+++ b/Master/texmf-dist/tpm/t-bnf.tpm
@@ -0,0 +1,31 @@
+<!DOCTYPE rdf:RDF SYSTEM "tpm.dtd">
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:TPM="http://texlive.dante.de/">
+ <rdf:Description about="http://dl.contextgarden.net/modules/t-bnf.zip">
+ <TPM:Name>t-bnf</TPM:Name>
+ <TPM:Type>Package</TPM:Type>
+ <TPM:Date>2006/08/09 13:35:10</TPM:Date>
+ <TPM:Version>2006.08.09</TPM:Version>
+ <TPM:Creator>now</TPM:Creator>
+ <TPM:Title>ConTeXt BNF Grammars</TPM:Title>
+ <TPM:Description>
+ The t-bnf module provides a way to easily write BNF grammars in ConTeXt
+ documents.
+ </TPM:Description>
+ <TPM:Author>Nikolai Weibull</TPM:Author>
+ <TPM:Size>289490</TPM:Size>
+ <TPM:Build/>
+ <TPM:RunFiles size="7585">
+tex/context/third/bnf/t-bnf.tex
+tpm/t-bnf.tpm
+ </TPM:RunFiles>
+ <TPM:DocFiles size="281905">
+doc/context/third/bnf/NEWS
+doc/context/third/bnf/README
+doc/context/third/bnf/t-bnf.pdf
+ </TPM:DocFiles>
+ <TPM:Requires>
+ <TPM:Package name="context"/>
+ </TPM:Requires>
+ <TPM:Provides>Package/t-bnf</TPM:Provides>
+ </rdf:Description>
+</rdf:RDF>
diff --git a/Master/tlpkg/tlpsrc/collection-context.tlpsrc b/Master/tlpkg/tlpsrc/collection-context.tlpsrc
index a8bc8b18382..b5221065eb9 100644
--- a/Master/tlpkg/tlpsrc/collection-context.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-context.tlpsrc
@@ -7,6 +7,7 @@ depend jmn
depend lmextra
depend bin-context
depend context-account
+depend context-bnf
depend context-french
depend collection-metapost
depend collection-basic
diff --git a/Master/tlpkg/tlpsrc/context-bnf.tlpsrc b/Master/tlpkg/tlpsrc/context-bnf.tlpsrc
new file mode 100644
index 00000000000..4bef9fccabb
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/context-bnf.tlpsrc
@@ -0,0 +1,4 @@
+name context-bnf
+category Package
+runpattern d texmf-dist/tex/context/third/bnf
+docpattern d texmf-dist/doc/context/third/bnf