4 ms·
After taking a compiler course in uni I found the emphasis on dealing with syntax mostly a waste of time. To begin with, do yourself a favor and use S-expressio
by davidhs 3y ago
After taking a compiler course in uni I found the emphasis on dealing with syntax mostly a waste of time. To begin with, do yourself a favor and use S-expression syntax (like Lisp) for your language. They're dead simple to parse. With the syntax out of the way, you can get to meat and potatoes of implementing a language. Later on you can always define a "look" for your language, and you can spend an inordinate amount of time on that.
- lelanthran 3y ago> After taking a compiler course in uni I found the emphasis on dealing with syntax mostly a waste of time. To begin with, do yourself a favor and use S-expression syntax (like Lisp) for your language. They're dead simple to parse. With the syntax out of the way, you can get to meat and potatoes of implementing a language. Later on you can always define a "look" for your language, and you can spend an inordinate amount of time on that. I maintained same attitude for years. I've changed my mind now. Anything feature I want already exists in some programming language. The only distinguishing feature I can offer when designing a new programming language is "very readable", so syntax matters more than I used to think. Whether you get traction or not depends a lot on syntax - if your syntax is too much of an outlier compared to mainstream languages, your features don't matter.
- davidhs 3y agoMy suggestion was more for people who are starting out developing a programming language. It's the over-emphasis on the syntax so early on I find to be suboptimal. I also find that slapping on a more human readable or aesthetically pleasing syntax afterwards to be relatively easy.
- lelanthran 3y agoI agree, so much in fact, that this past weekend I wrote a program to translate s expressions to html. Because I got tired of writing my htmx stuff as a tag tree. I should probably post a show HN here.
- shortrounddev2 3y agoI feel like you're discounting the importance of syntaxes. Python is as popular as it is because the syntaxes is so simple. Lisp isn't as popular because prefix notation doesn't make intuitive sense to beginners. I would argue that syntax is probably the most important feature of a language
- _gabe_ 3y agoPython is popular because of the ecosystem that’s been built around the language.
- shortrounddev2 3y agoPartly, but also because of the beginner-friendly syntax
- kazinator 3y agoPython languished in obscurity for about a quarter century before taking off in popularity. The tide didn't turn because of changes in syntax. Python's syntax inspires imitations that you will never hear about in spite of their syntax. C doesn't have beginner-friendly syntax, yet it succeeded over languages like Pascal and Modula. C++ enjoys great popularity in spite of a mind-numbingly large grammar full of arcane syntax, which grows worse as time passes. There is a lot interest in Rust, which has tons of bizarre syntax to learn. Poorly-considered, simplistic hypotheses connecting syntax with popularity simply don't hold up to even a modest amount of scrutiny.
- shortrounddev2 3y agoI contend that your hypothesis is equally simplistic and poorly considered. How would Python get an active community and ecosystem in the first place, if it languished for a quarter of a century? > C++ enjoys great popularity in spite of a mind-numbingly large grammar full of arcane syntax, which grows worse as time passes. There is a lot interest in Rust, which has tons of bizarre syntax to learn. C++ becomes less popular as its syntax becomes more arcane. Rust is a recent language and its long term survival remains to be seen. Languages are like memes: they come and they go. BASIC used to be the beginner language, now it's Python. Lua is popular due to its syntax and ease of embedding. We'll see what simplistic whitespace syntaxes come out within the next 25 years. I predict many language which exist today will fall by the wayside while newer ones replace them