Use ARM NEON SIMD to scan for newlines 16 bytes at a time instead
of byte-by-byte. Combined with mmap and Boyer-Moore, fixed string
search is now 2x faster than grep on ARM64.
Implement subset construction to compile NFA to DFA for patterns
without anchors. DFA gives O(n) matching vs NFA's O(nm). On some
patterns, now 1.8x faster than grep.
- Implement state_set_t with O(1) bit vector operations
- Extract literal prefixes for Boyer-Moore position skipping
- Add anchored pattern fast path (^ only tests position 1)
- Pre-compute start state epsilon closure
- Add DFA cache infrastructure for future lazy DFA
Performance improvements:
- Add ferp_mmap module for memory-mapped file I/O via POSIX mmap
- Add ferp_search module with Boyer-Moore-Horspool string search
- Use mmap for all file reads (falls back to standard I/O for stdin)
- Use Boyer-Moore for fixed string matching (-F mode)
- Compile patterns for all modes (including fixed strings)
Results on 134MB file (2M lines):
- Fixed string (-F): 8.2s → 0.24s (36x faster, matches GNU grep)
- BRE regex: 55.5s → 11.1s (5x faster, NFA still bottleneck)
- PCRE (-P): ~0.3s (very fast via libpcre2)
- Increase directory queue (MAX_DEPTH) from 100 to 10000
- Increase file collection buffer from 10K to 100K files
- Fixes missing files when a single directory contains >100 subdirectories
- Add -cpp and -fopenmp flags to release builds
- Enable parallel do for file processing loop
- Add critical section for output serialization
- Make collected_files allocatable (reduce stack usage)
- All 72 tests pass in debug and release modes
- Create context_entry_t type with allocatable text field
- Replace SAVE arrays with locally allocated before_buffer
- Allocate context buffer on-demand based on opts%before_context
- Enables thread-safe file processing (no shared state)
- Enable PCRE2_UTF and PCRE2_UCP for full Unicode support
- Unicode character classes (\p{L}, \p{N}, etc.) now work
- Unicode case folding for -i flag
- Increase max_line_len from 8KB to 1MB
- Strip trailing \r for Windows line endings on Unix
- Add 4 Unicode tests to test suite (71 total)
Implements -P/--perl-regexp with complete PCRE2 functionality:
- Lookahead/lookbehind assertions
- Non-capturing groups (?:...)
- Named groups (?P<name>...)
- PCRE character classes (\d, \w, \s, etc.)
- Word boundaries (\b)
New pcre_api.f90 module provides C bindings to libpcre2-8.
Makefile now links against libpcre2 via pkg-config.
- Fix -o to print only matched portions (multiple per line)
- Implement context lines (-A, -B, -C) with group separators
- Add --color=always support with ANSI escape codes
- Add tests for output options and context lines
- Update Makefile with regex module dependencies and comprehensive tests
- Update ferp_matcher.f90 to use regex_api for pattern matching
- Update main.f90 to compile patterns once for efficiency
- Add 36 tests covering BRE, ERE, POSIX classes, anchors, quantifiers