3 ms·
So, I just started writing a compiler for my toy language an I must say, the hardest part is not the lexing, parsing, compiling etc but just settling on a langu
by rishav_sharan 5y ago
So, I just started writing a compiler for my toy language an I must say, the hardest part is not the lexing, parsing, compiling etc but just settling on a language syntax/semantics. I just can't let my poor toy language be - and keep on revamping it everyday.
Anyone who is just starting on this or has as poor self discipline as I do, I would recommend choosing any existing language to create a compiler for. Don't male your own language unless you have frozen down its details.
Changing the lexer and ST everyday just because you decide that you are switching to begin-end instead of curlies, is a special kind of hell in itself.
- vanderZwan 5y agoAlternatively, do a lot of pen-and-paper design first, including writing a few toy programs for every feature you want to add. Mentally working your way through how a program would be interpreted and run helps a lot with working out the kinks, and in my case a least pen and paper helped me focus a lot and spot details and mistakes that would have been lost if I had been typing in some mock plaintext file. EDIT: I'm fine with people thinking I said something stupid, so I don't mind the downvote, but I'd like to know why exactly so I can learn from the other viewpoint. What is the problem with suggesting to work out out problems on paper, including the semantic design of a programming language in particular? It's a good stress-test for "how well can I debug this in my head", for starters.
- hutzlibu 5y ago"that you are switching to begin-end instead of curlies" Why not both? It is your language ..
- erezsh 5y agoIf you're using a good parser, switching between begin-end and curlies should be a one minute job. Now, updating the tests and the library code.. that's a different story.
- rishav_sharan 5y agoI am hand rolling >.>