Skip to content

Conversation

@paul-hammant
Copy link
Contributor

No description provided.

@paul-hammant paul-hammant force-pushed the claude/port-sed-awk-chrysalisp-01QbEDBa6DqLV9BXbovanwcF branch from 0db320f to f04b8c4 Compare December 3, 2025 18:13
Implements basic sed (stream editor) and awk (pattern scanning) commands
following ChrysaLisp coding conventions and architectural patterns.

sed features:
- Substitute command (s/pattern/replacement/[g])
- Delete command (d)
- Print command (p)
- Line number and pattern addressing
- Range addressing
- Quiet mode (-n flag)

awk features:
- Field splitting with configurable separator
- Built-in variables (NR, NF, $0-$n)
- BEGIN/END blocks
- Pattern matching and conditionals
- Print and variable assignment
- Simple expression evaluation

Both commands:
- Read from stdin or files
- Follow ChrysaLisp naming conventions
- Use lib/text/searching for pattern matching
- Include comprehensive usage documentation

Test suite includes:
- Sample data files
- Test cases for both commands
- README with examples and limitations
Fixes:
- Replace filter with filter! (correct iteration primitive)
- Replace get/insert with proper hmap API (def and :find method)
- Use (. vars :find key) instead of undefined get function
- Use (def vars key value) instead of insert for environment updates
- Handle nil case in compound assignment

Testing:
- Add TESTING_sed_awk.md with comprehensive test procedures
- Document CONTRIBUTIONS.md conformance checklist
- Include manual test cases for both sed and awk
- Add test runner script framework
- Document known limitations

The code now properly uses ChrysaLisp hmap/environment API
and follows iteration primitives (filter! vs filter).
@paul-hammant paul-hammant force-pushed the claude/port-sed-awk-chrysalisp-01QbEDBa6DqLV9BXbovanwcF branch from f04b8c4 to 8841214 Compare December 3, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants