--- id: sly version: "0.5" license: MIT license_treatment: permissive maintenance: abandoned --- # sly — "SLY - Sly Lex Yacc" License: permissive · Maintenance: abandoned · Downloads: 5.1M/mo ## What it is and what it does SLY is a pure-Python lexer and parser generator based on the LALR(1) algorithm, designed for building compilers and domain-specific language parsers without requiring a separate code generation step. You define lexer and parser rules as Python classes with decorators, and SLY handles tokenization and syntax analysis directly at runtime. The library was originally developed for instructional purposes and emphasizes extensive error reporting to help users identify common mistakes. It supports empty productions, error recovery, precedence rules, and moderately ambiguous grammars. While not optimized for speed due to its Python implementation, it can handle grammars with several hundred rules. However, the project was retired on December 21, 2025, and no further maintenance is planned. Use it for: - Building a domain-specific language (DSL) interpreter or compiler without external code generation tools. - Parsing configuration files or domain-specific syntax with custom error messages for invalid input. - Educational projects where understanding parser construction and LALR theory is part of the goal. - Prototyping language features or grammar designs before committing to a production parser generator. - Embedding a simple expression evaluator into a Python application. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. SLY is a pure-Python implementation of lex and yacc for building lexers and parsers using LALR(1) parsing, with no code generation step required. No—do not install for new projects. The project is formally retired as of December 21, 2025 with no planned maintenance. While the code is stable and license-permissive, the maintainer explicitly recommends considering alternatives. Install only if you are maintaining existing code that already depends on SLY, or if you are willing to fork and maintain it yourself. ## Install pip install sly uv add sly poetry add sly ## Installing sly Before you install: Installation is frictionless with no runtime dependencies. However, the project was formally retired on December 21, 2025, with the maintainer stating no further maintenance is expected. The repository is archived. Users should be aware they are adopting a library that will not receive updates or bug fixes. License in practice: SLY is licensed under the MIT License (permissive), meaning you can use, modify, and distribute it freely with minimal restrictions, though you must include the license notice. Quickstart: from sly import Lexer, Parser class MyLexer(Lexer): tokens = { NAME, NUMBER } NAME = r'[a-zA-Z_][a-zA-Z0-9_]*' NUMBER = r'\d+' class MyParser(Parser): tokens = MyLexer.tokens @_('NUMBER') def expr(self, p): return int(p.NUMBER) lexer = MyLexer() parser = MyParser() result = parser.parse(lexer.tokenize('text')) Requires Python 3.6 or greater. Verify before relying: - Whether the archived repository will accept security patches or critical bug fixes despite the retirement notice. - Performance characteristics when parsing large or complex grammars in production settings. - Compatibility with recent Python versions given the last release was October 2022. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 5.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags python parser generator, lex yacc implementation, lalr parser library, lexer tokenizer python, compiler construction tools, grammar parsing framework, recursive descent alternative, parser-generator, archived, educational [View on SkillFed](https://skillfed.io/packages/sly) · [View on PyPI](https://pypi.org/project/sly/)