-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
270 lines (240 loc) · 9.48 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
---
layout: default
---
<div class="center section header">
<p><img class="grow" width="300" src="img/bnfc-logo.png" alt="BNFC logo" /></p>
<p><a href="http://www.clt.gu.se/">Centre for Language Technology</a></p>
<p>Chalmers University of Technology and University of Gothenburg</p>
</div>
<div class="row section">
<div class="col-md-6">
<h2>What is the BNF Converter?</h2>
<p>The BNF Converter is a compiler construction tool generating a compiler
front-end from a <b>Labelled BNF grammar</b>. It is currently
generating code for the target languages
Haskell, Agda, C, C++, Java, and OCaml,
as well as XML representations and Pygment syntax highlighters.
</p>
<p>Given a <b>Labelled BNF grammar</b> the tool produces:</p>
<ul>
<li>an <i>abstract syntax</i> implementation in the target language,</li>
<li>a case skeleton for the abstract syntax in the target language,</li>
<li>a <i>pretty-printer</i> in the target language,</li>
<li>an <a href="http://www.haskell.org/alex">Alex</a>,
<a href="http://www.cs.princeton.edu/~appel/modern/java/JLex/">JLex</a>, <a href="https://v2.ocaml.org/manual/lexyacc.html">Ocamllex</a>
or <a href="http://flex.sourceforge.net/">Flex</a> <i>lexer</i> generator file ,</li>
<li>a <a href="http://www.haskell.org/happy">Happy</a>,
<a href="http://www2.cs.tum.edu/projects/cup/">CUP</a>,
<a href="https://v2.ocaml.org/manual/lexyacc.html">Ocamlyacc</a>,
<a href="http://gallium.inria.fr/~fpottier/menhir/">Menhir</a>,
<a href="http://antlr.org/">ANTLR</a>
or <a href="http://www.gnu.org/software/bison/bison.html">Bison</a>
<i>parser</i> generator file, and</li>
<li>a LaTeX file containing a <i>readable specification</i> of the
language.</li>
</ul>
</div>
<div id="download-box" class="col-md-6">
<h2>Download</h2>
<ul class="nav nav-tabs" role="tablist" id="downloadTab">
<li class="active"><a href="#github" data-toggle="tab">From GitHub releases</a></li>
<li><a href="#packages" data-toggle="tab">From this server</a></li>
<li><a href="#stack" data-toggle="tab">Stack</a></li>
<li><a href="#cabal" data-toggle="tab">Cabal</a></li>
<li><a href="#git" data-toggle="tab">dev</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active text-center" id="github">
<a href="{{ site.urls.github }}/releases" class="btn btn-primary btn-lg">Download (linux, mac, windows)</a>
</div>
<div class="tab-pane text-center" id="packages">
<a href="{{ site.urls.download }}" class="btn btn-primary btn-lg">Download (linux, mac, windows)</a>
</div>
<div class="tab-pane" id="stack">
<p>Install via stack from Stackage:</p>
<pre>$ stack install BNFC</pre>
</div>
<div class="tab-pane" id="cabal">
<p>Install by Cabal from Hackage:</p>
<pre>$ cabal install BNFC</pre>
</div>
<div class="tab-pane" id="git">
<p>Current development version (source repository on <a href="{{ site.urls.github }}">GitHub</a>)</p>
<pre>$ git clone {{ site.urls.github }}</pre>
</div>
</div>
</div>
</div>
<!-- Here starts the three columns row containing new, resources and book-->
<div class="row section">
<div class="col-md-3">
<h2>News</h2>
<p>Find the latest releases at <a href="{{ site.urls.github }}/releases">{{ site.urls.github }}/releases</a>.</p>
{% for news in site.posts limit:10 %}
<p>
{% if news.version %}
<a href="{{ news.url }}"><strong>BNFC release {{ news.version }}</strong></a>
{% elsif news.title %}
<a href="{{news.link}}"><strong>{{ news.title }}</strong></a>
{% endif %}
<span class="text-right text-muted">{{news.date | date: "%Y-%m-%d" }}</span>
</p>
{% endfor %}
</div>
<div class="col-md-3 col-md-offset-1">
<h2>Resources</h2>
<h3>Documentation</h3>
<ul>
<li><a href="https://bnfc.readthedocs.io">User Manual</a> on Read the Docs (HTML)</li>
<li><a href="tutorial/bnfc-tutorial.html">Tutorial</a> (a bit dated)
(<a target="_blank" href="https://github.com/BNFC/bnfc.github.com/tree/master/tutorial">Files</a>)</li>
<li><a href="https://bnfc.readthedocs.io/en/latest/lbnf.html">LBNF Reference Manual</a>
(also as <a href="LBNF-report.pdf">PDF from 2005</a>)</li>
<li><a href="http://www.grammaticalframework.org/ipl-book/">IPL book</a></li>
</ul>
<h3>Mailing list</h3>
<p>Send questions, bug reports, usage news, etc, to our
<a href="{{site.urls.googlegroup}}">Google group</a>.
</p>
</div>
<div class="col-md-3 col-md-offset-1">
<h2>Book</h2>
<div class="center">
<img style="max-width:60%" alt="Book cover" src="img/ipl-cover.png" />
<p><a href="http://www.grammaticalframework.org/ipl-book/">Implementing Programming Languages</a>, a compiler book using BNFC.</p>
</div>
</div>
</div>
<h2>A small example</h2>
<div class="row">
<div class="col-md-4">
Content of file <code>Calc.cf</code>:
<table style="border: none;">
<!-- <tr><td colspan=7>Content of file <code>Calc.cf</code>.</td></tr> -->
<tr>
<td style="color:#586e75" colspan="7">-- Calc.cf: A grammar for arithmetical expressions</td>
</tr>
<tr>
<td style="color:#586e75">EAdd.</td>
<td style="color:#b58900">Exp</td>
<td style="color:#859900">::=</td>
<td style="color:#b58900">Exp</td>
<td style="color:#cb4b16">"+"</td>
<td style="color:#b58900">Exp1</td>
<td>;</td>
</tr>
<tr>
<td style="color:#586e75">ESub.</td>
<td style="color:#b58900">Exp</td>
<td style="color:#859900">::=</td>
<td style="color:#b58900">Exp</td>
<td style="color:#cb4b16">"-"</td>
<td style="color:#b58900">Exp1</td>
<td>;</td>
</tr>
<tr>
<td style="color:#586e75">EMul.</td>
<td style="color:#b58900">Exp1</td>
<td style="color:#859900">::=</td>
<td style="color:#b58900">Exp1</td>
<td style="color:#cb4b16">"*"</td>
<td style="color:#b58900">Exp2</td>
<td>;</td>
</tr>
<tr>
<td style="color:#586e75">EDiv.</td>
<td style="color:#b58900">Exp1</td>
<td style="color:#859900">::=</td>
<td style="color:#b58900">Exp1</td>
<td style="color:#cb4b16">"/"</td>
<td style="color:#b58900">Exp2</td>
<td>;</td>
</tr>
<tr>
<td style="color:#586e75">EInt.</td>
<td style="color:#b58900">Exp2</td>
<td style="color:#859900">::=</td>
<td style="color:#b58900">Integer</td>
<td colspan="3">;</td>
</tr>
<tr>
<td>coercions</td>
<td style="color:#b58900">Exp</td>
<td>2</td>
<td colspan="4">;</td>
</tr>
</table>
</div>
<div class="col-md-4">
Generate a parser (choose your backend):
<!-- Generate a parser by either of these invokations of <code>bnfc</code> and <code>make</code>: -->
<pre>
bnfc --haskell -d -m Calc.cf && make
bnfc --agda -d -m Calc.cf && make
bnfc --c -m Calc.cf && make
bnfc --cpp -m Calc.cf && make
bnfc --java -m Calc.cf && make
bnfc --java-antlr -m Calc.cf && make
bnfc --ocaml -m Calc.cf && make
bnfc --ocaml-menhir -m Calc.cf && make
</pre>
</div>
<div class="col-md-4">
Run the test parser, generated e.g. with `--haskell`:
<pre>
echo "1 + 2 * 3 - 4 / 5" | Calc/Test
</pre>
</div>
<div class="col-md-4">
BNFC functionality overview:
<img width="200" src="img/bnfc.png" alt="BNFC code generator graph" />
</div>
</div>
<h2>Large examples</h2>
<p>
A <a href="{{ site.urls.github }}/blob/master/examples/C/C.cf">grammar of C</a> with
an <a href="{{ site.urls.github }}/blob/master/examples/C/runtime.c">example C file</a>.
</p>
<p>
A <a href="{{ site.urls.github }}/blob/master/examples/Alfa/Alfa.cf">grammar of Alfa</a>
with an <a href="{{ site.urls.github }}/blob/master/examples/Alfa/Sorting.alfa">example Alfa file</a>.
(For more details, see the <a href="http://cth.altocumulus.org/~hallgren/Alfa/">Alfa home page</a>.)
</p>
<p>
A <a href="{{ site.urls.github }}/blob/master/examples/LBNF/LBNF.cf">grammar of LBNF</a>.
It is at the same time an example LBNF file.
The <a href="{{ site.urls.github }}/blob/master/source/src/BNF.cf">development version</a>
of this grammar is used in the implementation of the BNF Converter.<br>
<p>
</p>
A <a href="http://people.cs.uchicago.edu/~mrainey/java.cf">grammar of Java 1.1</a>
developed by <a href="http://people.cs.uchicago.edu/~mrainey/">Mike Rainey</a>.
</p>
<h2>Authors</h2>
© Andreas Abel, Jonas Almström Duregård, Krasimir Angelov,
Jean-Philippe Bernardy, Björn Bringert, Johan Broberg, Kyle Butt,
Paul Callaghan,
Grégoire Détrez,
Markus Forsberg, Ola Frid,
Peter Gammie,
Thomas Hallgren, Pascal Hof, Simon Huber,
Patrik Jansson, Kristofer Johannisson,
Antti-Juhani Kaijanaho,
Andreas Lööw,
Justin Meiners, Kent Mein,
Ulf Norell,
Gabriele Paganelli, Michael Pellauer,
Fabian Ruch, and
Aarne Ranta 2002 - 2021.
<h2>License</h2>
<p>
Free software under the
<a href="https://opensource.org/licenses/BSD-3-Clause">BSD 3-clause</a>
license.
<p>
Versions until 2.8.4 released under the
GNU General Public License
(<a href="https://www.gnu.org/licenses/gpl-2.0.html">GPL</a>).
<br/>
<br/> <!-- some extra vertical space at the end of the page -->
</p>