Author Topic: deliberately simple programming language  (Read 3863 times)

Zero

  • *
  • Autobot
  • ******
  • Posts: 201
  • Fictional character
    • AGI DEV LOG
deliberately simple programming language
« on: August 22, 2015, 04:31: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: [Select]
[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!

PRO|STAMINA [ programming game ]
AGI DEV LOG [ In Goto We Trust ]

ranch vermin

  • Not much time left.
  • *******
  • Starship Trooper
  • Posts: 386
  • Not much time.
Re: deliberately simple programming language
« Reply #1 on: August 22, 2015, 04:51: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, 09:07:12 PM by ranch vermin »
A bit from here, a bit from there, and bring it together and see the whole picture.

Zero

  • *
  • Autobot
  • ******
  • Posts: 201
  • Fictional character
    • AGI DEV LOG
Re: deliberately simple programming language
« Reply #2 on: August 22, 2015, 09:38: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?
PRO|STAMINA [ programming game ]
AGI DEV LOG [ In Goto We Trust ]

8pla.net

  • *
  • Replicant
  • ********
  • Posts: 693
    • 8pla.net
Re: deliberately simple programming language
« Reply #3 on: August 22, 2015, 11:40:51 PM »
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: [Select]
[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.
  • *******
  • Starship Trooper
  • Posts: 386
  • Not much time.
Re: deliberately simple programming language
« Reply #4 on: August 23, 2015, 01:24: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.

A bit from here, a bit from there, and bring it together and see the whole picture.

Zero

  • *
  • Autobot
  • ******
  • Posts: 201
  • Fictional character
    • AGI DEV LOG
Re: deliberately simple programming language
« Reply #5 on: August 23, 2015, 05:41: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: [Select]
// 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: [Select]
[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, 06:28:08 AM by Zero »
PRO|STAMINA [ programming game ]
AGI DEV LOG [ In Goto We Trust ]

8pla.net

  • *
  • Replicant
  • ********
  • Posts: 693
    • 8pla.net
Re: deliberately simple programming language
« Reply #6 on: August 24, 2015, 04:45: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

  • *
  • Replicant
  • ********
  • Posts: 693
    • 8pla.net
Re: deliberately simple programming language
« Reply #7 on: August 24, 2015, 05:32: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: [Select]

<?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

  • *
  • Autobot
  • ******
  • Posts: 201
  • Fictional character
    • AGI DEV LOG
Re: deliberately simple programming language
« Reply #8 on: August 24, 2015, 08:55: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: [Select]
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: [Select]
[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!
:)

PRO|STAMINA [ programming game ]
AGI DEV LOG [ In Goto We Trust ]

ivan.moony

  • *
  • Replicant
  • ********
  • Posts: 643
  • look, a star is falling
Re: deliberately simple programming language
« Reply #9 on: August 24, 2015, 11:55:16 AM »
How about "Simplite", "Simplique", "Simplicity" or "Simplelog"?

Zero

  • *
  • Autobot
  • ******
  • Posts: 201
  • Fictional character
    • AGI DEV LOG
Re: deliberately simple programming language
« Reply #10 on: August 24, 2015, 01:50:02 PM »
Not bad!  3 of them are already used: "Simplite", "Simplique",  "Simplelog". Simplicity is maybe too general, isn't it?
PRO|STAMINA [ programming game ]
AGI DEV LOG [ In Goto We Trust ]

8pla.net

  • *
  • Replicant
  • ********
  • Posts: 693
    • 8pla.net
Re: deliberately simple programming language
« Reply #11 on: August 24, 2015, 02:36: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

  • *
  • Autobot
  • ******
  • Posts: 201
  • Fictional character
    • AGI DEV LOG
Re: deliberately simple programming language
« Reply #12 on: August 24, 2015, 02:56: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?
PRO|STAMINA [ programming game ]
AGI DEV LOG [ In Goto We Trust ]

8pla.net

  • *
  • Replicant
  • ********
  • Posts: 693
    • 8pla.net
Re: deliberately simple programming language
« Reply #13 on: August 24, 2015, 04:48: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

  • *
  • Replicant
  • ********
  • Posts: 643
  • look, a star is falling
Re: deliberately simple programming language
« Reply #14 on: August 24, 2015, 05:15: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.

 

Welcome

Please login or register.



Login with username, password and session length
What do you call reality ?
by Data (General Chat)
Today at 01:57:44 PM
The last invention.
by LOCKSUIT (General Project Discussion)
Today at 12:15:14 AM
Commuter traffic have you at your wits end?
by Art (General Chat)
January 22, 2017, 03:13:37 AM
Hi.
by Art (New Users Please Post Here)
January 22, 2017, 02:33:02 AM
Existential threat by AI
by LOCKSUIT (General AI Discussion)
January 19, 2017, 09:45:30 PM
Robotic / tech bandwagons
by Freddy (General Robotics Talk)
January 19, 2017, 04:56:45 PM
Sinclair Computer
by Freddy (General Chat)
January 19, 2017, 04:33:15 PM
Toothpick in the bellybutton...
by yotamarker (General AI Discussion)
January 18, 2017, 05:56:53 PM
Ethics — the next frontier for artificial intelligence
by Tyler (AI News )
Today at 04:50:31 PM
The Drone Center’s Weekly Roundup: 1/23/17
by Tyler (Robotics News)
Today at 04:50:31 PM
Robots Podcast #226: Robots Podcast #226: Toru robots, with Dr. Moritz Tenorth, with Dr. Moritz Tenorth
by Tyler (Robotics News)
January 22, 2017, 10:49:36 AM
Combining automation and mobility to create a smarter world
by Tyler (Robotics News)
January 21, 2017, 10:48:47 AM
Responsive and Responsible Leadership given prominance at #WEF17 World Economic Forum
by Tyler (Robotics News)
January 21, 2017, 04:49:22 AM
NHTSA ODI report exonerates Tesla in fatal crash
by Tyler (Robotics News)
January 20, 2017, 10:49:02 PM
How AR technology can help farmers stay relevant
by Tyler (Robotics News)
January 20, 2017, 04:48:08 PM
Self-driving robots will start making deliveries for Postmates and DoorDash in select US cities
by Art (AI News )
January 20, 2017, 02:16:54 PM

Users Online

36 Guests, 0 Users

Most Online Today: 32. Most Online Ever: 208 (August 27, 2008, 08:24:30 AM)

Articles