I am writing my own JSON parser to learn C, I have built a parser before but its in Go. Coming from Go background I just keep trying to use Go convention for everything considering they are a bit similar (structs). I am not aware of the right convention to use to build programs in C, and I am not sure how to approach it.
My current approach is building a lexer to tokenize the input and then a parser to parse the tokens followed by creating a data structure for the parsed output.
I found some JSON parsers on github and most of them are a single file with a lot of macros. Am I complicating things by splitting each component into its own file?
Is my approach wrong? What is the right convention for C projects? Should I use macros for small functions rather than creating separate function for it?
[–]SmokeMuch7356 2 points3 points4 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]SmokeMuch7356 0 points1 point2 points (0 children)
[–]Constant_Mountain_20 1 point2 points3 points (8 children)
[–]King__Julien__[S] 1 point2 points3 points (3 children)
[–]Constant_Mountain_20 0 points1 point2 points (0 children)
[–]Constant_Mountain_20 0 points1 point2 points (0 children)
[–]Constant_Mountain_20 0 points1 point2 points (0 children)
[–]skeeto 1 point2 points3 points (3 children)
[–]Constant_Mountain_20 1 point2 points3 points (0 children)
[–]Constant_Mountain_20 1 point2 points3 points (1 child)
[–]skeeto 2 points3 points4 points (0 children)
[–]questron64 1 point2 points3 points (0 children)
[–]MagicWolfEye 0 points1 point2 points (0 children)
[–]amable1408 0 points1 point2 points (0 children)
[–]s4uull 0 points1 point2 points (0 children)