deliberately simple programming language

  • 25 Replies
  • 10078 Views
*

Zero

  • Eve
  • ***********
  • 1287
deliberately simple programming language
« on: August 22, 2015, 05:43:36 pm »
Hi,

I'm working on a language that would be simple to learn. I teach IT in a training center (mostly MS products), and I noticed that what people find hard is:
- nested parentheses hell (3 is already hell, we don't do LISP ;) )
- the fact that a function name precedes parentheses
- function parameters have precise syntax, where order matters

For example, I often see things like:
=if(A1="ok";and;B1<0;C1;D1)
You can feel what was intended.


So, I put strong constraints on the language expressiveness, just to see where it leads.

It looks a bit like INI files.
You start function definition with the name of the function between square brackets.
You have only one command per line
Commands only take one argument, which is always a string
Syntax is "function: argument"
You can call functions inside parentheses, with the same syntax
You CANNOT nest parentheses
You can access variable by their name between angle brackets
You CANNOT nest variable names
Inside a function's body, argument is accessed through empty variable name <>
The return value of last command is always stored in variable <this>
That's it

Here is a taste.


Code
[repeat twice]
render: <> <>

[main]
about: cars
print: Now "this" means <this>
about: language
store this in: some variable
print: what a (repeat twice: really) awful programming <some variable>

==> Now "this" means cars
==> What a really really awful programming language



[pattern match]
parse this as: * isn't *
wildcard in: first
wildcard in: second
render: 1st is <first> and 2nd is <second>

[main]
print: (pattern match: parsing isn't that hard)

==> 1st is parsing and 2nd is that hard


[about]
new meaning of "this"

[render]
choose result value

[store this in]
store value of "this" in named variable

[print]
write text on screen

[parse this as]
do pattern matching on sentence

[wildcard in]
store capture in named variable



This language is intended to be used to code agent behavior in a multi-agent middleware, probably hosted in CouchDB, inspired from a previous work. Feel free to borrow bits and pieces!


*

ranch vermin

  • Not much time left.
  • Terminator
  • *********
  • 947
  • Its nearly time!
Re: deliberately simple programming language
« Reply #1 on: August 22, 2015, 06:03:11 pm »
getting rid of nesting is a good idea.

Looks like natural language like programming crossed with assembler? - which is what (the original) BASIC pretty much was intended to be.

I started off in basic, I was too girly for assembler, learnt a little pascal, then skipped over to C as quick as I could and avoided C++ - and went to shader programming instead.

And here I am now - with 2048 stream processors - going to make the content addressable memory of a decade.

blah... blah.. blah...  give a brain to my roomba... blah blah blah :)

Noisette looks cool -   Pattern matching languages are great.  Logic paradigm.
« Last Edit: August 22, 2015, 10:19:12 pm by ranch vermin »

*

Zero

  • Eve
  • ***********
  • 1287
Re: deliberately simple programming language
« Reply #2 on: August 22, 2015, 10:50:56 pm »
Indeed, this language is a bit like verbose assembly. With a lot of synonyms (store this in = store this as = call it = name this = remember this as = we'll call this = ...etc), it could reach a certain degree of flexibility, like NLP. Time will tell.

I don't know much about shader programming, but it sounds interesting. Do you use it for AI-related things? What shading language do you use? I just read on wikipedia that some shading languages are very low-level, like ARB. Then, do you think this "NLP crossed with assembly" thing could be executed on GPU?

Quote
And here I am now - with 2048 stream processors - going to make the content addressable memory of a decade.

Didn't get it. What are you going to make?


EDIT: Is there a shading language that supports strings?! GLSL supports arrays, so it should be possible. Am I right?

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1302
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: deliberately simple programming language
« Reply #3 on: August 23, 2015, 12:52:51 am »
You said, "Commands only take one argument, which is always a string"

My question is, how would recursion be supported with only one argument?

My informal suggestion:

Code
[recurse thrice]
split: thrice
random: thrice
render: <random>

[main]
about: recursion
print: pseudocode
about: AI
store <Zero> in: friend
print: response (recurse thrice: hello|greetings|howdy) to you too <friend>

My Very Enormous Monster Just Stopped Using Nine

*

ranch vermin

  • Not much time left.
  • Terminator
  • *********
  • 947
  • Its nearly time!
Re: deliberately simple programming language
« Reply #4 on: August 23, 2015, 02:36:07 am »
Not supporting recursion is not such a bad thing,  since recursion taken to the hardware is polling the transistors, so it only gets to 3gigahertz and then its dead... no more scaling.

Shader programming for ai?  Sure thing,  next to custom 1-0 hardware its the best you have for a basic consumer system.    If you wanted to handle strings, you have to treat them like binary pictures,   youll find any data type will make an image of some kind and it makes no difference.


*

Zero

  • Eve
  • ***********
  • 1287
Re: deliberately simple programming language
« Reply #5 on: August 23, 2015, 06:53:07 am »
Quote
Shader programming for ai?  Sure thing,  next to custom 1-0 hardware its the best you have for a basic consumer system.    If you wanted to handle strings, you have to treat them like binary pictures,   youll find any data type will make an image of some kind and it makes no difference.

Cool. It's definitely worth investigating! I like pattern matching, and I also like cellular automata. Hey, we should do a pattern matching-based cellular automata  :D

Quote
You said, "Commands only take one argument, which is always a string"
My question is, how would recursion be supported with only one argument?

Do we need more than one argument to recurse? (and no one told me?)

Code
// 1. if n is 0, return 1
// 2. otherwise, return [ n × factorial(n-1) ]

[factorial]
if: <> eq 0                        // test if argument is zero
render: 1                          // if yes, return 1
end: if                            // end of if block
about: <>                          // put argument in <this>
decrement: 1                       // put <this>-1 in <this>
store this in: arg                 // put <this> in <arg>
about: <>                          // put argument in <this>
multiply by: (factorial: arg)      // put <this> times factorial of <arg> in <this>
render: <this>                     // return <this>

[main]
print: Please choose a positive number:
input: <num>
print: Factorial of <num> is (factorial: <num>)

It seems to work. What do you think? Actually, I'm cheating: <this> (which is the result of previous command) often acts as implicit second argument. Example: "store this in". See?

EDIT: Since it's based on string substitution, we can still so a few funny things. String substitution happens before command is executed, so:

Code
[Put function in variable]
about: print
store this in: foo
<foo>: hey!

[use function result as variable name]
print: now I'll <(choose what to do: next)>

[use function result as function]
(choose what to do: next): with something

Maybe I should be more strict about these.

And I'd like to get rid of code blocks. I don't like this "if/end if" thing. Shall we dare evil gotozzz?

« Last Edit: August 23, 2015, 07:40:08 am by Zero »

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1302
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: deliberately simple programming language
« Reply #6 on: August 24, 2015, 05:57:06 am »
You asked, "Shall we dare evil gotozzz?"
My answer is, "Oh yeah!  I love goto statements."
Goto statements are back in PHP.

Oh, you're right!  I forgot the goal was to keep it simple,
which is a nice goal.   I must have been thinking about
tail-recursive optimization.

But, in general I was asking about recursion, since it
may come in handy for intermediate chatbot design.

Good response.  Thanks!
My Very Enormous Monster Just Stopped Using Nine

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1302
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: deliberately simple programming language
« Reply #7 on: August 24, 2015, 06:44:12 am »
Please help me port my bits and pieces
in the comments (to the right of my PHP).
Note: I may have implemented this Tail-recursive
optimization a little different for A.I. research.

The comments are pseudo code surrounded
by: /* comments_go_here */  I took an educated
guess on the else statement as well as on other
syntax in your language.

By the way, what's your language called?

Thanks!

Code

<?php

/* Tail-recursive optimization  */


function tro($arg, $this) {          /* [tro]                   */
if($arg <= 1){                       /* if: <> le 1             */
  echo "$arg ";                      /* print: <arg>            */
  return $this;                      /* render: <this>          */
  }else{                             /* else:                   */
  echo "$arg $this\n";               /* print: <arg> <this>     */
  return tro($arg-1, $this * $arg);   
                                     /* decrement: 1            */
                                     /* store this in: arg      */
                                     /* about: <>               */
                                     /* multiply by: (tro: arg) */
                                     /* render: <this>          */
  }
}

echo tro(8,1)."\n";

?>


   PHP OUTPUT:

   8 1
   7 8
   6 56
   5 336
   4 1680
   3 6720
   2 20160
   1 40320


My Very Enormous Monster Just Stopped Using Nine

*

Zero

  • Eve
  • ***********
  • 1287
Re: deliberately simple programming language
« Reply #8 on: August 24, 2015, 10:07:37 am »
Hi,

Well, since there's only one argument, you cannot access what was <this> when you called the function from inside the function. You have to insert $this in $arg.
So I guess that a line by line translation would be:

Code
function tro($arg, $this) {          /* [tro]                     */
                                     /* parse this as: *,*        */
                                     /* capture in: $a            */
                                     /* capture in: $t            */
if($arg <= 1){                       /* if: <$a> le 1             */
  echo "$arg ";                      /* print part: <$a>\s        */
  return $this;                      /* render: <$t>              */
  }else{                             /* else:                     */
  echo "$arg $this\n";               /* print line: <$a> <$t>     */
                                     /* about: <$a>               */
                                     /* decrement: 1              */
                                     /* store this in: $deca      */
                                     /* about: <$t>               */
                                     /* multiply by: <$a>         */
                                     /* store this in: $mult      */
  return tro($arg-1, $this * $arg);  /* render (tro: $deca,$mult) */
  }                                  /* end: if                   */
}

                                     /* [main]                    */
echo tro(8,1)."\n";                  /* print line: (tro: 8,1)    */

But it all depends on your base instruction set. For example, for a multi-agent middleware, here is a work-in-progress instruction set:

Code
[about]                           // Put argument in <this>
[anyway]                          // Stop skipping commands, and put argument in <this>
[render]                          // Choose return value

[when message matches]            // Start skipping commands if message doesn't match argument
[when message doesn't match]      // Start skipping commands if message matches argument

[send]                            // Send argument to every followers
[send to myself]                  // Send argument to myself
[send to my tables]               // Send argument to agents owning links where I'm involved

[forget this in]                  // Delete everything that matches a pattern in a variable
[push this in]                    // Push <this> in a variable
[pop from]                        // Pop <this> from a variable
[unshift this in]                 // Push <this> at the other end in a variable
[shift from]                      // Pop <this> from the other end in a variable
[rotate]                          // Rotate list stored in a variable
[when something in this matches]  // Start skipping commands if nothing in a variable matches argument
[when nothing in this matches]    // Start skipping commands if something in a variable matches argument
[pick a random element from]      // Pick a random element from a variable

[put capture in]                  // Put what next wildcard has captured in a variable

[list agents having this once in] // List of agents having this pattern in given key
[list agents having only this in] // List of agents having this pattern in given key
[list used variables]             // List of every variable

[if all identical]                // Parse argument if everything in this is the same
[if one different]                // Parse argument if something in this is not the same

[for each one]                    // Put next element in this, parse argument, do it again

<message>                         // The current message
<message sender>                  // Id of agent who sent current message
<me>                              // Id of me

[follow input of]
[follow output of]
[follow upput of]
[follow action of]

In that case, instead of raw recursion, an agent would probably send a message to itself about the next iteration, which is a bit like tail recursion. I'm working on a Nodejs implementation currently.



About the name, I don't know yet, so if you guys have ideas, they're welcome!
:)


*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1723
    • mind-child
Re: deliberately simple programming language
« Reply #9 on: August 24, 2015, 01:07:16 pm »
How about "Simplite", "Simplique", "Simplicity" or "Simplelog"?

*

Zero

  • Eve
  • ***********
  • 1287
Re: deliberately simple programming language
« Reply #10 on: August 24, 2015, 03:02:02 pm »
Not bad!  3 of them are already used: "Simplite", "Simplique",  "Simplelog". Simplicity is maybe too general, isn't it?

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1302
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: deliberately simple programming language
« Reply #11 on: August 24, 2015, 03:48:10 pm »
How about PL/S or PL/DS?

The PL usually stands for "Programming Language".

I don't believe either of these are taken..

Already taken:

PL/0
PL/B
PL/C
PL/I - ISO 6160
PL/M
PL/P
PL/SQL

Reference: List of programming languages
https://en.wikipedia.org/wiki/List_of_programming_languages


@ivan: Nice recommendations!

My Very Enormous Monster Just Stopped Using Nine

*

Zero

  • Eve
  • ***********
  • 1287
Re: deliberately simple programming language
« Reply #12 on: August 24, 2015, 04:08:39 pm »
Thank you both! What would PL/DS stand for?

PL/Simple...

Also I thought, something with ASM inside...


EDIT: is PL/Simplicity good?

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1302
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: deliberately simple programming language
« Reply #13 on: August 24, 2015, 06:00:01 pm »
Thank you both! What would PL/DS stand for?

D=deliberately
S=simple
P=programming
L=language

PL/DS = Programming Language/Deliberately Simple

Yes, the "Simplicity" recommendation by ivan is very nice.

I don't think PL/S is taken yet?
 
My Very Enormous Monster Just Stopped Using Nine

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1723
    • mind-child
Re: deliberately simple programming language
« Reply #14 on: August 24, 2015, 06:27:36 pm »
I think that the most important thing when naming a product is its correlation with a web search engine. If you are lucky, user will probably read the name somewhere, enter it into a search engine and click onto few of the first results to reach you. And once you have their attention... they're all history if you manage impress them. And the name of the product is where impression starts.

I've spent entire three days googling for absence of names when I was choosing name for my language. Everything was taken, from Synth, over Metacog to Transcript and a dozen of other ear-catchy names. Everything good was already taken. So I settled down with "Coglog", but I abandoned it after a month. Then it was "Transfigure" and more recently I've got another more descriptive name: "Metafigure". I like the new name because my language deals with mutable figures of data. Yet to be seen where I'll end up with these names, I have the time 'till I program it.

 


OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am
Nvidia Hype
by 8pla.net (AI News )
December 06, 2023, 10:04:52 pm
How will the OpenAI CEO being Fired affect ChatGPT?
by 8pla.net (AI News )
December 06, 2023, 09:54:25 pm
Independent AI sovereignties
by WriterOfMinds (AI News )
November 08, 2023, 04:51:21 am
LLaMA2 Meta's chatbot released
by 8pla.net (AI News )
October 18, 2023, 11:41:21 pm

Users Online

181 Guests, 0 Users

Most Online Today: 259. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles