9

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
JJJ
  • 31,545
  • 20
  • 84
  • 99
OscarRyz
  • 184,433
  • 106
  • 369
  • 548

18 Answers18

7

how come you've never heard of lisp before?

user187291
  • 50,823
  • 18
  • 89
  • 127
  • 3
    Depends on exactly what the OP wants. `(if exp1 exp2 exp3)` and `(+ exp1 exp2)` are certainly what I'd call control structures and operators (since in many cases, control structures and operators are just a different name for functions). Lambda calculus with church numerals may be as close to what the OP (may) wants. – Svend Apr 28 '10 at 19:30
  • I have, but I don't know if `+` in `(+ 1 2)` is a function or a language-builtin operator. I think as per Svend comment, they are regular functions, I've updated the question to what I mean ( In Smalltalk ) – OscarRyz Apr 28 '10 at 19:36
  • 1
    @Oscar: In Common Lisp, there is a short list of special forms, which are basic things that you otherwise can't do in the language, like `if`. Everything else built of functions, either directly or by use of macros. However, I'd say that `if` is a control structure. – David Thornley Apr 28 '10 at 20:12
7

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.

Plynx
  • 11,041
  • 3
  • 30
  • 33
7
  1. Assembly
  2. Befunge
Jeremy
  • 4,625
  • 2
  • 19
  • 24
4

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.

OscarRyz
  • 184,433
  • 106
  • 369
  • 548
Manos Dilaverakis
  • 5,661
  • 4
  • 26
  • 56
4

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.

Norman Ramsey
  • 188,173
  • 57
  • 343
  • 523
3

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.

Kristopher Johnson
  • 76,675
  • 54
  • 235
  • 299
2

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

NibblyPig
  • 46,891
  • 62
  • 180
  • 311
2

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

Matt Ellen
  • 9,933
  • 4
  • 61
  • 80
2

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.

Thomas Eding
  • 31,027
  • 10
  • 64
  • 101
2

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.)

Donal Fellows
  • 120,022
  • 18
  • 134
  • 199
1

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.

kennytm
  • 469,458
  • 94
  • 1,022
  • 977
0

D (used in DTrace)?

Eimantas
  • 47,394
  • 15
  • 127
  • 164
0

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

Dave
  • 1,267
  • 13
  • 23
0

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.

Dan Rosenstark
  • 64,546
  • 54
  • 267
  • 405
0

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.

David
  • 6,665
  • 1
  • 39
  • 38
0

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).

Gabe
  • 79,868
  • 10
  • 131
  • 226
0

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)

Earlz
  • 57,517
  • 89
  • 275
  • 484
-1

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.)

Community
  • 1
  • 1
PowerUser
  • 11,080
  • 18
  • 57
  • 92
  • Why do you think that having no control structures and operators would make a language automatically simpler? Actually I think having not those standard syntactic structures, it makes a language a lot harder. So he is obviously not asking for a simple language. – poke Apr 28 '10 at 20:20
  • What about FOR, IF, GOTO, and CALL? Aren't those all control structures? And ``, and `|` sure look like operators to me. – Gabe Apr 28 '10 at 22:19
  • This guy isn't asking for a beginning programming language.. Also, he has 4k rep. I do hope that people just learning their first language can't get rep that easily. – Earlz Apr 28 '10 at 23:57
  • @Earlz, Yes, I did see his 4k rep. He didn't explain why he needed it, but I inferred that he was trying to teach his young child how to program. – PowerUser Apr 29 '10 at 15:58
  • @Poke, if he was trying to teach his child the concept of programming and making the computer do something by typing commands, then a batch file would be a good way to go. No, you can't get very far with it, hence my statement that this would be a good place to Start. – PowerUser Apr 29 '10 at 16:00
  • @Gabe, yes those are control structures, but you don't NEED them to make a beginner's batch file. If he was teaching his kid how to program, then those structures can wait for a later day. – PowerUser Apr 29 '10 at 16:03
  • Yes, that's the same argument SLC used for turtle graphics. By that token, though, don't nearly all languages have this property? – Gabe Apr 29 '10 at 16:26