OscarRyz
OscarRyz

Reputation: 199274

Is there a programming language with no controls structures or operators?

Like Smalltalk or Lisp?

EDIT

Where control structures are like:

     Java                 Python               
 if( condition ) {     if cond:           
     doSomething           doSomething     
 }                                         

Or

     Java                Python                  
 while( true )  {        while True:            
     print("Hello");        print "Hello"      
 }                                            

And operators

 Java, Python
 1 + 2  // + operator 
 2 * 5  // * op

In Smalltalk ( if I'm correct ) that would be:

condition ifTrue:[
   doSomething
]

True whileTrue:[
   "Hello" print 
]
1 + 2 // + is a method of 1 and the parameter is 2 like 1.add(2) 
2 * 5 // same thing

Upvotes: 9

Views: 2978

Answers (18)

Jeremy
Jeremy

Reputation: 4848

  1. Assembly
  2. Befunge

Upvotes: 6

Earlz
Earlz

Reputation: 63895

Makefile syntax doesn't seem to have any operators or control structures. I'd say it's a programming language but it isn't Turing Complete (without extensions to the POSIX standard anyway)

Upvotes: 0

Norman Ramsey
Norman Ramsey

Reputation: 202645

Pure lambda calculus? Here's the grammar for the entire language:

e ::= x | e1 e2 | \x . e

All you have are variables, function application, and function creation. It's equivalent in power to a Turing machine. There are well-known codings (typically "Church encodings") for such constructs as

  • If-then-else
  • while-do
  • recursion

and such datatypes as

  • Booleans
  • integers
  • records
  • lists, trees, and other recursive types

Coding in lambda calculus can be a lot of fun—our students will do it in the undergraduate languages course next spring.

Upvotes: 4

Gabe
Gabe

Reputation: 86768

I'm not entirely clear on the concept, but I think PostScript meets the criteria, although it calls all of its functions operators (the way LISP calls all of its operators functions).

Upvotes: 0

Manos Dilaverakis
Manos Dilaverakis

Reputation: 5869

Prolog*

*I cannot be held accountable for any frustration and/or headaches caused by trying to get your head around this technology, nor am I liable for any damages caused by you due to aforementioned conditions including, but not limited to, broken keyboard, punched-in screen and/or head-shaped dents in your desk.

Upvotes: 4

Donal Fellows
Donal Fellows

Reputation: 137727

In Tcl, there's no control structures; there's just commands and they can all be redefined. Every last one. There's also no operators. Well, except for in expressions, but that's really just an imported foreign syntax that isn't part of the language itself. (We can also import full C or Fortran or just about anything else.)

Upvotes: 2

kennytm
kennytm

Reputation: 523574

How about FRACTRAN?

FRACTRAN is a Turing-complete esoteric programming language invented by the mathematician John Conway. A FRACTRAN program is an ordered list of positive fractions together with an initial positive integer input n. The program is run by updating the integer (n) as follows:

  1. for the first fraction f in the list for which nf is an integer, replace n by nf
  2. repeat this rule until no fraction in the list produces an integer when multiplied by n, then halt.

Of course there is an implicit control structure in rule 2.

Upvotes: 1

Matt Ellen
Matt Ellen

Reputation: 11612

I'll be first to mention brain**** then.

Upvotes: 2

PowerUser
PowerUser

Reputation: 11791

So... you're looking for a super-simple language? How about Batch programming? If you have any version of Windows, then you have access to a Batch compiler. It's also more useful than you'd think, since you can carry out basic file functions (copy, rename, make directory, delete file, etc.)

http://www.csulb.edu/~murdock/dosindex.html

Example

  1. Open notepad and make a .Bat file on your Windows box.
  2. Open the .Bat file with notepad
  3. In the first line, type "echo off"
  4. In the second line, type "echo hello world"
  5. In the third line, type "pause"
  6. Save and run the file.

If you're looking for a way to learn some very basic programming, this is a good way to start. (Just be careful with the Delete and Format commands. Don't experiment with those.)

Upvotes: -1

Thomas Eding
Thomas Eding

Reputation: 1

The SMITH programming language:

http://esolangs.org/wiki/SMITH

http://catseye.tc/projects/smith/

It has no jumps and is Turing complete. I've also made a Haskell interpreter for this bad boy a few years back.

Upvotes: 2

David
David

Reputation: 7153

How about Whenever?

Programs consist of "to-do list" - a series of statements which are executed in random order. Each statement can contain a prerequisite, which if not fulfilled causes the statement to be deferred until some (random) later time.

Upvotes: 0

Dan Rosenstark
Dan Rosenstark

Reputation: 69777

XSLT (or XSL, some say) has control structures like if and for, but you should generally avoid them and deal with everything by writing rules with the correct level of specificity. So the control structures are there, but are implied by the default thing the translation engine does: apply potentially-recursive rules.

For and if (and some others) do exist, but in many many situations you can and should work around them.

Upvotes: 0

Plynx
Plynx

Reputation: 11461

You mean without special syntax for achieving the same?

Lots of languages have control structures and operators that are "really" some form of message passing or functional call system that can be redefined. Most "pure" object languages and pure functional languages fit the bill. But they are all still going to have your "+" and some form of code block--including SmallTalk!--so your question is a little misleading.

Upvotes: 7

user187291
user187291

Reputation: 53950

how come you've never heard of lisp before?

Upvotes: 7

Kristopher Johnson
Kristopher Johnson

Reputation: 82545

Forth may qualify, depending on exactly what you mean by "no control structures or operators". Forth may appear to have them, but really they are all just symbols, and the "control structures" and "operators" can be defined (or redefined) by the programmer.

Upvotes: 3

Dave
Dave

Reputation: 1234

APT - (Automatic Programmed Tool) used extensively for programming NC machine tools. The language also has no IO capabilities.

Upvotes: 0

NibblyPig
NibblyPig

Reputation: 52952

What about Logo or more specifically, Turtle Graphics? I'm sure we all remember that, PEN UP, PEN DOWN, FORWARD 10, etc.

Upvotes: 2

Eimantas
Eimantas

Reputation: 49354

D (used in DTrace)?

Upvotes: 0

Related Questions