2 ms·
It is nice when articles by people I find informed and experienced end up using some technique or pattern I have used previously. The compiler for my ‘toy’ prog
by throwaway17_17 4y ago
It is nice when articles by people I find informed and experienced end up using some technique or pattern I have used previously. The compiler for my ‘toy’ programming language was originally written in JavaScript, simply to see if I could do it and have an HTML based ‘REPL’ for testing with simplified compiler internal structures display options as well. JS is not fast in most cases, but I got a decent increase in memory usage numbers and speed by implementing something similar to the article’s subslice API. I just went to using index into source string and a length to store in the compiler’s various passes instead of making new strings for each token/lexeme/node/IL element.
Not really important revelations or anything, but as a person who does not do development professionally, it is nice to feel like I may be developing decent instincts for the craft.