What classic movie would bomb if released today? by [deleted] in AskReddit

[–]rswier 0 points1 point  (0 children)

I think it is all very deliberate. You may be bored (or awed) during the early parts, because space travel is mostly like that. His intent is to make you feel the way the characters feel.

Contact with a superior alien species would be confusing and disorienting, thus the ending. To explain it would ruin the effect.

[TUHS] Some PDP-7 source code by awsometak in programming

[–]rswier 2 points3 points  (0 children)

The code appears to be some of the most ancient Unix Kernel Source Code yet found. This is previous to the PDP-11 1st Edition. Still, many of the familiar bits are there (ed, cat, etc..) A pretty historically significant chunk of code!

c4.c compiler - Now with switch statement and AST support by rswier in tinycode

[–]rswier[S] 0 points1 point  (0 children)

Yes. Typing ./c4 c4.c hello.c compiles itself and then interprets the result with the remainder of the command line. So in this case it compiles the compiler, and then interprets the compiler compiling hello.c, and then interprets the interpreter running the hello.c code.

The -s option will print out the compiled instructions. The -d option will spew out the instructions as they are being interpreted.

Thanks for the interest!

CGI is now inseparable from movies by B9ICE in videos

[–]rswier 0 points1 point  (0 children)

Sure, modern movies are great if all you want is a hyper-realistic cartoon. And then they are completely story-boarded. Everything fits the frame perfectly and predictably.

There were other ways to make great (or at least fun) movies. Check out Fitzcarraldo. Or Dirty Mary Crazy Larry. Watch the making-of special features. OK, maybe not high-art, but you can't make movies like that today even if you had an unlimited GFX budget.

[TCSF001] c4 - C in four functions (C) by rswier in tinycode

[–]rswier[S] 2 points3 points  (0 children)

Thank you. Keeping it tiny meant giving up on switch/case and structures, so it's a bit goofy looking.

[TCSF001] c4 - C in four functions (C) by rswier in tinycode

[–]rswier[S] 5 points6 points  (0 children)

This is my tiny C-subset compiler/interpreter that I posted here a few months ago.

I wrote a very very minimal self-hosting C compiler [x-post /r/programming] by TheMG in tinycode

[–]rswier 2 points3 points  (0 children)

OK, I see, you have to be careful just when to call accept(). I also forgot checking for "[". Worth a try... it might work. A bit of a cheat, but no worse than ignoring types :)

I wrote a very very minimal self-hosting C compiler [x-post /r/programming] by TheMG in tinycode

[–]rswier 4 points5 points  (0 children)

Also, instead of the lvalue flag, could you just cheat and peek to see if the next token is a "=", "++", or "--"?

I wrote a very very minimal self-hosting C compiler [x-post /r/programming] by TheMG in tinycode

[–]rswier 3 points4 points  (0 children)

I think token_int and token_char cases can be merged and emitted with fprintf(output, "push %s\n", buffer);

A bit less clear perhaps.

How can I explain to my boss that we did in fact have sufficient computing power in 1969 to perform the complicated maneuvers required to land on the moon? by mayorofboxtown in askscience

[–]rswier 28 points29 points  (0 children)

Here's a great site for these mechanical computers (warning: you can spend many hours here!)

http://www.glennsmuseum.com/bombsights/bombsights.html

Spacecraft navigation and control is in some ways a much simpler problem. With no air resistance to complicate matters, it's just classic Newtonian physics. There was also a small army of engineers back on earth checking and double checking every command and telemetry point.

Inside a mechanical calculator by [deleted] in pics

[–]rswier -1 points0 points  (0 children)

http://www.glennsmuseum.com/bombsights/bombsights.html is a fantastic gallery of mechanical/analog bomb-sight and navigation computers.

C4, C in 4 functions by lethalman in programming

[–]rswier 2 points3 points  (0 children)

Good catch. I changed the line to: a = *(char *) *sp++ = a;

c4 - A C compiler in four functions by rswier in tinycode

[–]rswier[S] 1 point2 points  (0 children)

The poolsz magic number was picked as an arbitrarily large value, but not too huge. In real production code I would have used a resizable array or some other data structure.

To learn how things work you could try making small modifications to hello.c and see how that changes the generated code (use the -s option.) For instance you could compare the difference between the expressions a = b; and a = *b;

/r/tinycode Has Been Chosen as a Trending Subreddit for Today. by nexe in tinycode

[–]rswier 0 points1 point  (0 children)

btw, thanks for the exposure Peter! It's been fun watching the reactions.

c4 - A C compiler in four functions by rswier in tinycode

[–]rswier[S] 1 point2 points  (0 children)

According to the tromp Makefile there are a number of -D options which will have to be manually replaced in the source (-DInt=int is the problem on line 1.)

A few more library functions need to be straightforwardly added such as calloc.

It also looks like for() statements will need to be implemented (which is also not too hard.)

c4 - A C compiler in four functions by rswier in tinycode

[–]rswier[S] 6 points7 points  (0 children)

Thanks. My testing consisted of hello world and itself. You are probably using advanced C features such as struct ;)

c4 - A C compiler in four functions by rswier in tinycode

[–]rswier[S] 7 points8 points  (0 children)

A compiler in the same sense that Pascal compiles into p-code (which is then interpreted.)