What Goes On In My Compiler

CC: Alright, then!  Good job on that last function.  Especially that loop unrolling, AS.

AS: Just doing my job.

CC: Let's move on to the next translation unit.  CPP, did you have any problems preparing it?

CPP: #define NOPE NADA.

CC: Outstanding!  Parser?

PARSER: Sir!

CC: What's our first declaration?

PARSER: Appears to be a function, sir - "log_message".  Ooh, how descriptive.  Would it hurt him to spice things up a bit?

CC: Not our concern, P.  What's the signature?

PARSER: Bog simple.  One pointer to a character for an argument, and no return value.

CC: Excellent.  AS, please set up the normal scaffolding - function entry, frame pointer, and so on.

AS: Aye aye!

CC: Parser, make sure you coordinate with Lexer.  He'll need to know what's coming up.

PARSER: Already on it.

LEXER: Hmm, first token is an unsigned 64 bit value.  Let's see where it's initialized and... oh, no.

PARSER: What?  Oh... crap.

LEXER: Crap is right.

CC: Language, language, people.  What's so... oh, crap.

PRINTF:  Oh, hey!  Hewwo evewy one!

PARSER: Uh.  Hello, Printf.

LEXER: *mutters under his breath*

CC: Well, now, isn't this a surprise.  Always... always good to see you, Printf.

PRINTF: What game are we going to pway today?  Is it piwates?

CC: No, it's not piwa... pirates.  It's the same game as always, Printf.

PRINTF: *jumps up and down excitedly* Oh, oh, oh!  I know this game!  Is it pwinting?

CC: Uh.  Yes.  Can you take this format string string and these arguments, and make us some nice, pretty output?  Hmm?

PRINTF: Oh, I would wove to!  Onwy...

PARSER: Only what?

PRINTF: Onwy, it's won't work.  The awgument is all wong.

LEXER: Look here, you moronic half-wit, if you're telling me I got the data wrong...

AS: *soothingly* Looks just fine to me, Lex.  Stellar job.

CC: *ignoring them* What do you mean, "all wrong", Printf?

PRINTF: Well, the format stwing says to pwint an integer.  But the awgument is an unsigned wong integer.

CC: ... and?

PRINTF: And?  AND?!?  They're compwetewy diffewent types!

PARSER: They're both integers!

LEXER: Even AS and I treat them the same!  Right, AS?

AS: Well, yeah.  Pretty much.

LEXER: So, just... you know.  Format is as an unsigned long, and be done with it.  Problem solved.

CC: Can you do that?

PRINTF: Absolutewy not!  It's.. it's not wight!  The format stwing says...

CC: Yes, yes, I know...

PRINTF: ... I said, the format stwing says to pwint an integer!

CC: Well, and unsigned long int is still an integer, right?

PRINTF: *stares at CC in shock* I can't bewieve you just said that to my face.


No comments: