You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The JSON generator uses a manual recursion (with the help of the custom type Stack).
@da2ce7 made a proposal using classical recursion here.
We could try to refactor the generator and compare both implementations.
I have the feeling that classical recursion would increase readability, and I don't think that would have a big impact in performace. I used the Stack becuase:
I decided to port the C implementaion first without making changes and refactor later after adding tests.
My first attempt was not succesfull. In fact, I started from scratch with classical recursion but without separating tokenizer from generator (parser). It was a mess and I decided to go with the port from C and refactor later.
If we implement this, I think we would have a 100% classical approach: tokenizer + parser with recursion. I think that's good because I think it's a common pattern. On the other hand, I think it would be even easier to add generators for other formats.
We can also continue with the current version until we add other formats. I don't think the Stack version is very hard to follow.
Relates to: #12
The JSON generator uses a manual recursion (with the help of the custom type
Stack
).@da2ce7 made a proposal using classical recursion here.
We could try to refactor the generator and compare both implementations.
I have the feeling that classical recursion would increase readability, and I don't think that would have a big impact in performace. I used the
Stack
becuase:If we implement this, I think we would have a 100% classical approach: tokenizer + parser with recursion. I think that's good because I think it's a common pattern. On the other hand, I think it would be even easier to add generators for other formats.
We can also continue with the current version until we add other formats. I don't think the
Stack
version is very hard to follow.cc @da2ce7 @magecnion
The text was updated successfully, but these errors were encountered: