This post originated from an RSS feed registered with .NET Buzz
by Tim Sneath.
Original Post: Esoteric .NET Language Challenge
Feed Title: Tim Sneath's Blog
Feed URL: /msdnerror.htm?aspxerrorpath=/tims/Rss.aspx
Feed Description: Random mumblings on Microsoft, .NET, and other topics.
It's Friday afternoon, I'm bored with "conventional languages" such as C# and VB, so let's play a game! I've got four different code snippets from somewhat esoteric languages. They've only one thing in common - they can all be compiled with a .NET compiler into intermediate language. Can you guess a) what language each is, and b) what the snippets actually do?
I'll reveal the answers and the compilers in a couple of days if there's anything nobody can get! In ascending order of difficulty, then:
Snippet 1
<%@ page language="#omitted#" %> <script runat="server"> OBJECT. DATA DIVISION. WORKING-STORAGE SECTION. 77 FONT-SIZE PIC S9(9) COMP-5. END OBJECT. </script> <% PERFORM VARYING FONT-SIZE FROM 1 BY 1 UNTIL FONT-SIZE > 7 %> <font size="<%=FONT-SIZE%>">Nostalgia with a disturbingly novel twist...</font> <br> <% END-PERFORM. %>
This is fairly straightforward, I think.
Snippet 2
! This is the main program Program MultiDog use System use VirtualDog type (Dog) :: d type (Greyhound) :: g type (Labrador) :: l call d%RollOver() call g%RollOver() call l%RollOver() end program MultiDog
A little bit less obvious in terms of the language, but its meaning is pretty clear.
<html> <body> <H1>Can you guess what I do?</H1> <form runat=server> <asp:Button id="Pressme" Text="Press Me" runat="server" OnClick="Reverse" /> </form>;/form> </body> </html>
In this one, the language is a giveaway but it takes more skill to work out what the code is doing!
Snippet 4
400 constant bar
: foo \ Performs a mystery operation 2 begin over over mod 0= 0= rot rot dup >r over 2 / > 0= rot and r> swap while 1+ repeat over 2 / > ;
: main \ Entry point ."Values up to " bar . .": " limit 1 do i foo if i . space then loop ;