2 ms·
First you should decide what kind of language you want to create. You'll need to decide on syntax, compiled or interpreted, target platforms, etc. Most resourc
by t-3 2y ago
First you should decide what kind of language you want to create. You'll need to decide on syntax, compiled or interpreted, target platforms, etc.
Most resources are going to be focused almost entirely on parsing, which is almost all you need if you're just going to create a toy language that doesn't aspire to be performant and have no interest in optimization, code generation, linking, etc. The difficulty of parsing depends almost entirely on the syntax of your language though.
A pre- or post-fix language is far simpler to parse than an infix language, to the point of being trivial and invalidating 90%+ of most books out there, so if you want to focus on low-level stuff and don't care about the syntax as much, choose one of those. If you are interested in lower-level stuff but want a more conventional syntax, use a parser generator (lex/yacc, ANTLR, tree sitter, etc).
Compilers and interpreters aren't much different in terms of difficulty or complexity, especially if you're concerned about optimizing performance, but an interpreter is much quicker to reach a minimum level of functionality which can be very good for keeping your interest up in the early portion of a project. The difference in complexity between a "transpiler"-style simple compiler and a simple interpreter are minimal though.
For target, choose what you know and are interested in. If you want to target hardware and do code generation or optimization, choose a RISC or less complex ISA at first unless you're already familiar with x86 - the principles are the same but the details are much less finicky.