This forum is closed to new posts due to low activity and a deluge of spam. It is kept online as a static historical record. If you want to read about or discuss esoteric programming languages, the Esolang wiki is the place to go. An archive of the forum is available.

Language idea: 2D Thue (30)

1 Name: Anonymous : 2005-11-07 22:20 ID:R3WeOeLR

How about a 2D Thue-like language? The program has access to a plane of characters, initialized with a rectangle of text read from stdin (extending lines with spaces to the length of the longest line), surrounded by infinite spaces on all sides. A series of rules would be executed, each of which matches a 2D block of text and replaces it with another block of text. At the end, the rectangle of text just large enough to include the upper-left and lower-right non-space characters is output to stdout.

Rule definitions could be indented with tabs to distinguish them from the matches and replacements:

	find
M
A
T
C
H
replace
SUBST
ITUTI
ON TE
XT :)
etc.
end

Replacements could actually be copied, thus allowing the non-space text to grow. An infinite loop if any as are input:

	find
a
replace +1,0
a
end

This would produce an infinite horizontal string of as, extending rightwards from the first one found. Or maybe not -- maybe it would keep finding the upper left a again and again, depending on how the match-finding is implemented. Either way, an infinite loop.

Replacements could be larger than their matches. The positioning of the
replacements would be based on the top left of the match. A space in a
match could match any character, and a space in a replacement would mean
"use the character that was in this position in the match". And
furthermore, character classes could be defined:

	find
BEER
replace
99 bottles of beer on the wall,
99 bottles of beer
END
end
	find N(0123456789)
N9 bottles of beer on the wall,
N9 bottles of beer
END
replace 0,+2
N8 bottles of beer on the wall,
N8 bottles of beer
END
end
	find N(0123456789)
N8 bottles of beer on the wall,
N8 bottles of beer
END
replace 0,+2
N7 bottles of beer on the wall,
N7 bottles of beer
END
end
	find N(0123456789)
N7 bottles of beer on the wall,
N7 bottles of beer
END
replace 0,+2
N6 bottles of beer on the wall,
N6 bottles of beer
END
end
	find N(0123456789)
N6 bottles of beer on the wall,
N6 bottles of beer
END
replace 0,+2
N5 bottles of beer on the wall,
N5 bottles of beer
END
end
	find N(0123456789)
N5 bottles of beer on the wall,
N5 bottles of beer
END
replace 0,+2
N4 bottles of beer on the wall,
N4 bottles of beer
END
end
	find N(0123456789)
N4 bottles of beer on the wall,
N4 bottles of beer
END
replace 0,+2
N3 bottles of beer on the wall,
N3 bottles of beer
END
end
	find N(0123456789)
N3 bottles of beer on the wall,
N3 bottles of beer
END
replace 0,+2
N2 bottles of beer on the wall,
N2 bottles of beer
END
end
	find N(0123456789)
N2 bottles of beer on the wall,
N2 bottles of beer
END
replace 0,+2
N1 bottles of beer on the wall,
N1 bottles of beer
END
end
	find N(0123456789)
N1 bottles of beer on the wall,
N1 bottles of beer
END
replace 0,+2
N0 bottles of beer on the wall,
N0 bottles of beer
END
end
	find
90 bottles of beer
END
replace 0,+1
89 bottles of beer on the wall,
89 bottles of beer
END
end
	find
80 bottles of beer
END
replace 0,+1
79 bottles of beer on the wall,
79 bottles of beer
END
end
	find
70 bottles of beer
END
replace 0,+1
69 bottles of beer on the wall,
69 bottles of beer
END
end
	find
60 bottles of beer
END
replace 0,+1
59 bottles of beer on the wall,
59 bottles of beer
END
end
	find
50 bottles of beer
END
replace 0,+1
49 bottles of beer on the wall,
49 bottles of beer
END
end
	find
40 bottles of beer
END
replace 0,+1
39 bottles of beer on the wall,
39 bottles of beer
END
end
	find
30 bottles of beer
END
replace 0,+1
29 bottles of beer on the wall,
29 bottles of beer
END
end
	find
20 bottles of beer
END
replace 0,+1
19 bottles of beer on the wall,
19 bottles of beer
END
end
	find
10 bottles of beer
END
replace 0,+1
09 bottles of beer on the wall,
09 bottles of beer
END
end
	find
00 bottles of beer
END
replace 0,+1
Time to buy some more beer!
end

Did I do that right? You'd type "BEER" and press Enter, and get the song, or you could type "BEER BEER" for two parallel copies of the song. Comments on this language idea?

2 Name: Keymaker : 2005-11-08 05:23 ID:wswuW41S

Neat idea! 2D Thue would be more difficult to program with, but I guess that's a plus. :)

3 Name: Jix : 2006-02-01 18:09 ID:y3lWAx33

Make it use images!

4 Name: Anonymous : 2006-02-01 18:23 ID:R3WeOeLR

>>3
A better thing to do is come up with a mapping between ASCII characters and colors. Then it can be used either way, like 1L. See "non-textual languages debunked" thread.

5 Name: Ihope127 : 2006-02-02 23:52 ID:4D2/ZBbY

I don't see why "raw" images wouldn't work. Could this be the first language defined to use a mixture of text and images? ;-)

6 Name: 4 : 2006-02-07 03:57 ID:R3WeOeLR

What are "raw" images and how do they differ from what I suggested?

7 Name: Ihope127 : 2006-02-18 21:10 ID:4D2/ZBbY

Just use images instead of strings.

8 Post deleted by moderator.

9 Post deleted by moderator.

10 Post deleted by moderator.

11 Post deleted by moderator.

12 Post deleted by moderator.

13 Post deleted by moderator.

14 Post deleted by moderator.

15 Post deleted by moderator.

16 Post deleted by moderator.

17 Post deleted by moderator.

18 Post deleted by moderator.

19 Post deleted by moderator.

20 Post deleted by moderator.

21 Post deleted by moderator.

22 Post deleted by moderator.

23 Post deleted by moderator.

24 Post deleted by moderator.

25 Post deleted by moderator.

26 Post deleted by moderator.

27 Post deleted by moderator.

28 Post deleted by moderator.

29 Post deleted by moderator.

30 Post deleted by moderator.

This thread has been closed. You can not post in this thread any longer.