Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Show HN: Nymph – A slightly different version of C.
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
[1] https://github.com/roecrew/nymph/blob/master/nymph/helper_fu...
[2] https://github.com/roecrew/nymph/blob/master/nymph/nymph_pp....
Edited to add the last two sentences.
There are no comments on this comment yet.
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
[1] https://github.com/roecrew/nymph/blob/master/nymph/helper_fu...
[2] https://github.com/roecrew/nymph/blob/master/nymph/nymph_pp....
Edited to add the last two sentences.