Skip to content

Conversation

@shubhamugare
Copy link
Collaborator

@shubhamugare shubhamugare commented Dec 3, 2024

SynCode provides a flag --debug to help debug grammars. This flag will print out the parsed terminals and their corresponding values in generation.
(Refer to this notebook for code example)

For example, consider the following grammar:

start: "foo" "(" ident ")" ";"
ident: [a-z]+

Given the output foo(abc);, the debug flag will print:

--------------------------------------------------
Parsed terminals:
(type: 'FOO', value: 'foo')
(type: 'LPAR', value: '(')
(type: 'IDENT', value: 'abc')
(type: 'RPAR', value: ')')
(type: 'SEMI', value: ';')
--------------------------------------------------

@shubhamugare shubhamugare merged commit efde334 into main Dec 3, 2024
1 check passed
@shubhamugare shubhamugare deleted the debug branch December 11, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants