1[comment {-*- tcl -*- doctools manpage}]
2[manpage_begin doctoc_lang_syntax n 1.0]
3[copyright {2007-2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>}]
4[moddesc   {Documentation tools}]
5[titledesc {doctoc language syntax}]
6[category  {Documentation tools}]
7[description]
8[para]
9
10This document contains the formal specification of the syntax of the
11doctoc markup language, version 1.1 in Backus-Naur-Form. This document
12is intended to be a reference, complementing the
13[term {doctoc language command reference}].
14
15A beginner should read the much more informally written
16[term {doctoc language introduction}] first before trying to
17understand either this document or the command reference.
18
19
20[section Fundamentals]
21
22In the broadest terms possible the [term {doctoc markup language}] is
23like SGML and similar languages. A document written in this language
24consists primarily of markup commands, with text embedded into it at
25some places.
26
27[para]
28
29Each markup command is a just Tcl command surrounded by a matching
30pair of [const [lb]] and [const [rb]]. Which commands are available,
31and their arguments, i.e. syntax is specified in the
32[term {doctoc language command reference}].
33
34[para]
35
36In this document we specify first the lexeme, and then the syntax,
37i.e. how we can mix text and markup commands with each other.
38
39[section {Lexical definitions}]
40
41In the syntax rules listed in the next section
42
43[list_begin enumerated]
44[enum]
45<TEXT> stands for all text except markup commands.
46
47[enum]
48Any XXX stands for the markup command [lb]xxx[rb] including its
49arguments. Each markup command is a Tcl command surrounded by a
50matching pair of [const [lb]] and [const [rb]]. Inside of these
51delimiters the usual rules for a Tcl command apply with regard to word
52quotation, nested commands, continuation lines, etc.
53
54[enum]
55<WHITE> stands for all text consisting only of spaces, newlines,
56tabulators and the [cmd comment] markup command.
57[list_end]
58
59[section Syntax]
60
61The rules listed here specify only the syntax of doctoc documents. The
62lexical level of the language was covered in the previous section.
63
64[para]
65
66Regarding the syntax of the (E)BNF itself 
67
68[list_begin enumerated]
69[enum]
70The construct { X } stands for zero or more occurrences of X.
71[enum]
72The construct [lb] X [rb] stands for zero or one occurrence of X.
73[list_end]
74
75The syntax:
76
77[example {
78toc       = defs
79            TOC_BEGIN
80            contents
81            TOC_END  
82            { <WHITE> }
83
84defs      = { INCLUDE | VSET | <WHITE> }
85contents  = { defs entry } [ defs ]
86
87entry     = ITEM | division
88
89division  = DIVISION_START
90            contents
91            DIVISION_END
92}]
93
94
95[section {BUGS, IDEAS, FEEDBACK}]
96
97This document, will undoubtedly contain bugs and other problems.
98
99Please report such in the category [emph doctools] of the
100[uri {http://sourceforge.net/tracker/?group_id=12883} {Tcllib SF Trackers}].
101
102Please also report any ideas for enhancements you may have.
103
104[see_also doctoc_intro]
105[see_also doctoc_lang_intro]
106[see_also doctoc_lang_cmdref]
107[see_also doctoc_lang_faq]
108[keywords markup {semantic markup}]
109[keywords {doctoc markup} {doctoc language}]
110[keywords {doctoc syntax} {doctoc commands}]
111[manpage_end]
112