-
Notifications
You must be signed in to change notification settings - Fork 13
/
ex1.html
169 lines (134 loc) · 3.84 KB
/
ex1.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
<html lang="en"><head>
<title>YACC</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style.css">
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<header class="center clearfix" id="navtop"> <a href="index.html" class="logo fleft"><img src="img/logo.png" alt=""></a>
<nav class="fright">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<!-- <li><a href="help.html">Help</a></li> -->
<li><a href="roadmap.html">Roadmap</a></li>
<li><a href="documentation.html" class="navactive">Documentation</a></li>
</ul>
</nav>
</header>
<div class="about center part clearfix">
<header class="title">
<h2 class="mright">Examples</h2>
<a href="https://github.com/silcnitc/documentation/blob/master/yacc/yacc.odt?raw=true" class="button"> Download </a>
</header>
<aside class="column4 mthird">
<menu>
<ul>
<li><a href="#navy" class="sec">YACC program</a></li>
<li><a href="#navl" class="sec">LEX program</a></li
</ul>
</menu>
</aside>
<section class="columnthird content">
<div class="grid-wrap">
<article id="nav1" class="detail">
<big>in2post.y</big>
<div id="navy"class="syntax">
<pre id="navyd">
%{
#include <stdio.h>
%}
%token DIGIT PLUS STAR
%%
start : expr '\n' {printf("\nComplete");exit(1);}
;
expr: expr PLUS expr {printf("+ ");}
| expr STAR expr {printf("* ");}
| '(' expr ')'
| DIGIT {printf("%d ",$1);}
;
%%
</pre>
<pre id="navya">
yyerror()
{
printf("Error");
}
main()
{
yyparse();
return 1;
}
</pre>
</div>
<div class="up grid col-one-third" style="float:right">
<a href="#navtop" title="Go back up"> top ↑</a>
</div>
</article>
<article id="nav2" class="detail">
<big>in2post.l</big>
<div id="navl" class="syntax">
<pre>
%{
#include <q><</q>stdio.h<q>></q> <!--Dummy tags to display '<' and '>' -->
#include "y.tab.h"
%}
%%
[0-9]+ return DIGIT;
'+' return PLUS;
'*' return STAR;
'(' return *yytext;
')' return *yytext;
%%
yywrap()
{
return 1;
}
</pre>
</div>
<div class="up grid col-one-third" style="float:right">
<a href="#navtop" title="Go back up"> top ↑</a>
</div>
</article>
</div>
</section>
</div>
<footer class="center part clearfix">
<ul class="social column3 mright">
<li><a href="https://github.com/silcnitc">Github</a></li>
<!-- <li><a href="#">Facebook</a></li>
<li><a href="#">Twitter</a></li>
<li><a href="#">Google+</a></li>
<li><a href="#">Flickr</a></li>
-->
<li> <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="img/creativecommons.png" /></a></li>
</ul>
<div class="up column3 mright">
<a href="#navtop" class="ir">Go up</a>
</div>
<!--
<ul class="social column3 mright">
<li> <a href="#navtop" class="ir">Go up</a></li>
</ul>
<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="img/creativecommons.png" /></a>
-->
<nav class="column3">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
</ul>
</nav>
</footer>
</div>
</body>
<!-- Javascript - jQuery
<script src="http://code.jquery.com/jquery.min.js"></script>-->
<script>window.jQuery || document.write('<script src="js/jquery-1.7.2.min.js"><\/script>')</script>
<!--[if (gte IE 6)&(lte IE 8)]>
<script src="js/selectivizr.js"></script>
<![endif]-->
<script src="js/scripts.js"></script>
<script src="js/inject.js"></script>
</html>