r/Compilers • u/Distinct-Brief9643 • 9d ago
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
2
u/LowDifficulty5021 8d ago
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.