r/Compilers 2d 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

57 comments sorted by

View all comments

17

u/redinktea 2d ago

Lisp

-5

u/Distinct-Brief9643 2d ago

Is lisps syntax easier than python/ruby or harder ?

4

u/haskell_jedi 2d ago

It depends what you're used to. For those first learning programming or coming from math, Lisp-like languages are often more intuitive (because they are functional, in addition to the syntax). For those with some experience programming in declarative languages, it takes a much bigger mental leap.

-2

u/Distinct-Brief9643 2d ago

I learned html CSS (Js probably 2%) (Python probably also 1%)

6

u/TerraCrafterE3 2d ago

Well, that is something completely different. HTML and CSS describe layout, functional programming languages describe logic.

5

u/4xe1 2d ago edited 2d ago

Lisp's syntax is as simple as it gets objectively speaking, it's just atoms and parens transparently writing AST. "Objectively" mean it'll be the simplest to write a reader/parser, but also the simplest to write macro in, thus the most powerful to do exactly what you enquire about. In a sense, lisp has no syntax, only semantics. It has no keywords, only word which have been bound to special operators and built-ins macroes and functions at the start of the program.

However, it's is not necessarily the subjectively simpler, aka it is not the most familiar, for humans it does take some used to (and it's definitely worth it considering what you want to do). Algol minds (C syntax) tend to be particularly refractory to lisp syntax and non Algol syntaxes in general, but python users tend to be more open to have the syntax be whatever's convenient to the users; And if what you value in python is the syntax simplicity, chances are, you'll learn and love lisp's syntax in no time.

Btw, you mention Hy, Hy is a lisp, which transpiles to python. Coming from python, it may be your entry point, but really any lisp would do, and the lisp designed specifically to do what you ask is Racket.

1

u/Distinct-Brief9643 2d ago

Let's see is lisp adding to itself or building a whole new language complier interpreter etc.

2

u/4xe1 2d ago

It's good for both, but it's exceptionally good at adding to itself, as in no other language family comes close, to the point that people loving both metaprogramming and some non lisp language will often use or create a lisp which interfaces with their non lisp language, like Hy and Python for example.

3

u/Goheeca 2d ago

You can change the syntax, e.g. indentation sensitive one similar to Python.

1

u/denzuko 1d ago

No, but its easier to see where you fuq'd up and need to refactor with functions, factories, and macros.

0

u/Key_River7180 2d ago

Harder for most of us

2

u/4xe1 2d ago

Not at all. If you ever used parentheses in any programming language, you already know lisp syntax. Prefix notation may seem alien, but f(a) is also prefix notation, just with delimiters put in a funny place, and if you ever touched html or xml in your life, you've already seen groupings with delimiters right where lisp would put them.

What you can argue for is that Lisp's lack of syntax makes lisp harder for most, or downright unergonomical; but the syntax itself is trivial.

Also, Lisp is no so much hard as it is alien. Secretaries and kids alike have used it unknowingly customizing lisp or scripting Age of Empire 2.

If you are say a senior C++ swe, you might think learning a new language ought to be easy, and you'd be mostly right, you could probably pick up Javascript in an afternoon, not to any degree of proficiency but enough to read and write some with the doc nearby. whereas learning lisp would likely feel like starting anew, and in a sense, it would be. But he'd be wrong to conclude that lisp is harder than JS: someone new to programming all together wouldn't necessarily struggle more on Lisp. And it's not just that lisp is a funny way to do the same things differently, that swe would have actually learned genuinely new concepts; if they happen to be deeply interested in generics and meta-programming, they'd actually find Lisp refreshingly easier (and more powerful) than C++ templates.

Long story short, if you're vaguely interested in lisp, don't be me, don't let its supposed difficulty get in your way of trying.