-
Notifications
You must be signed in to change notification settings - Fork 3
/
codegen.html
126 lines (104 loc) · 3.66 KB
/
codegen.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Shift Code Generator</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="css/ribbon.css" rel="stylesheet">
<link href="css/css.css" rel="stylesheet">
<link href="css/demo.css" rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro:400,700" rel="stylesheet" type="text/css"/>
<!-- highlight.js -->
<link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/styles/magula.min.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<style>
#demo1 .editor {
width: 100%;
}
#actions {
text-align: center;
}
.error-message {
padding-left: 4.3em;
position: relative;
float: top;
}
#demo1.error {
position: relative;
}
#demo1.error .editor {
position: absolute;
bottom: 0;
height: 93%;
}
#demo1.error .error-message {
display: block;
}
</style>
<script src="vendor/ace-builds/src-min/ace.js"></script>
<script src="js/shift-parser.js"></script>
<script src="js/shift-codegen.js"></script>
</head>
<body>
<div class="ribbon-container right">
<div class="ribbon">
<a href="https://github.com/shapesecurity/shift-codegen-js" target="_blank">Fork me on GitHub</a>
</div>
</div>
<div class="container">
<div class="masthead">
<h3><a href="./index.html" class="muted hub-link">part of the Shift suite</a></h3>
</div>
<div class="jumbotron">
<h1><span class="shift">Shift</span> Code Generator</h1>
<p class="lead">
generates an ECMAScript program from a valid Shift AST
</p>
</div>
<hr />
<section id="demo">
<h3>Demo</h3>
<p>
In this demo, a script is provided, and the formatted code generator
output is shown when the pretty button is pressed below.
When the minimal button is pressed, a minimal code generator provides
the smallest possible output, not including minimizer rewriting.
</p>
<div id="actions">
<button class="btn btn-primary btn-lg" type="button" id="pretty-button" class="action-button">Pretty</button>
<button class="btn btn-primary btn-lg" type="button" id="minimal-button" class="action-button">Minimal</button>
</div>
<div class="demo" id="demo1">
<div class="editor" spellcheck="false">for( let x ;x> 5;x ++){if
(x<3){do {
console.log(`${x} < 3`);
} while (false)} else {
console.log(`${x} >= 3`);
}}
</div>
<div class="error-message"></div>
<script src="js/codegen/main.js"></script>
</div>
</section>
<section id="installation">
<h3>Installation</h3>
<pre><code class="nohighlight">npm install shift-codegen</code></pre>
</section>
<section id="usage">
<h3>Usage</h3>
<pre><code class="javascript">import codegen from "shift-codegen";
let programSource = codegen(/* Shift AST */);</code></pre>
</section>
<hr />
<div class="footer">
<p>© Shape Security, Inc.</p>
</div>
</div>
</body>
</html>