The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Esoteric .NET Language Challenge

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Tim Sneath

Posts: 395
Nickname: timsneath
Registered: Aug, 2003

Tim Sneath is a .NET developer for Microsoft in the UK.
Esoteric .NET Language Challenge Posted: Oct 1, 2004 3:24 PM
Reply to this message Reply

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.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Tim Sneath
Latest Posts From Tim Sneath's Blog

Advertisement

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.

Snippet 3

 <%@ page language="#omitted#" %>
<script runat="server">
 
   </script>
 
   <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
   ;

This is much harder to get right, I think...

Let the challenge commence :-)

Read: Esoteric .NET Language Challenge

Topic: What's wrong with this code (COM Interop)? Previous Topic   Next Topic Topic: Photos from Beijing Trip

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use