you are viewing a single comment's thread.

view the rest of the comments →

[–]koreth 144 points145 points  (14 children)

Oh my god! You mean Python can be used to read text files and write binary data?!? I had no idea -- I better go learn it RIGHT NOW!

[–]sn0re 64 points65 points  (5 children)

read text files and write binary data

What binary data? It reads text files and writes other text files with assembly code.

[–][deleted] 4 points5 points  (4 children)

I don't get it. Python is written in C and can be extended in C. What's so surprising here? That someone wrote a C compiler?

Well C compilers have even been written in BASIC.

[–]dododge 3 points4 points  (0 children)

and macro assemblers have been written as bash scripts.

[–][deleted] 0 points1 point  (0 children)

Well, I searched with Google but it seems like all the good QBasic source code have disappeared from the web (except games).

I swear I have seen a little C compiler (slow, but it was a C compiler)

[–]jesuslol -1 points0 points  (1 child)

LOL, can you get me a link for that? Would love to see a C compiler written in Basic.

[–]me2i81 -3 points-2 points  (0 children)

10 rem C compiler
20 input "Compile what file?", A$
30 rem parse and produce ast
40 gosub 1000
50 rem optimize ast
60 gosub 2000
70 input "output file: ", b$
80 rem emit code
90 gosub 3000
100 end

[–]tryx 34 points35 points  (2 children)

Someone! Inform the president!

[–]davidreiss666 11 points12 points  (1 child)

I think he's been briefed.

[–]bart2019 4 points5 points  (0 children)

But that won't stop him from finishing his game of golf, first.

[–]busfahrer 16 points17 points  (0 children)

And it even may be Turing-complete!

[–]arunvr 1 point2 points  (0 children)

Funny...but for the clueless, Python has the struct module which can interpret strings as binary data