Work in progress javascript compiler

This commit is contained in:
Dale Weiler 2012-11-12 02:47:25 +00:00
parent c72d2f5751
commit d7058e8ada
4 changed files with 96 additions and 1 deletions

View file

@ -25,6 +25,7 @@
<li class="download"><a class="buttons" href="https://github.com/graphitemaster/gmqcc/zipball/master">Download ZIP</a></li>
<li class="download"><a class="buttons" href="https://github.com/graphitemaster/gmqcc/tarball/master">Download TAR</a></li>
<li><a class="buttons issues" href="https://github.com/graphitemaster/gmqcc/issues">Issues</a></li>
<li><a class="buttons test" href="test.html">Try it</a></li>
<li><a class="buttons github" href="https://github.com/graphitemaster/gmqcc">View On GitHub</a></li>
</ul>

25
javascripts/compiler.js Normal file
View file

@ -0,0 +1,25 @@
// compiler bootstraps down to the emcscripten compiled compiler
// and the execution
var std = "gmqcc";
var example = "1";
function update() {
var select = document.getElementById("std");
var change = select.options[select.selectedIndex].value;
if (change != std) {
std = change;
}
select = document.getElementById("eg");
change = select.options[select.selectedIndex].value;
if (change != example) {
example = change;
}
}
function compile() {
var string = '"' + document.getElementById("input").value + '"';
string += " -std="+std+" ";
document.getElementById("output").value = string;
}

View file

@ -33,10 +33,18 @@ body {
background-color: #FBFAF7;
margin: 0;
line-height: 1.8em;
-webkit-font-smoothing: antialiased;
-webkit-font-smoothing: antialiased;
}
textarea {
outline: none;
resize: none;
background-color: #FBFAF7;
border: 1;
border-color: red;
}
h1, h2, h3, h4, h5, h6 {
color:#232323;
margin:36px 0 10px;

61
test.html Normal file
View file

@ -0,0 +1,61 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>GMQCC by graphitemaster</title>
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<script src="javascripts/scale.fix.js"></script>
<script src="javascripts/compiler.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<a href="https://github.com/graphitemaster/gmqcc"><div class="fork"></div></a>
<div class="wrapper">
<header>
<h1 class="header">GMQCC</h1>
<p class="header">An Improved Quake C Compiler</p>
<ul>
<li class="download"><a class="buttons" href="https://github.com/graphitemaster/gmqcc/zipball/master">Download ZIP</a></li>
<li class="download"><a class="buttons" href="https://github.com/graphitemaster/gmqcc/tarball/master">Download TAR</a></li>
<li><a class="buttons issues" href="https://github.com/graphitemaster/gmqcc/issues">Issues</a></li>
<li><a class="buttons test" href="test.html">Try it</a></li>
<li><a class="buttons github" href="https://github.com/graphitemaster/gmqcc">View On GitHub</a></li>
</ul>
</header>
<section>
<h3>Try it from your browser</h3>
Load Example:
<select id="eg" onchange="update()">
<option value="1">Hello World</option>
<option value="2">Loops</option>
</select>
&nbsp;
Standard:
<select id="std" onchange="update()">
<option value="qcc">QCC</option>
<option value="fteqcc">FTEQCC</option>
<option value="gmqcc">GMQCC</option>
</select>
<textarea id="input" rows="18" cols="100%"></textarea>
<button onclick="compile();">Compile &amp; Run</button>
<h4>Compiler Output:</h4>
<textarea id="output" rows="8" cols="100%"></textarea>
<h4>Execution Output:</h4>
<textarea id="exec" rows="8", cols="100%"></textarea>
</section>
<footer>
<script type="text/javascript" src="http://www.ohloh.net/p/602517/widgets/project_partner_badge.js"></script>
</footer>
</div>
<!--[if !IE]><script>fixScale(document);</script><![endif]-->
</body>
</html>