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

18

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
Urethra answered 28/4, 2010 at 18:56 Comment(2)
Please define "operators" (and "control structures").Improvisation
Your question + first sentence reads: "Is there nothing that meets these criteria other than this thing that meets these exact criteria?"Gonzalogoo
F
7

how come you've never heard of lisp before?

Froissart answered 28/4, 2010 at 19:15 Comment(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.Ceiling
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 )Urethra
@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.Foskett
Q
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.

Quadric answered 28/4, 2010 at 19:20 Comment(0)
P
6
  1. Assembly
  2. Befunge
Partly answered 28/4, 2010 at 20:17 Comment(0)
L
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.

Lind answered 28/4, 2010 at 20:20 Comment(3)
+1 heheheh I was once near to a Prolog manual and I thought... mmmhhh maybe tomorrow.Urethra
@Oscar just the wikipedia page scared me away.Reasonable
It's a lot of fun to watch people who are new to both Prolog and vi try to learn both at the same time.Calipee
B
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.

Brassiere answered 28/4, 2010 at 23:45 Comment(0)
M
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.

Moribund answered 28/4, 2010 at 19:6 Comment(0)
U
2

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

Unshroud answered 28/4, 2010 at 19:1 Comment(4)
I made my first ever real program in this (or something very similar) :)Handset
IIRC, Logo is a dialect of LISP.Stutzman
@SLC: From your link, "Logo provides several common control structures". So I'd say that Logo does not meet the criteria of having no control structures.Scheller
@Scheller It depends on the version though, the version most people use for turtle graphics simply executes a list of drawing instructions.Unshroud
J
2

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

Jaclyn answered 28/4, 2010 at 19:39 Comment(1)
they are not structures they are commands. Otherwise the OP's example of small talk would be invalid.Jaclyn
A
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.

Adenovirus answered 28/4, 2010 at 20:9 Comment(0)
I
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.)

Invidious answered 28/4, 2010 at 20:22 Comment(0)
I
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.

Improvisation answered 28/4, 2010 at 19:19 Comment(0)
A
0

D (used in DTrace)?

Abut answered 28/4, 2010 at 18:59 Comment(0)
I
0

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

Idolla answered 28/4, 2010 at 19:5 Comment(0)
H
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.

Hyperextension answered 28/4, 2010 at 19:55 Comment(0)
F
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.

Foremost answered 28/4, 2010 at 20:8 Comment(0)
S
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).

Scheller answered 28/4, 2010 at 22:28 Comment(0)
R
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)

Reasonable answered 28/4, 2010 at 23:56 Comment(0)
R
-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.)

Rancho answered 28/4, 2010 at 20:4 Comment(7)
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.Heddie
What about FOR, IF, GOTO, and CALL? Aren't those all control structures? And <, >, and | sure look like operators to me.Scheller
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.Reasonable
@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.Rancho
@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.Rancho
@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.Rancho
Yes, that's the same argument SLC used for turtle graphics. By that token, though, don't nearly all languages have this property?Scheller

© 2022 - 2024 — McMap. All rights reserved.