r/ProgrammingLanguages • Nain. • 1h 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

20 comments sorted by

View all comments

2

u/pthierry 21m ago

In theory, this is probably possible. You could attach a parser to an identifier, and when one such parser says it's done, you look for the next identifier.

The issue is that it makes the language unreadable, and worse, impossible to apply syntax highlighting, because only the local parser knows where it stops.

1

u/NomagnoIsNotDead 20m ago

This is a problem with FORTH! You can't hope to properly syntax-highlight a real codebase because any random word/function can hijack the input stream.