r/ProgrammingLanguages • • 21d 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?

24 Upvotes

125 comments sorted by

View all comments

26

u/criloz tagkyon 21d ago

In my opinion, the syntax of the language has nothing to do with reflection and self-modification; the syntax is for humans and makes it pleasant for humans to read it, when you parse depends on the semantics of the language, you could end up with a language that looks like magic for the reader, and he would need to look it up for who-knows-which many files before understanding what is happening in the current reading context.

If you want self-modification, Lisp already exists, and it is pretty powerful. Build the frontend with structures that people are accustomed to and then lower it to Lisp internally.

4

u/Pi-Plushie 21d ago

I fully agree with you. My aim is to make the core of this language as small as possible. In PLUSHIE the programmer (i do not dare to use users) can chose is own way of presenting the language. Most of humans will chose some kind of visual delimiters but that is not a prerequisite of PLUSHIE.

But the current implementation is just like what you describe: looks like magic but quite hard to understand if the words chosen are not meaningfull for humans.

You've a point with LISP which is the closest structure language. PLUSHIE is using the same memory structure (two adresses memory atoms that are chained together). The main difference is that I am trying to get the language even smaller and still be able to do anything like LISP.

Currently PLUSHIE has a procedural flat aspect and could be compared to a LISP taht doesn'tuse parenthesis (and yes, it is still working).

Thank you so much for your participation in this discussion !

3

u/poorlilwitchgirl 20d ago

That sounds very similar to Logo, the teaching language most associated with "turtle graphics"-- it's literally just a Lisp without parentheses (although most versions of Logo have built-ins specifically designed for learning rather than practical usage). Every function must have a fixed arity to keep parsing unambiguous, and for complex programs it can become very difficult for a developer to visually parse (thus why it's mostly stayed a teaching language rather than a production language), but it can certainly be made to work exactly as you describe.

2

u/Pi-Plushie 19d ago

thank you for your comment that make me think I may have overlooked Logo as a toy code and did not dig deeper into it. PLUSHIE is also more of a learning / teaching / research rather than practical kind of language, so they may have more in common than I though

With all the suggestion I have received, I will need time to process, but these are very rich pieces of information and I thank the whole community here for that. I am just wondering why it took me some much time to step by here. I would have made tremendous progress earlier !

2

u/poorlilwitchgirl 19d ago

That makes a lot of sense. Beyond introducing newcomers to computer programming, the original purpose of Logo was specifically to teach the use of recursion within an interactive live environment, so its semantics were modeled on Lisp but its syntax dispensed with the parentheses in order to feel like an instructional language rather than mathematical notation. That can make long, complex programs really difficult to read, but the live environment aspect really encourages iteratively building small, named subroutines and steadily climbing levels of abstraction while observing the results after each change, so in practice as the language was intended to be used, it's quite readable and easy to understand. In that sense, it's a lot like another delimiter-free language, Forth, in that it can feel barbarian to use when trying to fit into a modern development pipeline, but feels quite natural when approached as an interactive operating environment instead.

1

u/Pi-Plushie 19d ago

Thank you very much for directing me to Logo. The article I have read speaks about emerging phenomena and link with biology and this is exactly the kind of thing I am seeking for. As Logo is a Turing-complete language, it may be easier for me to implement a logo emulator in PLUSHIE to get this Turing-complete proof !

No I need to dig into it and find a old, minimal, easy to implement source code.

2

u/poorlilwitchgirl 18d ago

If that's what excites you about Logo, then I should direct you to its spiritual successor, Smalltalk. Its designer, Alan Kay, was inspired by biology and the idea of large organisms being composed of semi-independent cells which coordinate via chemical signals.

In Smalltalk, which originated the concept of object-oriented programming, everything is an object, and objects can be further broken down into compositions of other objects. Objects in Smalltalk differ from those in C++ or other mainstream OO languages; in Smalltalk, an object is essentially a self-contained, interactive sub-program which can only interface with other objects by sending symbolic messages. Every object maintains its own private data and a set of "methods", which are programmed responses to specific symbols.

For example, 1 + 2 is evaluated by sending the message + 2 to the object associated with the symbol 1. The 1 object then checks to see if it has a method associated with the + symbol. It does, and that method requires a second argument, so the object associated with the symbol 2 is pulled in as the second argument. 1 and 2 both maintain a private binary representation, so conceivably the interpreter could now take those two binary values, perform the machine instruction to add them, and produce a new integer object as a result, and in most languages that's exactly what would happen; however, 1 is in charge here, and 1 knows nothing about 2 except what 2 tells it. So instead, 1 sends the asInteger message to 2; if 2 has a method associated with that symbol, then whatever it returns as a response is safe to perform low-level addition on. 2 gives up its binary value, 1 dispatches the machine op to actually perform the addition, then constructs the integer object 3 as its response to the original message, and the evaluation is complete.

This probably sounds like a lot of overhead, because it is, but it also makes Smalltalk incredibly flexible as a language. In the earliest version of Smalltalk, objects were even responsible for their own parsing, so messages were just raw byte streams passed between objects. That proved impractical for a 1970s language already running on top of interpreted Lisp, so the concept was abandoned before the language ever had an official release, but it shows just how radical Alan Kay's ambition for the language was.

If you want to learn further, I would suggest A Little Smalltalk by Timothy A. Budd. It's a bit dated (first published in 1987), but it walks through the construction of a simplified Smalltalk interpreter from first principles, including all of the details of low-level representation. It's honestly one of the best books I've read on programming language implementation, and it's readily available for free as a PDF if you just search Google for it.

1

u/Pi-Plushie 18d ago

Thank you for the reference of the book. Your explanations are clear and I am starting to understand the concept. I have the intuition this will be of great help for my ultimate goal of having several entities of PHUSHIE evolving and competing for the resources. That's for future but the Smalltalk object are very interesting in this perspective.