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
Hi, as we know, the PEG grammar is text(character) based, which means we write lexer and parser grammar together.
But in my application, I have my own lexer(mainly the C-preprocessor) implemented myself, so my question is: can the library support parsing rules for custom lexer.
For example, the lexer has some kinds of std::vector<Token> supplied, the Token class may have definition like:
class Token
{
TokenKind kind;
std::string lexeme;
}
Any idea or suggestions?
I mean it could be a generalized peg grammar?
Thanks.
The text was updated successfully, but these errors were encountered:
As you can see, it takes a char pointer. If you can change it to take a list of tokens (and change all the related code for it), it might be doable. But it must be better and easier to write such a parser from scratch instead of changing cpp-peglib. And we can't call it a PEG parser. Hope it helps.
Hi, as we know, the PEG grammar is text(character) based, which means we write lexer and parser grammar together.
But in my application, I have my own lexer(mainly the C-preprocessor) implemented myself, so my question is: can the library support parsing rules for custom lexer.
For example, the lexer has some kinds of
std::vector<Token>
supplied, theToken
class may have definition like:Any idea or suggestions?
I mean it could be a generalized peg grammar?
Thanks.
The text was updated successfully, but these errors were encountered: