Run from shell
From Windows
grapa.exe [parameters]
From Linux
./grapa [parameters]
To exit while in the console, enter a '.' character.
If using paste to enter a block of code to run, ensure each line is not larger than the maximum line line for the console - break up the code into shorter lines.
If using paste to enter multiple lines that need to be run at the same time (such as when a single command spans multiple lines), enter $[
sequence first and $]
sequence at the end. This will trigger the lexical engine to signal to the grammar engine to pause grammar analysis until after all the tokens have been generated for the input stream.
Command line options
Once copied into a location (and PATH updated if needed), you'll be able to run the tool using "grapa" from a terminal or command shell from any location. Running the tool with "grapa --env" will display a few of the directories where the tool will look for information.
Other command line options:
-h,--help :Show this help message
-v,--version :Show version
-q,--quiet :Suppress header
--verbose :Show version header (default: hidden)
-i,--interactive:Run in interactive mode
-d,--debug :Enable debug mode (shows debug output)
-c <script> :Execute command/script
-f <file> :Execute file
- :Execute from stdin (standard Python/Node.js behavior)
Example: Performs a SHAKE256 hash of the string "thisisatest".
grapa -c "'thisisatest'.encode('SHAKE256')" -q
0x94B3D49AF1B6396CD186876793A5C4405A1BBFD12C7341521ABD62AA26E3E852B06B345D82126B1D864DFA885B6DC791D21A318259D307D76D7946D1EFF9DA54
Example: Same, but takes input from stdin.
echo "thisisatest".encode('SHAKE256') | grapa - -q
0x94B3D49AF1B6396CD186876793A5C4405A1BBFD12C7341521ABD62AA26E3E852B06B345D82126B1D864DFA885B6DC791D21A318259D307D76D7946D1EFF9DA54
Note: The -
option requires pipe input. Using grapa -
without pipe input will show an error message.
Note: By default, Grapa runs without showing version headers (like Python/Node.js). Use --verbose
to show version headers when needed.
Testing
Grapa includes a comprehensive test suite for validating functionality and performance. All tests are organized in the test/
directory.
Running Tests
Complete Test Suite
Run all tests in one command:
# Windows
.\grapa.exe -f "test/infrastructure/run_tests.grc"
# Linux/Mac
./grapa -f "test/infrastructure/run_tests.grc"
Individual Test Categories
# Basic examples
.\grapa.exe -f "examples/basic_example.grc"
# Advanced examples
.\grapa.exe -f "examples/advanced_example.grc"
# Performance examples
.\grapa.exe -f "examples/performance_example.grc"
Regression Testing
For development and CI/CD:
# Quick regression test
.\grapa.exe -f "test/infrastructure/run_tests.grc"
For detailed testing information, see Testing Documentation.
Editor
Grapa includes a widget library that can be used create create a GUI. Grapa can be run with simple editor (see lib/grapa/editor.grc) writen using this library.
grapa -w
You can also create your own GUI to run with grapa. This file can either be a raw text file, or a grapa compiled file.
grapa -wfile [file]