Project Admins:
RAG Pattern replacer
Whats can i use the pattern replacer for?
- Extract any kind of information out of input files
- Filter input files
- Convert ASCII file formats
- Quickly develop your own DSL (Domain-Specific-Language)
- Write code generators
- ...
How does it work?
In order to use rag pr, you need to write a pattern replacer script that
1) Defines the syntax of the input file (the "patterns")
2) Defines the actions to be taken depending in the input
The pattern-replacer-language is a simple OOP-Language that allows you to
- Define your own syntax rules and/ or regexps
- Do simple pattern-replacement operations based on "default replacements" and user-defined replacement on syntax-rule-level
- Define classes and methods if you need more than just syntax rules and replacements
- Use syntax rules like classes
- Use everything as an object
Is it like awk?
Yes and no.
Like awk, rag pr
- applies patterns/ regexps to an input file and performs the actions defined in the script whenever a pattern is recognized.
Unlike awk, rag pr
- needs a complete syntax description for the input file as a the "patterns".
- first reads the input file completely into "objects" and then the actions or replacements are performed like methods on those objects.
- has an oop scripting language
If you like, you can think of rag pr as a modernized version of awk.
Well, in fact first i had the idea to the pattern replacer and while working on it i found that it slightly reminded me of AWK - which is one of my favourite command line tools.