r/Compilers • u/Distinct-Brief9643 • Aug 23 '26
Are there languages like this?
A language that can create other languages
(so adding to itself) It's syntax is simple like python
And can do alot.
for example (placeholder)\[mesage\]
And it has many tutorials on YouTube
I would like it if you would respond.
I know there are languages like Hy , ruby should I try them?
0
Upvotes
19
u/redinktea Aug 23 '26
Lisp
11
u/AustinVelonaut Aug 23 '26
The Racket language was expressly designed to make creating new languages easier (good DSL support).
2
u/LowDifficulty5021 Aug 24 '26
If by "a language that can create other languages" you mean a language where you can extend the syntax and semantics and essentially build your own DSLs/languages inside it, Racket is probably the first thing I'd recommend.
Racket was specifically designed around "language-oriented programming." You can create new
#langlanguages, define new syntax with macros, and even change how source code is read and expanded. It's much closer to what you're describing than Ruby.Hy is also worth trying, especially if you already like Python. Hy is a Lisp dialect embedded in Python, so you get access to Python's ecosystem while gaining Lisp macros and metaprogramming. Its macros can generate/transform code at compile time, which is probably the part you'd find most interesting.
I'd rank them for your specific description:
And Racket has a surprisingly direct learning path: its official guide has dedicated chapters for Macros and Creating Languages, rather than treating language extension as some obscure advanced trick.
So if I were you, I'd try Racket first, then Hy. If the thing you're really fascinated by is making syntax like your
[message]example become meaningful code, Racket is almost exactly the rabbit hole you're looking for.1
u/Distinct-Brief9643 Aug 23 '26
Yes I could but there are requirements for that that I won't do tho
1
u/Distinct-Brief9643 Aug 23 '26
I've made my decision forth or lisp or another? Tell me with has simpler higher lvl syntax can add to itself with the lowest amount of code etc.
5
u/Key_River7180 Aug 23 '26
Lisp and Forth
1
u/Still_Explorer Aug 23 '26
You can look at PEG (tutorial by the creator of Python himself)
https://medium.com/@gvanrossum_83706/peg-parsing-series-de5d41b2ed60?sk=0a7ce9003b13aae8126a4a23812eb035
1
u/KAMEHAMEHAMEHAAAA Aug 23 '26
Why not Python? It is simple like Python, you can create a language with it, you can do a lot and you will find tutorials in YT for sure.
3
u/sookkit Aug 24 '26
I think you're severely confused.
2
u/neurah Aug 23 '26
compiled languages
Haskell, and I'm quite sure it can do so on the same translation unit
Zig can morph a lot, but not explored it
2
u/denzuko Aug 23 '26
https://github.com/denzuko/c-mera
Yes its called transpiling. And thats with lisp.
There is also the classic m4, yacc, and flex.
1
u/kniebuiging Aug 23 '26
RPython
1
u/denzuko Aug 23 '26 edited Aug 23 '26
Ah... read the thread. OP, you're needing a lesson in programming itself, not macro systems, LISP, or transpilers in S-expression.
The language of choice doesn't strongly matter, though. They are all third-gen languages (3GL), with SQL and Prolog/Datalog/Rego being 4GL and LLM prompts 5GL.
Lisp is a great language to choose, but you need the fundamentals first. Your master class, regardless of language, is with all of these:
Start with To Mock a Mockingbird, Let Over Lambda, PAIP, and Foundations of Databases.
By the time your done with those all programming questions answer themselves.
1
u/drinkcoffeeandcode Aug 24 '26
Smalltalk?
1
u/paultarvydas Aug 24 '26
Rebol was an early pioneer of embedded, user-definable DSLs, which it called âdialects.â
The most popular, commercial version of Rebol was 2.7. Rebol has morphed into "Red", which I know very little about.
Rebol inspired the invention of JSON.
1
u/lgastako Aug 25 '26
You might find Lean 4's metaprogramming capabilities of interest.
1
u/omegafixedpoint Aug 25 '26
protobuf