5 ms·
Number Script - A Little Language that compiles to JavaScript
- rman666 14y agoIntegers only? Fail.
- wazzupflow 14y agohahahahaha
- richyzhang 14y agoReally fun, you should introduce it on April 1.
- ajuc 14y agoI wonder, if you wrote a program, that generates all valid javascript programs, given enough time, do you automatically have copyright on all these programs? Or do you need to actually run the program and save the results somewhere?
- mappum 14y agoWell in the number-script compiler, it verifies code by running it (I'm not sure if that qualifies). Also, you would get stuck on code with infinite loops.
- substack 14y agoThe verify phase was just defining an inline function but not running it. However, I just noticed that a program with carefully placed braces could jump out of the function box and actually run. I replaced the checker with just Function(src) which shouldn't have that problem and is much faster.
- mappum 14y agoOh, right, it didn't execute it. I need more caffeine (except not really, it's 2:30).
- icebraining 14y agoAlso, you would get stuck on code with infinite loops. Or you could just set a timeout.
- ajuc 14y agoIf we only checked that produced program has valid syntax, instead of running it, we won't have problems with loops. Many gibberish programs would be produced, but some usefull also, eventually. We just wouldn't know which ones are the useful ones, but it shouldn't matter for copyright? So it seems documenting is the real work, and programming is something that can be automated :)
- jaekwon 14y agonah, it's clear that work still needs to be done to identify the useful programs. if you can identify useful programs from any sludge of valid programs, well you have AI.
- giladvdn 14y agoNot sure this actually qualifies as a compiler. All it does is (Python): return int(code.encode('hex'))
- mappum 14y agoI sent a pull request that allows users to specify the base. https://github.com/substack/number-script/pull/2 https://github.com/substack/number-script/pull/2 Real men code in binary.
- brittohalloran 14y agopull request #2 -- appropriate
- strela 14y agoreminds me of Malbolge somehow... (http://de.wikipedia.org/wiki/Malbolge http://de.wikipedia.org/wiki/Malbolge)
- dbaupp 14y agoCan anyone write a quine?
- anonymoushn 14y ago5278827227337076170449567737552050301648746541307090261949087452005923485275315474841135167346502310847459286951086056344961803751459109212515926887194626082177012120350623103576444178029679178692303904162181758870755165218374331731985435437211712470113418677388286391584240429269097406210073414223015915570360596450972343414303025097210394142649144691637350017001727477713336405614635714291836737681181600586279616997175126243498394778635680522
- nodesocket 14y agoWell done substack.
- grovecai 14y agoWhat's the purpose? I don't get it.
- cmelbye 14y agoIt's a joke.
- ajuc 14y agoI want to see fractal made from the numbers that are valid. I'll try to do this, but I don't know how to best cast 1d numbers onto 2d plane. Only way I can think of, that doesn't depend on arbitrary constraints like how many pixels in a row, is to make spiral starting from the middle of the screen. Anybody has better idea?
- eternauta3k 14y agoMake it 1D or use the mapping from this xkcd http://xkcd.com/195/ http://xkcd.com/195/
- mbetter 14y agoI would do the spiral from the middle, like Ulam's Rose. If you put the valid programs on top of the primes, you'll probably get a picture of a horse or something. http://en.wikipedia.org/wiki/Ulam_spiral http://en.wikipedia.org/wiki/Ulam_spiral
- tubbo 14y agoJavaScript: Programming's funniest joke.
- thenonsequitur 14y agoI think the joke here is actually on CoffeeScript, not Javascript. And really the joke is on CoffeeScript evangelists, not CoffeeScript.
- teeja 14y agoI save even more loads of scripting time by encoding in Base 1. Documentation is a snap, and no danger of creeping featuritis.
- modarts 14y agoIs this supposed to be a knock on CoffeScript?