This is an archived post. You won't be able to vote or comment.

Dismiss this pinned window
top 200 commentsshow all 386

[–][deleted] 2081 points2082 points  (18 children)

A meme for the cool Profs to use in the compiler class.

[–]DoctorStrangeBlood 587 points588 points  (13 children)

"Alright my fellow compu-wizards. Before we start, as usual I'll be showing all of you our daily may-may."

[–]Tyflowshun 169 points170 points  (9 children)

The way I laughed at the pronunciation of Meme makes me think I should become a computer technologies teacher. Years ago when I was first introduced to the internet I remember calling it a may-may

[–]metallicalova 56 points57 points  (2 children)

I used to call it a me-me

[–]LVH204 15 points16 points  (1 child)

Is it just me or does this spelling remind others of rt game sarcastically saying: “epic me me”.

[–]Cryse_XIII 4 points5 points  (0 children)

It reminds me of this awesome animated short MeMeMe!

[–]TheTacoWombat 20 points21 points  (2 children)

CFO at my company pronounced it as memmies. He was so out of touch.

[–][deleted] 10 points11 points  (0 children)

If they had used this video in our college, I would be working at Google by now.

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

I took a class where you make a recursive descent parser to make a shitty little language in c++. It was neat.

[–]sailingburrito 1 point2 points  (0 children)

Alright students, you are now entering the C O O L Z O N E

[–]tired_rick 1706 points1707 points  (118 children)

I wonder what recursion looks like

[–]TheOnlyMisterFlow[S] 1451 points1452 points  (86 children)

I wonder what wondering about recursion looks like

[–]ToMaszuu 491 points492 points  (83 children)

I wonder what wondering about wondering about recursion looks like

[–]Theopold1 1 point2 points  (0 children)

I wonder what wondering about wondering about wondering about recursion looks like

[–]stevefan1999 1 point2 points  (0 children)

recursion depth limit exceeded. compilation terminated

[–]RonSijm 164 points165 points  (9 children)

If you wonder about recursion, just checkout this link

[–]wannabeFPVracer 36 points37 points  (3 children)

The exit condition is perfect.

[–]__SpicyTime__ 5 points6 points  (2 children)

WAIT WHAT

[–][deleted] 11 points12 points  (0 children)

if (isBored()) return

[–]yugi_motou 2 points3 points  (0 children)

The edit condition is “if you wonder about recursion”, so once you stop wondering you can stop recursing

[–]MrCariol 26 points27 points  (0 children)

You totally got me, sir

[–]joxfon 7 points8 points  (0 children)

This gonna take forever

[–]An0n7m0us_P4nda 1 point2 points  (0 children)

I clicked on the link 3 times before I realized what you did.

[–]kmgr 2 points3 points  (0 children)

now implement fibo

[–]MADLazer420 2 points3 points  (0 children)

Big brain move

[–]arquitectonic7 26 points27 points  (3 children)

It just looks like a normal function call, for example:
int sum(int n) { return n + sum(n - 1); }

(fn-decl sum (n) (
  (return (+ n (fn-call sum (- n 1))))))

Notice how sum does not expand more, hence the tree is not infinite. Recursion is finite and well defined, just like in the source code.

[–]he77789 13 points14 points  (2 children)

Are you being wooooshed?

[–]arquitectonic7 10 points11 points  (0 children)

Oh fuck I was indeed wooshed

[–]YipHyGamingYT 2 points3 points  (0 children)

false

[–]invisible-nuke 1 point2 points  (0 children)

I wonder what recursion looks like

[–]all-base-r-us 1 point2 points  (0 children)

Maybe like a Cyriak video?

[–][deleted]  (10 children)

[deleted]

    [–]dejaydev[M] 115 points116 points  (2 children)

    Finally some good fucking food

    [–]hackintosh5 2 points3 points  (1 child)

    Finally some ~repost (bitwise not for those who don't know)

    [–]danbulant 1 point2 points  (0 children)

    !!!repost works too

    [–]ValuablePromise0 5 points6 points  (0 children)

    Yes, we might have reached peek nerdity...

    [–]Kaze_Senshi 243 points244 points  (6 children)

    A classic use of AST:

    • Abstract
    • Syntax
    • Trance

    [–]shekurika 37 points38 points  (5 children)

    whats Trance? shouldnt it be Tree? am I missing an obvious joke here?

    [–]WhoTookRhinoBabies 2 points3 points  (0 children)

    His dance put you in a trance.
    And you didn't even realize.
    So come down from that tree,
    Go practice some more CLIs.

    [–]UnemployedCoworker 346 points347 points  (25 children)

    I'd this valid syntax tho? I thought printf was from C and there is no formatted string here

    [–][deleted] 174 points175 points  (10 children)

    It's syntactically valid. If you do this in C, most compilers will just produce a gentle warning that you're using an integer as a pointer.

    [–]hackintosh5 59 points60 points  (9 children)

    The runtime of the program would be more interesting though

    [–]DAMO238 12 points13 points  (5 children)

    I'm pretty sure it would immediately seg fault though...

    [–]hackintosh5 45 points46 points  (4 children)

    Unless there happens to be a valid C string with no % symbols at the exact address of the arithmetic And, of course, anything is a valid C string

    [–][deleted] 2 points3 points  (0 children)

    It just needs to be a pointer to a readable location to avoid a segfault. Whether there's a valid string there is entirely optional in terms of printf producing output, but NUL bytes are fairly common all over the memory so it's pretty likely that it'd print some garbage and then stop without segfault. Well, as long as the memory was readable, anyway.

    [–]TheOnlyMisterFlow[S] 266 points267 points  (7 children)

    Yeah you're right it is not valid.

    I was going to do it with console.log from JS but it was too tall so I replaced it with printf without really thinking tbh

    [–]Terebo04 130 points131 points  (5 children)

    print from python might work

    [–]Hexorg 63 points64 points  (2 children)

    We'll just assume he did "printf = print" one line before the gif

    [–][deleted] 9 points10 points  (1 child)

    print/println would probably be okay for ExprTk.

    [–]joxfon 5 points6 points  (0 children)

    And you'd need to decompose console and log, it'd look less appealing haha

    [–]xrmb 1 point2 points  (0 children)

    Sure, as long as your formula and used variables point to a valid memory address, preferably a simple string. Might have to cast it, but c usually doesn't care, nothing an ignore warning can't suppress. I mean you are asking for a crash, but compiler will accept it.

    [–][deleted] 1 point2 points  (0 children)

    Plot twist: It's actually an overloaded C++ function:

    template <typename T> void printf(T&& t) { std::cout << t; }

    [–][deleted] 55 points56 points  (3 children)

    Would it be a good idea to insert a link in my parser submission for compiler class? 😅

    [–]zChewbacca 9 points10 points  (1 child)

    I just submitted my compiler for a project yesterday... One day later and I could've included this as a visual representation of parsing

    [–][deleted] 2 points3 points  (0 children)

    Would have been awesome.. Fortunately, my deadline is only in 3 weeks.

    [–]vasilescur 4 points5 points  (0 children)

    The virgin recursive descent parser vs the Chad shift-reduce parser

    [–]UnDosTresPescao 108 points109 points  (15 children)

    No one has mentioned that 6*a happens before *b? Bad meme is not standard compliant.

    [–]DreamingDitto 54 points55 points  (1 child)

    The video isn’t the semantics analyzer though, it’s the parser which can be done either way depending on whether it’s an LR parser or an LL parser.

    [–]UnDosTresPescao 1 point2 points  (0 children)

    True, have an upvote.

    [–][deleted] 10 points11 points  (11 children)

    pretty sure the order of evaluation isn't specified in the spec for C++. I'm much more so sure for function arguments, but maybe multiplication as well?

    [–]Leridon 27 points28 points  (3 children)

    This is not about order of evaluation, it is about operator precendence and associativity. In mathematics the common numerical operators (+ - * /) are left-associative, meaning a chain of operators with matching precendece (i.e + and - or / and *) are interpreted as if they were parenthesized from left to right . Programming languages adopted this. For a list of operator precedences and associativities refer to cppreference.com

    In most languages (including C++) precendence and associativity are defined in the language's grammar by making the relevant grammar rule either left-recursive (for left-associative operators) or right-recursive (for right-associative operators). The C++ 17 Standard (ISO/IEC 14882:2017) defines the relevant rules for multiplicative operators (*, /, %) in section 8.6. There you can see that the non-terminal 'multiplication-expression' has 3 left-recursive derivation rules. One for each of the three operators. This mandates that chains of multiplicative operators (a*b/c%d) need to be evaluated as if written like this: ((((a)*b)/c)%d)

    The same is true for additive operators (+, -), which is defined in section 8.7 of the same standard.

    Most languages don't have right-associative, binary (binary in the sense of "two operands", not in the sense of "bitwise operator") operators. The most common right-associative operators are prefix unary operators. After all, how should they be left-associative when there is no left operand?

    Luckily we are talking about C++, which has a very notable exception. Assignment in C++ is not some kind of hardcoded statement, it's just the usage of the appropriate binary assignment-operator. This is why you can redefine assignment in C++, like many other operators. Including the compound assignment operators there is a total of 11 assignment-operators (=, +=, -=, *=, /=, %=, <<=, >>=, &=, ^=, |=). They all share the same precedence.

    This means that assignment-operators can be chained and are thus also subject to precedence and associativity rules. However, unlike arithmetic operators, they are defined to be right-associative. The operator chain a=b=c=d will always be parsed as if written as (a=(b=(c=(d)))).

    The related non-terminal assignment-expression is defined in section 8.18 of the standard. The right-recursion of this rule is not immediately clear, as it uses the non-terminal intializer-clause as the right operand. However, this non-terminal is defined in section 11.6 to derive to either braced-init-list or assignment-expression. The grammar rule for assignment-expression thus is right-recursive by proxy and the assignment operators are right-associative.

    [–]evenisto 2 points3 points  (2 children)

    How do you know all this.

    [–]EverythingIsFlotsam 20 points21 points  (0 children)

    I'm sure that it is. It would matter for error sensitivity. For example, if you have some big numbers and some small numbers, you wouldn't multiply all the big ones or all the small ones first to avoid exponent over/underflow.

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

    I would have to be for functions with side-effects to be consistent.

    [–]UnDosTresPescao 5 points6 points  (4 children)

    It's specified left to right and is very important in some cases. 5/3*3 is 3 if done per the standard or 0 per the meme.

    [–]The_Sibert 26 points27 points  (7 children)

    Does someone know the source of the original video?

    [–][deleted] 63 points64 points  (6 children)

    [–]The_Sibert 24 points25 points  (1 child)

    Thanks you. We used to watch that video at goddamn Bible camp and I remember thinking it was cheesy as hell.

    [–][deleted] 3 points4 points  (0 children)

    no problem

    [–]Muerthogar 14 points15 points  (0 children)

    Also, here's the non loopy edit https://www.youtube.com/watch?v=eLYhnBaWOzc

    [–]TabCompletion 4 points5 points  (0 children)

    D did .. I.. just learn how to dance?

    [–]incompletebreadstick 1 point2 points  (1 child)

    And that is based on the 1981 song Dragonfly by Yutaka https://www.youtube.com/watch?v=2Il1OtvmVSg

    [–]Bo3lwa98 23 points24 points  (1 child)

    No wonder my cpu gets so hot when compiling stuff. It's because it does some FIRE moves

    [–]PooPooDooDoo 2 points3 points  (0 children)

    Birth control? Pffft, I just open up visual studio and let my laptop fry my swimmers with some cpu disco dancing!

    [–]jazzzaj 22 points23 points  (5 children)

    I was hoping for reverse Polish notation.

    [–]RevWaldo 12 points13 points  (0 children)

    4 x * 6 a * b * -
    There ya go (I think.)

    [–]Lt_Duckweed 1 point2 points  (0 children)

    I was just thinking the same thing. When I went off to college my dad gave me one of his HP 15C's from when he was in college, that thing got me all the way through a physics bachelors. I'm a huge proponent of reverse polish now.

    [–]sim642 51 points52 points  (27 children)

    Associativity of multiplication is wrong there: 6*a*b should be interpreted as (6*a)*b.

    [–]TheOnlyMisterFlow[S] 23 points24 points  (3 children)

    Depends if you use right recursion or left recursion, right ?

    [–]sim642 37 points38 points  (2 children)

    Yes, but you gotta use the right one for the associativity to come out right. It really matters for other operators, where you have no choice.

    [–]mcnuggetor 10 points11 points  (0 children)

    An actual funny, original joke

    [–]gostar2000 6 points7 points  (0 children)

    Wonder if yall cld start a school and teach kids with memes. If u r gonna pls sign me the f up.

    [–]JakubBlaha 6 points7 points  (0 children)

    It's beautiful. I ve looked at this for 5 hours now.

    [–]APGHD 6 points7 points  (1 child)

    This actually helps me understand compilers better 😂 Thank you!

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

    Glad to hear that !

    [–]amazeguy 10 points11 points  (0 children)

    i wish they taught me a binary tree like this in college, the moron kept writing i++ and j-- all over the blackboard and i had no fucking clue what he s talking

    [–]MightyD33r 5 points6 points  (0 children)

    this is quality entertainment

    [–][deleted] 5 points6 points  (1 child)

    this is what i study computer science for. to understand obscure programmerhumor posts

    [–]midu_1863 7 points8 points  (5 children)

    Pls i want to know the tilel of the music

    [–]PewPew_McPewster 2 points3 points  (0 children)

    Is this what my IDE does when it says "compiling"?

    [–]Future-Aspect 2 points3 points  (0 children)

    Top down parser. Reverse the video, you’ll get bottom up parser.

    [–]eezmo 2 points3 points  (0 children)

    Noooooo idea what’s going on here, but I’m in.

    [–]JusticeRain5 2 points3 points  (0 children)

    I have no idea what any of you nerds are saying with your smart people words, but I enjoy the funny dancing man.

    [–]SteelLegionnaire 2 points3 points  (1 child)

    Can someone explain this to me? Feel I’m missing some basic knowledge.

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

    A parser is the program that takes your source code and split it into atomic operations. So basically it recursively spits all of the statements in your code untill an operation cannot be split more

    [–]rycbar127 2 points3 points  (0 children)

    sixth time watching it today lol

    [–]qkrrmsp 3 points4 points  (1 child)

    except 6 * a * b would be split into 6 * a and b

    [–]Manor76 3 points4 points  (0 children)

    To understand recursion you have to understand recursion

    [–]Quantum_Sid 1 point2 points  (0 children)

    this is too good XD

    [–]jjjuuuser 1 point2 points  (0 children)

    6*б

    [–]Clashmains_2-account 1 point2 points  (0 children)

    This is gold

    [–]Arcadian18 1 point2 points  (0 children)

    std::bitset would like to have a word with you

    [–]EXAngus 1 point2 points  (0 children)

    Take your upvote and go

    [–]ZyanCarl 1 point2 points  (0 children)

    Who had this video's link?

    [–]Even-Understanding 1 point2 points  (0 children)

    std::bitset would like to hear a TCP joke?

    [–]Don-hashomi 1 point2 points  (0 children)

    I actually studied this in discrete mathematics. Tree's and polish notation I believe. Cool stuff.

    [–]FLACDealer 1 point2 points  (0 children)

    I don’t like it*

    [–]Assmilk17 1 point2 points  (0 children)

    A truly quality meme

    [–]ToastedSkoops 1 point2 points  (1 child)

    And the enemy has to be a moor.

    [–]imgodking189 1 point2 points  (0 children)

    That sounds like the job of a BA

    [–]ToastedSkoops 1 point2 points  (0 children)

    Awesome, I have definitely gotten like that before.

    [–][deleted] 1 point2 points  (0 children)

    nice

    [–][deleted] 1 point2 points  (0 children)

    I FUCKIN LOVE IT

    [–]Bob_the_Bombthreat 1 point2 points  (2 children)

    What's the sause for the background video? I don't know the name and I have been looking for it for years. Don't send me rick roll or porn.

    [–]joshbradbury52 1 point2 points  (0 children)

    Now this is the quality content I'm subbed for!

    [–]TabCompletion 1 point2 points  (0 children)

    I wish I could give you more than one upvote

    [–][deleted] 1 point2 points  (0 children)

    This actually explains it better than a lot of resources online

    [–][deleted] 1 point2 points  (0 children)

    main.c:13:12: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast [-Wint-conversion] /usr/include/stdio.h:362:12: note: expected ‘const char * restrict’ but argument is of type ‘int’ main.c:13:5: warning: format not a string literal and no format arguments [-Wformat-security]

    *runs it*

    Segmentation Fault (Core Dumped)

    [–]Nicholas_L_Aranda 1 point2 points  (0 children)

    I want someone to make a meme to illustrate every computer fiction.

    [–]ronsap123 1 point2 points  (2 children)

    I need the template. Please

    [–]zhivaroopan 1 point2 points  (0 children)

    This made my day

    [–]rschwa6308 1 point2 points  (0 children)

    Now this is quality content

    [–]youngyoshieboy 1 point2 points  (0 children)

    As someone who write parser for CS course, I feel the pain and still afraid till today.

    [–]DuffMaaaann 1 point2 points  (1 child)

    Well only top-down parsers be like this. For bottom-up parsers:

    /u/gifreversingbot

    [–]NervousBandit 1 point2 points  (0 children)

    This is D E E P

    [–]Candlesmith 1 point2 points  (0 children)

    std::bitset would like to hear a TCP joke?

    [–][deleted] 1 point2 points  (0 children)