An even simpler way imo, is explicit functions instead of a precedence table, then the code pretty much has the same structure as EBNF. Need to parse * before +? Begin at add, have it call parse_mul for its left and…
But does it even conserve memory? Copying a string when you have the length is 2 bytes of machine code on x86 (rep movsb). Remember, code takes up memory too.
How do you drop nulls in the middle of a string without requiring O(N) extra space to restore the original characters?
An even simpler way imo, is explicit functions instead of a precedence table, then the code pretty much has the same structure as EBNF. Need to parse * before +? Begin at add, have it call parse_mul for its left and…
But does it even conserve memory? Copying a string when you have the length is 2 bytes of machine code on x86 (rep movsb). Remember, code takes up memory too.
How do you drop nulls in the middle of a string without requiring O(N) extra space to restore the original characters?