Demo: https://lentil32.streamlit.app/
This library is an interpreter for a small subset of the AWK language.
git clone https://github.com/lentil32/pawky.git
make install
from pawky import AWKInterpreter
awk_script = "<AWK script>" # Input your script
interpreter = AWKInterpreter(awk_script)
interpreter.set_input(input_data)
interpreter.run()
For more information, please refer to test.py
.
- [X] BEGIN, END blocks
- [X] Separators: FS, OFS, RS, ORS
- [X] Variable assignments with operators e.g.,
=
,+=
,-=
,*=
,/=
,%=
- [X] Print statement for multiple expressions
- [X] Control structures e.g., if-else statements, for loops, break statements
- [X] Field variables e.g.,
$0
,$1
,$2
- [X] Basic arithmetic operations e.g.,
+
,-
,*
,/
,%
- [X] Unary operations e.g.,
!
,-
- [X] Comments
- [ ]
printf
function - [ ] Regex matching for patterns
- [ ] Associative arrays
- [ ] Built-in functions e.g.,
length()
,substr()
,tolower()
,toupper()
- [ ] Defining functions
- [ ] String concatenation
make setup
make test