Title: Another case where output does not follow grammar · Issue #211 · structuredllm/syncode · GitHub
Open Graph Title: Another case where output does not follow grammar · Issue #211 · structuredllm/syncode
X Title: Another case where output does not follow grammar · Issue #211 · structuredllm/syncode
Description: I did some more testing and found another case where the output did not match my defined grammar: grammar = """ start: compound_statement compound_statement: statement | (compound_statement ";" statement) statement: def_var | use_var def...
Open Graph Description: I did some more testing and found another case where the output did not match my defined grammar: grammar = """ start: compound_statement compound_statement: statement | (compound_statement ";" sta...
X Description: I did some more testing and found another case where the output did not match my defined grammar: grammar = """ start: compound_statement compound_statement: statement | (compound_st...
Opengraph URL: https://github.com/structuredllm/syncode/issues/211
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Another case where output does not follow grammar","articleBody":"I did some more testing and found another case where the output did not match my defined grammar:\n\n```py\ngrammar = \"\"\"\nstart: compound_statement\n\ncompound_statement: statement | (compound_statement \";\" statement)\n\nstatement: def_var | use_var\n\ndef_var: DEF_VAR_NAME \" = \" VAR_VALUE\n\nDEF_VAR_NAME: VAR_NAME\n\nuse_var: \"use(\"i VAR_NAME \")\"\n\nVAR_NAME: /[a-zA-Z_][a-zA-Z0-9_]*/\n\nVAR_VALUE: /[a-zA-Z0-9_]+/\n\"\"\"\n\nmodel_name = \"microsoft/phi-2\"\nsyn_llm = Syncode(model=model_name, grammar=grammar, max_new_tokens=200, mode=\"grammar_strict\")\n\nprompt = \"repeat after me: a=1;b=2;c=3;use(a)\\n\"\nprint(syn_llm.infer(prompt, debug=True)[0])\n```\n\nresults in the output:\n\n```\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use(a)\na = 1;b = 2;c = 3;use\n```\n\n\nSo it just ignores that there needs to be a `;` after the `use(a)` and I'm not sure why.\n\n\nIs there something wrong with my grammar? or is this somehow related to #208?","author":{"url":"https://github.com/5ila5","@type":"Person","name":"5ila5"},"datePublished":"2025-06-12T11:33:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/211/syncode/issues/211"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3fc0aea3-897b-bf88-c051-a1a30907e19f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E38C:178EFA:1F4A:257E:69911A6E |
| html-safe-nonce | 522744fc3ff94e55a312dd02530b100e49558acb3b94f67c7d039161ade66381 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzhDOjE3OEVGQToxRjRBOjI1N0U6Njk5MTFBNkUiLCJ2aXNpdG9yX2lkIjoiMTc1MDM1NTcwNDk3NDIxOTg4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 08c0dd2838425e1f2041c8d2e54cf598524fe37a694cad6c0c38639a6d03e41c |
| hovercard-subject-tag | issue:3139927915 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/structuredllm/syncode/211/issue_layout |
| twitter:image | https://opengraph.githubassets.com/58f7247d6c47aefd1c06c409e2cc1fd8fd1aa55dd072130a19c9eea4b6afbd5b/structuredllm/syncode/issues/211 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/58f7247d6c47aefd1c06c409e2cc1fd8fd1aa55dd072130a19c9eea4b6afbd5b/structuredllm/syncode/issues/211 |
| og:image:alt | I did some more testing and found another case where the output did not match my defined grammar: grammar = """ start: compound_statement compound_statement: statement | (compound_statement ";" sta... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 5ila5 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/structuredllm/syncode git https://github.com/structuredllm/syncode.git |
| octolytics-dimension-user_id | 204232273 |
| octolytics-dimension-user_login | structuredllm |
| octolytics-dimension-repository_id | 687211074 |
| octolytics-dimension-repository_nwo | structuredllm/syncode |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 687211074 |
| octolytics-dimension-repository_network_root_nwo | structuredllm/syncode |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width