r/ProgrammingLanguages • • 27d ago

Requesting criticism Can a programming language dispense with parentheses and conventional syntactic delimiters?

Hello everyone,

I'm an independent french developer working on an experimental programming language called PLUSHIE, and I'd like to discuss an idea behind its design.

I am new to this communty and I am not familiar with the expected behavior here, so do not hesitate to tell me if I am wrong.

I also apologize for my english whcih is far from perfect.

Most programming languages rely on explicit syntactic delimiters: parentheses, commas, spaces, operators, keywords, etc.

I've been exploring a different approach: what if a language could rely primarily on the recognition and sequencing of a small vocabulary of words?

In PLUSHIE, the parser scans the input and identifies known words. Their sequence determines how instructions are interpreted. Unknown text between recognized words can also become new vocabulary.

The underlying computational model is deliberately minimal. Instructions operate on a chained memory structure, and the language is designed so that its own structures and interpretation mechanisms can be modified while running

This raises several questions I'd be interested in discussing:

o How expressive can a language become without conventional syntactic delimiters?

o What are the fundamental limitations of a word-based parsing model?

o Could such a design offer interesting advantages for reflection and self-modification?

o and especially, Are there existing languages or theoretical models that explore similar ideas?

I'm not claiming this is a better approach than conventional syntax. I'm interested in understanding its possibilities and limitations.

PLUSHIE is an ongoing experiment, and I'm particularly interested in unexpected ideas, alternative approaches and constructive criticism.

What do you think? Is this a worthwhile direction to explore, or am I overlooking some fundamental difficulties?

23 Upvotes

125 comments sorted by

View all comments

9

u/kniebuiging 27d ago

I think Forth might be an example, with stack basset approach.

Overall I wonder what the goal is, I am a lisp guy and I recently dabbled in self and felt somewhat lost du to the lack of delimiters just for the method call itself. And it still has block and method delimiters 

1

u/Pi-Plushie 27d ago

Thanks for bringing the question I should answer upfront ! If I don't explain my goal, I will just generate kind of frustration among real computing specialists. PLUSHIE has derived from LISP which was a puzzle for me a couple of decades ago. It is beautiful, small and so powerful. I wanted to truly understand how LISP functions work, how they can self refer etc... And I realised that I could build something even smaller (but less controllable) and tried to prove it was still Turing-complete.

My ultimate goal is to use PLUSHIE to understand how computing can build complexity (and more generally speaking get a model to understand how complexity arise in this world). PLUSHIE is a research tool aimed to help to see step by step how you can get from a stupid machine to something that is obviously more that the sum of its component.

And you are right, without clear delimiters, the langage is more confusing, not less. But that is not my purpose (no ambition to replace LISP)

4

u/arthurno1 26d ago

Mnjah, I don't think you can go more minimal than symbolic expressions and Lisp, without loosing expresivness. Lisp uses white spaces as and () as delimiters. If you shave off () then it becomes impossible to trace where an expression starts and where it ends. It is much easier when you have some start and end delimiter, like parens. Building nested expressions and having them independent of whitespaces is much easier with end delimiters. Otherwise you have to compensate with various rules and parsing techniques in the language which does not simplify, it just moves complexity elsewhere.

The other ingrediense that make Lisps such a simple languages to parse and build meta-facilities on is the uniformity of the syntax. Lisp normalize all sylyntax to one simple form: (operator oprand1 operand2 .... operandN). That makes it possible to build various constructions higher up the chain and is what makes it easy to manipulate parsed source code at the runtime. Compare to standard syntax where each small idiom has its own custom DSL with its own syntactic rules that have to be encoded in the parser.

It is very hard to beat Lisp syntax minimalism, without encoding implicit rules in the language and adding complexity elsewhere.

1

u/Pi-Plushie 25d ago

hello arthurno1. Sorry to answer to your post so late. You're just highlighting my questioning: at which point of simplification expressiveness is lost ? That is the fundamental question. PLUSHIE has a basic initial syntax even simpler than LISP. it is just repeating

Destination <-- Source

instruction (with <-- being a double indirection)

I have not yet built a LISP emulator in PLUSHIE but I haven't detected any obstacle so far.

But you are right: complexity is moved elsewhere, inside the code itself (which can modify itself, including the interpretor while running)

2

u/arthurno1 24d ago

That looks like a simplification compared to Lisp indeed, reminds of SSA form or assembly language. If you want something like that you can skip even <-- as in assembly, so you just have To From pair. I would though revert become From To is more natural flow, but it is up to you.

Now, it is hard to tell, since I don't know how the language looks like, but if you have some S (Source) and D (Destination) computations which might itself be complex and nested, each S and D consisting of multiple tokens, how it will look like? How will your parser know to which tokens belongs to S and which to D?

1

u/Pi-Plushie 24d ago

Thank you arthurno1. That is exactly where I started from, reasoning from LISP and Assembly (and also Von Neumann architecture for computers). The instructions goes indeed by pair of memory addresses as you say. One can choose upfront the order of those pairs to build a PLUSHIE system, but then have to stick to it for a while, until the system has been taught enough functions to be able to write its own interpreter. This is one of the symmetry of the system that you need to break in order to obtain something that does something.

I am not really good at explaining this. But the language is terribly simple in its behavior. The language does not compile. It executes a paired instruction as soon as it has identified one. Just like a primitive processor did at the lowest level. So it takes S D instructions one at a time, process it, which modifies the internal state of the machine. Then it takes the next one and so on. It is really reproducing the process of a primitive processor.

What is surprising is that this is enough to obtain "something" interesting which seems to (but is not proven yet) to be Turing-complete.

The "secret" of it is that the "copy" instruction is not Destination = Source, it is a double indirection (if Mem() is the one dimensional array emulating the memory)

the copy instruction translates as Mem(Mem(Destination ))= Mem(Mem(Source)).

The second necessary elements is that, just as it is for Lisp, memory blocks are constituted of 2 pointers in memory. Thus a given address gives access to 2 others

Without that, I do not think a complex system can reach Turing-completeness. (it is just like legos: if you have only pieces with one dot, you cannot build 3D structures. As soon as you have pieces with 2 dot you can build anything)

2

u/arthurno1 24d ago

Seems like you are more of the theory of computation than a programmign language. Lisp is also a bit like that: mathematical model that happens to also be a programming language. I think McCarthy thought of Lisp as alternative to Touring machine (don't take me for the word, I am perhaps wrong), and certainly as an alternative to lambda calculus.

You can certainly turn this into some simple PL too, similar in nature to assembly or SSA, where each "instruction" might be a complex None, but I think the notation is perhaps too simple for nesting expressions. But you could end up with some sort of "linear-equation"-like PL. Something like this:

D1 <-- a1 + ... + aN
D2 <-- b1 + ... + bN

S1 <-- D1 + D2
S3 <-- S2

etc ... I am perhaps too brief here; but if you would to nest those epxressions and both S and D could contain some S <-- S1 <-- ... <--- Sn <-- D <-- D1 <-- .... DN, it could be hard to express such a nesting, for both human and the parser. I don't know, haven't thought much, just an immediate thought.

Yes, that is a good metaphor with Legos (I have a 5 year old one and play lots of legos with her :)). I use to say something similar for linked structures, which really adapts 1:1 for symbolic epxressions: we need a pair in computing; two pieces of data to build complex structures. One slot for carrying the information we are computing and one for attaching it to other data. It is about pair or cons in lisp '(a . b) or (cons a b). With a pair we can build any linked data structure, trees, nested lists etc. The more branching we want in a tree, the more nesting we would need, so it is very verbose representation, but it is possible. A bit like DFA and NFA. Records and arrays are "implicitly" linked structures, because they don't need a physical slot, there is one "implicit", since slots are next to each other. A pair in data structures and computing is a bit like a triangle in computer graphics. It is interesting also that in lambda calculus we need a function and a slot as minimum: two pieces, but one is a slot and another an operation. To me by the way both lambda calculus and Lisp are Touring machines in disguise.

I might be wrong, it is just a ramblings, don't take it too serious.

2

u/Pi-Plushie 24d ago

This is a very interesting conversation and I think we share the same intuition about the importance in pair when you want to build something. What I tried to do with my single instruction is more or less an equivalent of building a processor using only NAND logical pieces. On top of this "2" magic, you can add a very intriguing fact: to build a computer you need 3 dimensions, not less. The wire needs 2 dimensions to build complexity but the NAND door need energy which cannot cross the data wires... Computing systems (including human brain) cannot exist in less than three dimensions. But I am going far away... lol

And, yes, the start of PLUSHIE is laborious with all the needed nesting of S<--D expressions. But as it learns new functions, it becomes easier and easier to build complex structures up to a point where you forget what is happening underneath. exactly what happens with advanced languages and modern processors

Of course, at start, PLUSHIE is slow (and I did not optimize the efficiency of the basic interpreter as the aim was to minimize it as much as possible (it occupies less than 300 cells of 2 long integers pointers). One could enter the relevant data one by one by with bare hands as in the old time (I would love to be part of the brilliant teams that started the era of computing). But then, PLUSHIE becomes able to modify its own structure completely so that you can build new parser / interpreter for PLUSHIE, in PLUSHIE, while it is running. That is where I am now.

Thank for these interesting thoughts. And enjoy playing with your little girl, these good times goes by too quickly.

I wish you the best.

2

u/arthurno1 24d ago

Computing systems (including human brain) cannot exist in less than three dimensions.

Four. Nothing exists without time. But yes we are going a bit too far here :) We are no longer in a programming language land and computing theoryc, but in philosophical and mathematical theory of what is possible. I don't know how those theories are called or classified, tbh.

Thank for these interesting thoughts. And enjoy playing with your little girl, > these good times goes by too quickly.

I wish you the best.

Thanks, I wish you the same!