views:

171

answers:

6

Is there a programming language that uses inflections (suffixing a word to add a certain meaning) instead of operators to express instructions? Just wondering.

What I am talking about is using inflections to add a meaning to an identifier such as a variable or type name. For example:

native type integer

var x : integer = 12
var location : integers = 12, 5, 42
say 0th locationte to_string (( -te replaces "." operator. prints 12 ))
+6  A: 

This is partially facetious, but... assembly language? Things like conditional jump instructions are often variations on a root ("J" for jump or whatnot) with suffixes added to denote the associated condition ("JNZ" for jump-if-not-zero, et cetera).

Amber
That's a fair answer. There are also the operand size suffixes of many assemblers.
wallyk
For ARM assembly, even ordinary instructions can be made conditional by suffixes. E.gADD r0, r1, r2 ; sets r0 = r1 + r2ADDEQ r0, r1, r2 ; sets r0 = r1 + r2 only if zero flag is set.
Sid H
A: 

Of the 40 or so languages I know, the only thing that comes to mind is some rare SQL implementations which include friendly aliases. For example to select a default database after connecting, the standard is USE <some database name> but one I used somewhere which also allowed USING <some database name>.

wallyk
+1  A: 

Presumably any programming language that uses natural language explicitly or closely as a basis, e.g., Natural-Language Programming. There was some research done at MIT into using English to produce high-level skeletons of programs, which is more in the realm of natural-language processing; the tool they created is called Metafor.

As far as I know, no existing language has support for, say, modifying or extending keywords with inflection. Now you've got me interested, though, so I'm sure I'll come up with something soon!

Jon Purdy
+5  A: 

I think Perligata (Perl in Latin) is what you're looking for. :) From the article

There is no reason why programming languages could not also use inflexions, rather than position, to denote lexical roles.

Here's an example program (Sieve of Eratosthenes):

    #! /usr/local/bin/perl -w
    use Lingua::Romana::Perligata;
    maximum inquementum tum biguttam egresso scribe.
    meo maximo vestibulo perlegamentum da.
    da duo tum maximum conscribementa meis listis.
    dum listis decapitamentum damentum nexto
        fac sic
            nextum tum novumversum scribe egresso.
            lista sic hoc recidementum nextum cis vannementa da listis.
        cis.
Gabe
eek, what is that \*points*
Tor Valamo
This seems interesting, but for the sake of those not fluent in latin it would be cool to have a synopsis, or maybe some English comments.
intuited
A translation is right under the example at http://www.csse.monash.edu.au/~damian/papers/HTML/Perligata.html#Putting_it_all_together_a_Gre
dan04
A: 
  • FORTRAN uses the first letter of the name to determine the type of an implicitly-declared variable.
  • COBOL has singular and plural versions of its "figurative constants", e.g. SPACE and SPACES.
dan04
+2  A: 

The excellent (dare I say fascinating) game-design language Inform 7 is inflected like English. But it's so closely integrated with a host of other design decisions that it's hard to peel away as a separate feature.

Anyone who is interested in language designs that are unusual but successful should check out Inform 7.

Norman Ramsey
One specific example of Inform 7's inflections is in the relation syntax. You can define abstract relations between objects, such as a "love" relation between people, and then use syntax such as "if John is loving Marsha", which is different from "if John is loved by Marsha" or "if John has loved Marsha".
Jesse McGrew