From 95ff6a5e4a73e98fae987140c6b75fcf15569dd7 Mon Sep 17 00:00:00 2001 From: threeoh6000 Date: Sun, 5 Jan 2025 02:45:56 +0000 Subject: [PATCH] mrrow --- Parser.hx => Hexat.hx | 2 +- README.md | 7 +++++++ index.html | 4 ++-- script.js | 20 ++++++++++---------- 4 files changed, 20 insertions(+), 13 deletions(-) rename Parser.hx => Hexat.hx (99%) create mode 100644 README.md diff --git a/Parser.hx b/Hexat.hx similarity index 99% rename from Parser.hx rename to Hexat.hx index bf9881b..b3614bd 100644 --- a/Parser.hx +++ b/Hexat.hx @@ -6,7 +6,7 @@ enum Token { Number(num:Int); } -class Parser { +class Hexat { static public function main() { var button = document.querySelector(".runButton"); button.onclick = (event) -> runButton(); diff --git a/README.md b/README.md new file mode 100644 index 0000000..daa1342 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Hexat +Haxe calculator/language + +## Build instructions +``` +haxe --main Hexat --js script.js +``` diff --git a/index.html b/index.html index 6631655..7c0786f 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,13 @@ - HTML Boilerplate + Hexat -

hxcalc

+

Hexat



Output:
diff --git a/script.js b/script.js index a98cd1b..fe185ae 100644 --- a/script.js +++ b/script.js @@ -1,27 +1,26 @@ // Generated by Haxe 4.3.6 (function ($global) { "use strict"; var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; -Math.__name__ = true; var Token = $hxEnums["Token"] = { __ename__:true,__constructs__:null ,Operation: ($_=function(op) { return {_hx_index:0,op:op,__enum__:"Token",toString:$estr}; },$_._hx_name="Operation",$_.__params__ = ["op"],$_) ,Number: ($_=function(num) { return {_hx_index:1,num:num,__enum__:"Token",toString:$estr}; },$_._hx_name="Number",$_.__params__ = ["num"],$_) }; Token.__constructs__ = [Token.Operation,Token.Number]; -var Parser = function() { }; -Parser.__name__ = true; -Parser.main = function() { +var Hexat = function() { }; +Hexat.__name__ = true; +Hexat.main = function() { var button = window.document.querySelector(".runButton"); button.onclick = function(event) { - Parser.runButton(); + Hexat.runButton(); }; }; -Parser.runButton = function() { +Hexat.runButton = function() { var inputArea = window.document.querySelector(".source"); - var res = Parser.run(Parser.parse(inputArea.value)); + var res = Hexat.run(Hexat.parse(inputArea.value)); var outputDisplay = window.document.querySelector(".output"); outputDisplay.innerHTML = "Output:
" + res.join(", ") + "
"; }; -Parser.parse = function(input) { +Hexat.parse = function(input) { var array = []; var i = 0; var splits = input.split(" "); @@ -39,7 +38,7 @@ Parser.parse = function(input) { } return array; }; -Parser.run = function(array) { +Hexat.run = function(array) { var stack = []; var i = 0; while(i < array.length) { @@ -88,6 +87,7 @@ Parser.run = function(array) { } return stack; }; +Math.__name__ = true; var Std = function() { }; Std.__name__ = true; Std.parseInt = function(x) { @@ -225,5 +225,5 @@ js_Boot.__string_rec = function(o,s) { String.__name__ = true; Array.__name__ = true; js_Boot.__toStr = ({ }).toString; -Parser.main(); +Hexat.main(); })({});