Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

got octo working, as far as I can tell

  • Loading branch information...
commit ac6c114fa9710d222c764c777e29f4bdf7200df7 1 parent e42b9db
kragen authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 glitchparse.js
View
8 glitchparse.js
@@ -6,7 +6,7 @@ var assert = require('assert')
, starlost_infix = '(t % 255 ^ t % 511) * 3'
test()
-puts(infix_of(octo))
+sys.puts(infix_of(octo))
function infix_of(glitch_url) {
var stack = []
@@ -18,8 +18,13 @@ function infix_of(glitch_url) {
}
, ops = { a: function() { push('t') }
, d: binop('*')
+ , e: binop('/') // XXX division by zero
+ , f: binop('+')
+ , g: binop('-')
, h: binop('%')
+ , k: binop('>>>')
, n: binop('^')
+ , m: binop('|')
}
// Iterate over the tokens using the string replace method.
@@ -52,6 +57,7 @@ function ast_to_js_(ast, parentPrecedence, leftOrRight) {
].join(' ')
if (precedence < parentPrecedence) return body
+ // XXX handle associativity
return '(' + body + ')'
}
Please sign in to comment.
Something went wrong with that request. Please try again.