r/ProgrammingLanguages • Nain. • 17m ago

Would a syntaxless programming language be possible?

So I had the idea of a syntaxless programming language where a function parses its form as it needs.

In this system, a parser is a function turning a description of the syntax to a kind of binding

parser: forms -> (given syntax) -> binding;

For example:

template ([a] is in between [min] and [max]) # binding
  := a >= min and a <= max; # lambda 

Idk just a cool idea. There are many problems with this (for starters, when do you know what parser to use?)

0 Upvotes

12 comments sorted by

1

u/titaniumalt 16m ago

how would you write said functions? more specifically, in what language?

1

u/Key_River7180 Nain. 12m ago

idk:

parser(parser ([forms... :[string]])) := parse input and make a parser

You'd need a bootstrapping one of some kind

1

u/titaniumalt 9m ago

yes, i am talking about said bootstrapping language, how would that work?

1

u/Albert_Custard 0m ago

By having a syntax

4

u/kohugaly 13m ago

I'm pretty sure this is just macros.

1

u/Key_River7180 Nain. 8m ago

similar yeah

4

u/mooglinux 7m ago

…so Lisp?

1

u/Mission-Landscape-17 8m ago

So you want a language that lets you add new syntax whenever? You can do this in Prolog.

1

u/Key_River7180 Nain. 8m ago

more or less

1

u/samanzaman 3m ago

Agda can do it as well ( in a quite sophisticated way). Their website should also have the relevant research papers

2

u/alaricsp 3m ago

FORTH has this. A word, when referenced during compilation, can be invoked "immediately" and access the input stream the compiler is compiling and do whatever parsing it wants, then compile code to do whatever needs doing at run time. For instance, the word " parses string literal syntax up to the next ", tucks the string away in memory, and then compiles code to push a pointer to it at run time to the stack, thereby providing string literals!

1

u/asdfa2342543 1m ago

So when you say “no syntax” i guess you mean no primitive tokens?  If so I’ve been trying something that fits that bill for a long time.  

The conclusion i came to is that there still is a syntax of a kind in the position.  There’s implicitly something like a data constructor with positional arguments.  However I still haven’t come up with a 100% nailed down semantics with literally 0 hardcoded tokens. I do suspect it’s possible after digging into some relevant math, computer science, and type theory.   Here’s a post about aspects of it:  https://spacechimplives.substack.com/p/computing-with-geometry