-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.html
233 lines (165 loc) · 8.58 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
<!doctype html>
<!--[if lt IE 9]><html class="ie"><![endif]-->
<!--[if gte IE 9]><!--><html><!--<![endif]-->
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-G0NX9K3FP5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-G0NX9K3FP5');
</script>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ANTLR</title>
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" href="css/fontface/Droid-Sans/stylesheet.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/fontface/DejaVu-Sans-Mono/stylesheet.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/antlr.css" type="text/css" media="screen" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="scripts/selectivizr-min.js"></script>
<script src="scripts/cycle.js"></script>
<script src="scripts/rounded.js"></script>
<script src="scripts/watermark.js"></script>
<script type="text/javascript" src="scripts/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="scripts/source/jquery.fancybox.js?v=2.0.6"></script>
<link rel="stylesheet" type="text/css" href="scripts/source/jquery.fancybox.css?v=2.0.6" media="screen" />
</head>
<body>
<header>
<a id="index" href="index.html">ANTLR</a>
<nav>
<script src="scripts/topnav.js"></script>
</nav>
</header>
<div id="wrapper">
<div id="home"><!--this div provides the light background section on the homepage-->
<div id="container">
<div id="main">
<div class="col3" id="whatis">
<h2>What is ANTLR?</h2>
<p><strong>ANTLR</strong> (ANother Tool for Language Recognition) is a
powerful parser generator for reading, processing, executing, or
translating structured text or binary files. It's widely used to build
languages, tools, and frameworks. From a grammar, ANTLR generates a
parser that can build and walk parse trees.</p>
<div id="terence"><img src="images/terence.jpg" alt="terence" />
<strong>Terence Parr</strong> is a tech lead at Google and until 2022 was a professor of data science / computer science at Univ. of San Francisco. He is the maniac behind ANTLR and has been
working on language tools since 1989.<br><br><i>Check out Terence impersonating a machine learning droid: <a href="http://explained.ai">explained.ai</a></i>
</div>
</div><!--/col3-->
<div id="module">
<div style="border: .5px solid #DA443A; padding: 5px 5px">
<div style="font: 15px 'DroidSansBold'; padding: 10px 0; margin: 0 0 5px; color: #ec312e;">Quick Start
</div>
<div style="font: 13px 'DroidSansBold'">To try ANTLR immediately, jump to the <i>new</i> <u><a href="http://lab.antlr.org/" style="color: #C00">ANTLR Lab</a></u>!</div><br>
<div style="font-size: 14px">
To install locally, use <a href="https://github.com/antlr/antlr4-tools">antlr4-tools</a>, which installs Java and ANTLR if needed and creates <tt>antlr4</tt> and <tt>antlr4-parse</tt> executables:<br><br>
<pre>
<span class="dollar">$</span> <span class="cmd">pip</span> install antlr4-tools
</pre>
<br>
(Windows must add <tt>..\LocalCache\local-packages\Python310\Scripts</tt> to the <tt>PATH</tt>). See the <a href="https://github.com/antlr/antlr4/blob/master/doc/getting-started.md">Getting Started</a> doc. Paste the following grammar into file <tt>Expr.g4</tt> and, from that directory, run the <tt>antlr4-parse</tt> command. Hit control-D on Unix (or control-Z on Windows) to indicate end-of-input. A window showing the parse tree will appear.
<br><br>
<table border="0">
<tr>
<td valign="top" style="border-right: 1px solid darkgrey; padding-right: 10px">
<pre style="font-size: 12px">
<span style="color: #871F7C;">grammar</span> <span style="color:black">Expr</span>;
<span style="color: #00079C;">prog</span>: (<span style="color: #00079C;">expr</span> <span style="color: #498393;">NEWLINE</span>)* ;
<span style="color: #00079C;">expr</span>: <span style="color: #00079C;">expr</span> ('*'|'/') <span style="color: #00079C;">expr</span>
| <span style="color: #00079C;">expr</span> ('+'|'-') <span style="color: #00079C;">expr</span>
| <span style="color: #498393;">INT</span>
| '(' <span style="color: #00079C;">expr</span> ')'
;
<span style="color: #498393;">NEWLINE</span> : [\r\n]+ ;
<span style="color: #498393;">INT</span> : [0-9]+ ;
</pre>
</td>
<td valign="top" style="font-size: 12px; border-right: 1px solid darkgrey; padding-right: 10px; padding-left: 10px">
<pre>
<span class="dollar">$</span> <span class="cmd">antlr4-parse</span> Expr.g4 prog -gui
10+20*30
<i>^D</i>
<span class="dollar">$</span> <span class="cmd">antlr4</span> Expr.g4 # gen code
<span class="dollar">$</span> <span class="cmd">ls</span> ExprParser.java
ExprParser.java
</pre>
</td>
<td style="padding-left: 10px" valign="top">
<img src="images/sample3.png" alt="sample3" width="130"/>
</td>
</tr>
</table>
</div>
</div>
</div> <!-- module -->
</div><!--/main-->
<section><!--home only-->
<div class="col3" id="latest-news">
<h2>Latest News</h2>
<a class="twitter-timeline" href="https://twitter.com/the_antlr_guy" data-widget-id="373882077285871616">Tweets by @the_antlr_guy</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<div class="dot-pager" id="pager-tw"></div>
</div><!--/col3-->
<div class="col3" id="testimonials">
<h2><a href="testimonials.html">Testimonials</a></h2>
<div id="tests">
<div class="testimonial">
Kudos. I'm actually really liking ANTLR! I have a pretty darn good
velocity with a rapid prototyping project I am doing in my Google 20%
time. For example, I just discovered a feature in rewrite rules that
does exactly what I need (referencing previous rule ASTs, p. 174 in
your book). It took me about 5 minutes to get this to work and remove
an ugly wart from my grammar. Hats off!
<strong>Guido van Rossum, Inventor of Python</strong>
</div>
<div class="testimonial">
ANTLR is an exceptionally powerful and flexible tool for parsing
formal languages. At Twitter, we use it exclusively for query parsing
in Twitter search. Our grammars are clean and concise, and the
generated code is efficient and stable. The <a href="http://pragprog.com/titles/tpantlr2/the-definitive-antlr-4-reference">book</a> is our go-to
reference for ANTLR v4 -- engaging writing, clear descriptions and
practical examples all in one place.
<strong>Samuel Luckenbill, Senior Manager of Search Infrastructure, Twitter, inc.</strong>
</div>
<div class="testimonial">
Just wanted to take the opportunity to say thanks. ANTLR is a BIG
improvement over yacc/lex, and your support for it most
commendable. Managed to get my tired old brain around it in a
day. Nice work!
<strong>Brad Cox, Inventor of Objective-C</strong>
</div>
<a href="testimonials.html">More...</a>
<div class="testimonial">
</div>
</div><!--/tests-->
<div class="dot-pager" id="pager-te"></div>
</div><!--/col3-->
<div class="col3" id="resources">
<h2>Resources</h2>
<a href="http://pragprog.com/titles/tpantlr2/the-definitive-antlr-4-reference"><img src="images/tpantlr2.jpg"
width=110></a>
<a href="http://pragprog.com/titles/tpdsl/language-implementation-patterns"><img src="images/tpdsl.jpg"
width=110></a>
<br><br><a href="https://github.com/antlr/antlr4/blob/master/doc/getting-started.md">Getting started with ANTLR v4</a>
<br><br><a href="https://github.com/antlr/antlr4/blob/4.13.2/doc/index.md">ANTLR
Documentation</a>
<br><br><a href="/api">Runtime API Doc</a>
<br><br><a href="https://github.com/antlr/antlr4">Browse source tree (github)</a>
<br><br><a href="https://github.com/antlr/antlr4/blob/master/doc/faq/index.md">Frequently Asked Questions</a>
<br><br><a href="http://www.stringtemplate.org">StringTemplate template engine</a>
</div><!--/col3-->
</section>
</div><!--/container-->
<div class="clear"><!--necessary nudge--></div>
</div><!--/home-->
</div><!--/wrapper-->
<footer>
<script src="scripts/bottomnav.js"></script>
</footer>
<script src="scripts/functions.js"></script>
</body>
</html>