Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a bridge pattern to decouple Builder calls from the parser #7

Open
rajatkb opened this issue Jan 9, 2020 · 0 comments
Open
Assignees
Labels
good first issue Good for newcomers

Comments

@rajatkb
Copy link
Owner

rajatkb commented Jan 9, 2020

The parser logic should only be focused on the language an not on the builder. So we need a separate adapter class that can make the calls for the parsed content. This will decouple the knowledge of the builder from the parser. Allowing someone to change the builder mechanism in the backend irrespective of the changes in the language or vice versa.

// So it would be somewhat like this

streamToken.scanleft( list('S' , '$') )(  (stack, token) => action(stack  , adapter(builder)) )

// where adapter abstracts the builde calls
// so that in future

streamToken.scanleft( list('S' , '$') )(  (stack, token) => action(stack  , adapter(newBuilder)) )

// will remain the same. The call pattern and what point call to builder will be made will be determined by the adapter. So changes will be localised to adapter to accept chainging in Builder.
// No body wants to touch the parser.
@rajatkb rajatkb self-assigned this Jan 9, 2020
@rajatkb rajatkb added the good first issue Good for newcomers label Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant