Re: Conlang Proglangs
From: | H. S. Teoh <hsteoh@...> |
Date: | Friday, April 11, 2003, 3:45 |
On Thu, Apr 10, 2003 at 05:38:23PM -0600, Peter Clark wrote:
[snip]
> Well, the Enamyn had all died out or been assimilated into various
> Slavic tribes by the end of the 11th century, so they wouldn't have the
> foggiest clue about creating a programming language. However, I am
> confident that they would absolutely adore Python, and heap imprecations
> upon Perl. ;>
*distant evil cough* :->
[snip]
> Gee, that does sound like fun. To bad the Enamyn are dead. Hey, Teoh,
> what do Ebisedian computer languages look like? :)
[snip]
The era that Ebisedian is spoken in does not have the technological
sophistication to *have* computer languages. There is a technological age
later on, but by then, Ebisedian has split into three major families of
langs, and members of the family have diverged to far they look *nothing*
like the original lang.
Nevertheless, as a hypothetical exercise, it is relatively easy to design
an Ebisedian-like programming language. Objects like variables are
inflected for "case" (ala Perl >:-)) indicating whether it's an input or
output (originative/receptive), a lambda[1] (instrumental), something to
be acted on (conveyant), or a context/name (locative). Operations
correspond with verbs, of course; so statements would be any sequence of
operands plus a verb [2], and declarations would be a sequence of "nouns"
where their "case" declares of what type they are.
E.g. you can declare two things to be the same by a construction analogous
to Ebisedian's locative-locative:
@X @Y
means "let X and Y be equal".[3]
You can declare the type of something by a "nominalized" construction,
where you "inflect" one of the Funny Symbols for case, thus turning it
into a noun. For example, to declare X to be an input, you'd say:
@X @<
corresponding to "X(loc) input(loc)", which in Ebisedian grammar means "X
is an input".
To assign one thing to another (as opposed to declaring their mathematical
equality), you use a verb:
! :X >Y
Where "!", short for "bang" (as Peter would no doubt happily recall :-P),
is a generic operation/verb analogous to Ebisedian's _ka'k3_, and tells
the computer to do something. In this case, :X is in the conveyant case,
and >Y is in the receptive case, so it means "cause X's value to go into
Y". And since word order is free, you may write this as:
>Y :X !
which is closer to conventional programming languages' assignment
statement, which would be of the form "Y=X" and is read as "let Y be
assigned the value of X or else!" [5]
Of course, just as in human languages you tend to use specific verbs
rather than generic ones,[6] not all verbs look as funny as "!". Normal
verbs look quite ordinary. For example, you could say
draw :picture
to draw a picture, or
:picture draw
to do exactly the same thing, except it's more natural for OSV language
speakers. Like Postscript programmers. Or HP employees. ;-)
In a similar vein, arithmetic operations are simply verbs that look funny,
like the funny verb "!". So to add X and Y, you say... (ready?):
:X + :Y
Which looks pretty innocuous. Except that it can also be written
:X :Y +
if you're a Postscript programmer, or you're German, or
+ :X :Y
if you're a Lisp programmer. :-P
Well, on that note, Lisp programmers won't ever be happy until you give
them a way to nest things. Which is just as good, since the + operation,
like every other operation, can take an arbitrary number of operands. So
you can add 5 numbers by saying:
+ :n1 :n2 :n3 :n4 :n5
or any variant thereof, by moving the + wherever you felt like, since the
language doesn't care where its verbs appear. However, this means that you
can't combine two operations without introducing ambiguity; so this is
where subordinate clauses come in. They are notated with parentheses (),
to please our Lisp programmers. For example, the equivalent of "a*(b+1)-c"
would be:
:( * :a :( + :b :1 :) :) - :c
Which is read as "frowny stars and frowny plusses stick their tongue at
you once, and then smile, smile, and pout." Oh, umm... I mean... well, you
know what I mean. :-P The smileys^H^H^H^HI mean, colons on the
parentheses, indicate that the subordinate clause should function in the
conveyant case (ala Ebisedian, of course). You'd use other Funny Symbols
to indicate other functions. For example:
draw :picture >( locate @screen >)
assuming that "locate" is an operation that helps you find where the
screen is. @screen is, of course, in the locative case since it's the
subject of the search. The blind smileys >( and >) turn the result of this
operation into a destination for the operation "draw".
Another example to show the other "case" functions:
<file1 copy >file2
copies file1 to file2, assuming "copy" is an operation that copies files.
If they contain sensitive information, you might want to rephrase this as:
<file1 !carefully copy >file2
The prefix "!" indicates instrumental case, which according to Ebisedian
grammar is an adverb. So this statement says, "please copy file1 to file2
carefully". Or, if you want to simulate MICROS~1 software, you'd say
<file1 !carelessly copy >file2
assuming that the adverb "!carelessly" will occasionally corrupt your data
on its way from file1 to file2. :-)
Anyway, this is about it for now. If people are more interested, I might
be convinced to actually implement a compiler for this weird language.[7]
:-P
---------
[1] Computer theorist jargon for "function pointer".
[2] Without fixed order, of course. The "case" marking sufficiently
distinguishes the operands. After all, we want to inherit Ebisedian's free
word order. :-)
[3] Case markings are, of course, indicated by mnemonic symbols[4] that
indicate the function of the object in the statement or declaration. Oh,
and spaces are ignored.[4]
[4] TTPSNR. :-P
[5] The "or else" part indicates the imperative mood, of course, and
corresponds with the Bang, "!" in our prospective Ebisedic programming
language. :-)
[6] Unless you're a businessman, in which case you tend to use "leverage"
a lot; or you're a politician, in which case you use "negotiate" a lot;
or you're a mathematician, in which case you use "let" way too much. :-P
Or if you're a salesman, you use "buy" a lot.[8]
[7] Causing the world as Peter knows it to end. :-P
[8] Although "buy" isn't really a generic verb when spoken by normal
people. :-P
T
--
LINUX = Lousy Interface for Nefarious Unix Xenophobes.