▲ | geokon 2 days ago | |
> teach compiler development with Not trying to be confrontational, genuinely curious.. but why is this an area where you'd want a DSL? My initial reaction is : When I'm learning a topic, the last thing I want to be worrying about is learning the ergonomics of a new language I'm guessing there's a good rational I'm missing it'd be nice to see some piece of compiler related code in this language that'd be ugly in a general purpose language | ||
▲ | wiz21c 2 days ago | parent | next [-] | |
I have teached Pascal 25 years ago. The idea was to teach the basic principles of programming (loops, variables, arrays, linked lists, sorting, etc.) without worrying about the technical details (C was too tricky, python was not there). Plus Pascal is quite simple and has very few pitfalls. Once students where proficient in Pascal, we could introduce compiler classes and, when sufficiently advanced, show what the Pascal BNF grammar looked like. So students had a complete picture of a language. Pascal's BNF grammar is very simple. Also, Pascal enforces strong program structures (BEGIN, END, PROCEDURE, FUNCTION, etc). which helps to frame practical work. | ||
▲ | gingerBill 2 days ago | parent | prev | next [-] | |
Oberon is a general-purpose programming language, not a DSL. Even though it is very minimal, you can still do quite a bit in it. But the point of teaching compiler development is to teach people how to do the basic things from tokenizing, parsing, semantic checking, and code generation (directly to machine code). I have found this is actually a skill most programmers don't even know how to do, especially just tokenizing and parsing, so I thought I'd use Oberon-07 as a base/inspiration for it. n.b. at the time of this comment, the repo/project is not even 24 hours old yet. | ||
▲ | rubystallion 2 days ago | parent | prev [-] | |
He's the author of Odin, so he has experience writing compilers, so he also wrote a toy compiler in his language as a fun weekend project I guess. Of course it's only a good learning resource for people familiar with Odin. I don't know much about Odin, but from glancing at the code it looks like there are some memory management related features that he's using, which would look uglier in other languages. |