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

Should we maybe use a PEG parser? #3

Open
nawarian opened this issue Sep 16, 2020 · 0 comments
Open

Should we maybe use a PEG parser? #3

nawarian opened this issue Sep 16, 2020 · 0 comments

Comments

@nawarian
Copy link

nawarian commented Sep 16, 2020

Many of the formats we implement and want to implement have structures that can easily be parsed using Regular Expressions. This approach is very repetitive and, given citation formats have little variation, can lead to lots of duplicate code and poor abstractions.

Using a proper lexer could make the implementation process much faster. One option is to use the PEG format, commonly used for compilers. This way we can implement new parser/creator/templates just by implementing a grammar file.

See https://github.com/hafriedlander/php-peg/.

@nawarian nawarian changed the title Should we use a PEG parser maybe? Should we maybe use a PEG parser? Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant