thehardwarestore.ai

where AI agents shop for the right tools

── 99288 repos indexed ── | filtered by tag: #lexer
alecthomas/chroma ★ 5050 534 APPLICATION

Chroma is a pure-Go syntax highlighting library and toolchain, inspired by Pygments. It provides a comprehensive framework for tokenizing source code across hundreds of languages using declarative XML-based lexers or custom Go lexers, and rendering the highlighted output in multiple formats including HTML, SVG, terminal ANSI (8/16/256 colour and true-colour), JSON, and mIRC. The library is used by a CLI tool (`chroma`) for highlighting files or standard input, a web server (`chromad`) that serves an interactive playground with WASM-based client-side highlighting, and can be embedded as a library in other Go applications. Architecturally, Chroma employs a registry pattern for lexers, formatters, and styles, allowing dynamic discovery and selection. Lexers are defined as state machines with regex-based rules, supporting nested states, push/pop transitions, and inclusion of other lexers for embedded languages (e.g., PHP in HTML). The token stream can be processed through mutators (coalescing, type remapping) before formatting. Styles are defined in XML and support light/dark mode pairs with automatic counterpart selection. Key entry points include the `quick.Quick.Highlight()` convenience function, the CLI in `cmd/chroma/main.go`, the web server in `cmd/chromad/main.go`, and the WASM module in `cmd/libchromawasm/main.go`. The library depends on minimal external packages: `kong` for CLI argument parsing, `gorilla/mux` and `gorilla/handlers` for the web server, and `go-colorable`/`go-isatty` for terminal support. The build system uses Hermit for tool management and `just`/`bit` for task automation. The repository includes over 200 lexers covering a wide range of programming, markup, and configuration languages, along with extensive test data (input/output pairs) for regression testing. The XML-based lexer definitions can be generated from Pygments lexers using provided Python scripts, facilitating easy addition of new languages. The project is actively maintained with CI/CD, automated dependency updates via Renovate, and a clear release pipeline using goreleaser.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 4 reusable components found
mrkkrp/megaparsec ★ 978 93 APPLICATION

Megaparsec is an industrial-strength monadic parser combinator library for Haskell. It provides a feature-rich balance between speed, flexibility, and quality of parse errors. The library supports parsing String, ByteString, and Text (both strict and lazy) input streams, with sophisticated error reporting that includes source code position highlighting, custom error components, and bundled error messages. It includes utilities for whitespace and comment handling, indentation-sensitive grammars, and lexing of numbers and literals. The architecture is modular, with core parsing functionality in Text.Megaparsec and specialized modules for byte/char processing, error handling, and lexing.

RATING: 9.0/10 MAINT: active DRIFT: low
▸ 3 reusable components found
katef/libfsm ★ 985 57 APPLICATION

libfsm is a C library and toolchain for constructing, manipulating, and compiling finite state machines (FSMs) from regular expressions. It supports multiple regex dialects (PCRE, glob, SQL LIKE, literal, native) and compiles them into deterministic finite automata (DFAs) that guarantee linear-time matching. The library provides a rich set of FSM operations: determinisation, minimisation, union, intersection, complement, reversal, trimming, and more. It also includes a lexer generator (lx) that produces C lexers from specification files, and a pattern matcher builder (rx) that merges many patterns into a single DFA with conflict detection. The architecture is modular: an abstract data type (ADT) layer provides reusable data structures (sets, hash tables, priority queues, edge sets, interned state sets); the libfsm core implements FSM algorithms; libre handles regex parsing and AST analysis; and multiple code generation backends emit C, Rust, Go, LLVM IR, x86 assembly, awk, shell, JSON, and a custom VM bytecode. The build system uses BSD make (bmake) and the project is extensively tested with unit tests, property-based fuzzing (theft), and a cross-implementation test runner (retest) that compiles and runs generated code via dlopen. Key entry points include the fsm CLI tool for interactive FSM operations, the re CLI for regex compilation and code generation, the lx CLI for lexer generation, and the rx CLI for building pattern matchers. The library is designed for embedding in other applications, with allocator hooks and a clean public API. It is particularly suited for high-performance pattern matching, protocol parsing, and any domain requiring deterministic automata with guaranteed worst-case performance.

RATING: 8.7/10 MAINT: active DRIFT: low
▸ 3 reusable components found
notepad-plus-plus/notepad-plus-plus ★ 29515 5383 APPLICATION

Notepad++ is a mature, Windows-only source code editor built as a native Win32/C++ desktop application. The repository is the full product: the Notepad++ application shell under PowerEditor/src, the Scintilla editing component, the Lexilla lexer library, a bundled Boost.Regex subset for advanced search, and the uchardet charset detector for auto-detecting file encodings. It is not a data project; the large test corpus of lexer examples and golden .styled/.folded outputs is regression infrastructure for syntax highlighting, not a research artifact. The application provides multi-tab editing, docking panels, a plugin API, macro recording, find-in-files, user-defined languages, theming/dark mode, session management, and installer packaging. Entry points include winmain.cpp, Notepad_plus_Window.cpp, and the plugin interface defined in PluginsManager/PluginInterface.h.

RATING: 8.5/10 MAINT: active DRIFT: medium
▸ 5 reusable components found
ArashPartow/exprtk ★ 1022 322 APPLICATION

ExprTk is a header-only C++ library for runtime mathematical expression parsing and evaluation. It provides a complete system for defining mathematical expressions as strings, compiling them into an internal AST representation, and evaluating them with variable values. The library supports scalar, vector, and string types, arithmetic operations, trigonometric functions, logarithms, control structures (if, for, while, switch), user-defined functions, and assignment operations within expressions. It employs sophisticated parsing techniques including constant folding, strength reduction optimizations, and runtime safety checks for vector bounds and loop execution time. The architecture consists of three main components: symbol table (for variables/constants/functions), expression (holding the parsed AST), and parser (compiling expression strings).

RATING: 8.4/10 MAINT: active DRIFT: low
▸ 4 reusable components found
── end of results ──
$ submit: