Compiler Construction & Lord of the Rings
July 1, 2008 on 11:36 am | In Development, Fun |Recently I had an idea on compilers and code generation. Generating assembler code (I’m talking about MIPS code) and with it labels I thought: Why not using cool names for labels? Instead of
LB_WH002_001G:
beq $a1, $v1, LB_WH002_002G
add $a1, $a1, $v1
j LB_WH002_001G
LB_WH002_002G:
...
One could be more creative and use for instance Names from Lord of the Rings like:
THE_SHIRE:
beq $a1, $v1, MORDOR
add $a1, $a1, $v1
j THE_SHIRE
MORDOR:
...
While this definitely does not increase readability of assembler code I still think it doesn’t lessen it much. Instead it introduces “geekiness” to assembler
For those who are not creative themselves and need a lot of labels I recommend the numerous fanrtasy fantasy name generators available on the internet like this, this or this one.
3 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
© 2004-2007 by Mathias Lux
>> Contents of this page are licensed under the CreativeCommons Attribution 2.5 license <<
Funny idea, but I do think that it doesn’t really change anything.
Nobody wants to read assembler any more I guess :).
Labels should mean something that increases readability. if your default labels don’t mean a thing it doesn’t matter wether you name them after XMen or LotR :).
Comment by Tigraine — July 1, 2008 #
oh my dear … such ideas are the reason why computers science will never be seen as a real engineering discipline … “introduce geekyness” … ask a mechanical engineer or one from the electrical departmend if they have such ideas in their field …
Comment by Johannes Liegl — July 1, 2008 #
Of course labels have to be semantically correct, so if something bad happens, the program has to jump to Mordor
Comment by Mathias Lux — July 2, 2008 #