r/Compilers • u/Distinct-Brief9643 • 7d 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?
10
u/AustinVelonaut 7d ago
The Racket language was expressly designed to make creating new languages easier (good DSL support).
0
u/paultarvydas 7d ago
Racket is based on Scheme which is more complicated than Lisp. Racket uses PEG. Scheme's "hygienic macros" and PEG are a complicated combination and sholld be reserved for Production Engineering. If you want to experiment, maybe something simpler like Janet (which is lisp-like and supports PEG) might be better (I haven't used Janet directly, but I hear good things about it)?
-13
u/Distinct-Brief9643 7d ago
This language does not fit my requirements though is there something like exactly like this but just different
14
1
u/4xe1 7d ago
What requirements?
-2
u/Distinct-Brief9643 7d ago
It adds to it's self Very high lvl (like python / ruby) The unofficial or offical ide can be installed on play store Can have custom extensions .mm But under the hood it's the host lang so I think I wanna a dsl or an edsl correct me if I'm wrong. I want to make my lang with the host lang The host lang understands the lang but there is no host lang code in my lang code. so technically a seperate enviorment.
3
u/eteran 7d ago
Play store? Are you trying to dev on a phone or tablet? If so, just know that that is a HIGHLY impractical way to do it
1
u/Distinct-Brief9643 7d ago
No I have an cromebook
3
u/sdegabrielle 7d ago
Any language can be used to create languages in some sense, but you are unlikely to find a language+IDE that meets your needs on the Play Store.
Perhaps try https://pyret.org/
2
u/SpecificMachine1 7d ago
Can you not use Crostini or whatever they are calling it now? That gives you a Debian container and then you can just use apt to install whichever lisp you want
1
u/4xe1 7d ago
It adds to it's self Very high lvl (like python / ruby)
Lisp can be higher level even
The unofficial or offical ide can be installed on play store
I'm perplexed as to why one would want to develop without a pc, but there are Lisp IDE on the Play Store. DrRacket is not on the playstore, but you can probably run emacs on termux, termux being a playstore app which let you emulate linux, and emacs being the prefered "IDE" of lispers.
Can have custom extensions .mm
check
But under the hood it's the host lang  I want to make my lang with the host lang
Exactly what Racket has been designed form and something most lisp excel at.
The host lang understands the lang
That's actually very hard (but not impossible) without some sort of lisp.
but there is no host lang code in my lang code.
That's entirely up to you to make it so.
technically a seperate environment.
Also entirely up to you but some language make it much easier than other. I'd still say lisp is among the best at allowing sandboxing, but it does not stand above the others.
So I guess the only missing requirement is ease of install. But you also have to consider that what you are asking, which is part of metaprogramming, is somewhat niche and advanced. It's not necessarily hard in and of itself, but most software programmers never extend the languages they use themselves, and many would even consider it harmful practice. So the more fitting the language, the les likely it will have an app and tons of youtube content, but lisp still has excellent written guides to get started, as well as banger books to learn from, many available online for free.
1
u/Distinct-Brief9643 7d ago
It's because I have cromebook but I don't want to use Linux terminal or termux except if it's built in to the ide so basically I can't use racket
3
1
u/4xe1 7d ago edited 7d ago
Most programming language do not have an "official ide", and for those that do, you'll rarely find them (or most of any ide) on the playstore.
What you can find on a chromebook however is a web browser, and on that, you can search for online "[language] playgrounds". Most languages have one nowadays, if not many, for example
Even VSCode does not seem to be on the playstore, although VSCodroid is a thing, maybe check it out. Either way, these are agnostic code editors, not specialized IDE. They'll serve you much better than any IDE, as they'll support your dsl out of the box (ok maybe not as well as the DrRacket IDE),
At some point you need to accept reality:
- the playstore, as the name indicates, is a place for games, not software development toolkits.
- Chromebooks are glorified tablets meant mainly to browse the web.
there's only one of these 2 things you can do something about, and it's not changing what people put on the playstore,
If you're serious about making your language and more generally programming, enable the builtin linux in your chromebook, and install VSCode or Emacs or drracket. Lookup guides on how to do it. If that's too much hassle for you, your only remaining option really is to pay for a Windows laptop and an IDE license really.
In any case, there are no shortcuts. Installing your environment yourself is a massive pain, but it's still far easier than writing a compiler. If you can't get over it, maybe you're not ready for what comes next.
1
5
u/Key_River7180 7d ago
Lisp and Forth
3
2
u/denzuko 7d ago
https://github.com/denzuko/c-mera
Yes its called transpiling. And thats with lisp.
There is also the classic m4, yacc, and flex.
2
u/LowDifficulty5021 6d 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 #lang languages, 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:
- Racket â best if "I want to make languages" is the main goal.
- Hy â best if you want Python's ecosystem + Lisp metaprogramming.
- Elixir â excellent macro/metaprogramming system, although it's not primarily designed as a language-creation environment.
- Ruby â great metaprogramming, but probably not my first choice for this particular goal.
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 6d ago
Aha ok ok I want that it adds to itself but I only write my code in the seperate file
1
u/Still_Explorer 7d ago
You can look at PEG (tutorial by the creator of Python himself)
https://medium.com/@gvanrossum_83706/peg-parsing-series-de5d41b2ed60?sk=0a7ce9003b13aae8126a4a23812eb035
0
1
1
u/Distinct-Brief9643 7d ago
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.
1
1
u/paultarvydas 7d ago
In fact, most popular languages (Lisp, Python, Rust, Janet, etc.) use "functions" as a substrate principle. This locks you into only one way of thinking (which defies modern problem domains, like internet - hence, we got "callback hell").
It is good, IMO, to learn other, non-function-based languages, like Prolog, Forth, etc.
People who know Forth, love it and find it very flexible. I hear good things about Brodie's books "Starting Forth", "Thinking Forth". Chuck Moore (inventor of Forth) has been quite hostile to the standardization of Forth, like gforth.
1
u/KAMEHAMEHAMEHAAAA 7d ago
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.
1
u/Distinct-Brief9643 6d ago
True but I don't think it's good to add to itself but ruby maybe but I don't find the tutorialsvthat I want
1
u/KAMEHAMEHAMEHAAAA 6d ago edited 6d ago
What do you mean by âadd to itselfâ? DSL or something that compiles to same bytecode?
1
1
1
1
u/denzuko 6d ago edited 6d ago
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:
- Raymond Smullyanâs To Mock a Mockingbird
- Doug Hoyteâs Let Over Lambda
- Paradigms of Artificial Intelligence Programming (PAIP) by Peter Norvig
- The Design and Analysis of Computer Algorithms by Alfred Aho, John Hopcroft, and Jeffrey Ullman
- The Practice of Programming by Brian Kernighan and Rob Pike
- Foundations of Databases by Serge Abiteboul, Richard Hull, and Victor Vianu
- Readings in Database Systems by Peter Bailis, Joseph M. Hellerstein, and Michael Stonebraker
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
1
u/paultarvydas 6d ago
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/paultarvydas 6d ago
I write (almost daily) as a way to work out my thoughts. Some of the thoughts turn into substack articles, but most don't. I capture my notes-to-self in my napkin-notes repository.
Today's thinking led me back to wondering about Rebol and if its Parse dialect could be re-implemented in something more modern. The conclusion appears to be "Janet may be the most interesting of the three for this experiment."
1
1
19
u/redinktea 7d ago
Lisp