3 ms·
previously discussed at [0]. Suggestions for the author: Define the grammar in BNF and the semantics in prose. Consider using a lexical scanner generator, a
by tjalfi 9y ago
previously discussed at [0].
Suggestions for the author:
Define the grammar in BNF and the semantics in prose.
Consider using a lexical scanner generator, a parser generator, and a string library.
Don't call strlen in a loop[1], many of your for loops are O(n^2) instead of O(n).
malloc returns uninitialized memory. Calling strcat on the return value of malloc[2] is a bug.
[0] https://news.ycombinator.com/item?id=15045592 https://news.ycombinator.com/item?id=15045592
[1] https://github.com/roecrew/nymph/blob/master/nymph/helper_func.c#L235 https://github.com/roecrew/nymph/blob/master/nymph/helper_fu...
[2] https://github.com/roecrew/nymph/blob/master/nymph/nymph_pp.c#L910 https://github.com/roecrew/nymph/blob/master/nymph/nymph_pp....
Edited to add the last two sentences.