{"id":24345,"library":"pyleri","title":"pyleri","description":"A Python Left-Right Parser (LL(k) parser) designed for easy grammar definition and parsing. Version 1.5.0 adds typing and drops Python 3.7/3.8 support. Release cadence is irregular, with occasional patch releases.","status":"active","version":"1.5.0","language":"python","source_language":"en","source_url":"https://github.com/cesbit/pyleri","tags":["parser","llk","left-right","grammar","context-free"],"install":[{"cmd":"pip install pyleri","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"Always import directly from pyleri.","symbol":"Grammar","correct":"from pyleri import Grammar"}],"quickstart":{"code":"from pyleri import Grammar, Sequence, Keyword, Regex\n\n# Define grammar elements\nclass MyGrammar(Grammar):\n    r = Sequence(\n        Keyword('hello'),\n        Regex(r'[a-zA-Z0-9]+')\n    )\n\ngrammar = MyGrammar()\nresult = grammar.parse('hello world')\nif result.is_valid:\n    print('Parse succeeded!')\nelse:\n    print(f'Parse error: {result.as_str(line_number=True)}')","lang":"python","description":"Define a simple grammar and parse a string."},"warnings":[{"fix":"Use Python >=3.9 or install pyleri==1.4.3.","message":"Dropped support for Python 3.7 and 3.8 in v1.5.0. Upgrade your Python version or pin pyleri <1.5.0 if you need these versions.","severity":"breaking","affected_versions":">=1.5.0"},{"fix":"Always check result.is_valid, not just the returned value.","message":"The 'parse' method returns a Result object, not True/False. Check result.is_valid to determine success.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Regex(r'[a-zA-Z]+') not Regex(r'^[a-zA-Z]+').","message":"Regex element requires the pattern to be anchored with '^' internally. Do not add '^' at start; pyleri already prepends it.","severity":"gotcha","affected_versions":">=1.4.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install pyleri' and use 'from pyleri import ...'.","cause":"pyleri is not installed or imported incorrectly.","error":"ModuleNotFoundError: No module named 'pyleri'"},{"fix":"Replace result.as_string() with result.as_str().","cause":"Typo: use 'as_str' (without 'ing').","error":"AttributeError: 'Result' object has no attribute 'as_string'"},{"fix":"Use result.as_str(line_number=True) to get a detailed error message.","cause":"Input does not match grammar. Check your input or grammar definition.","error":"pyleri.errors.ParseError: Expecting ... got ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}