You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand how to run Grammarinator with a minimal knowledge beyond Linux/Bash/Antlr4. Unfortunately, I can't get far past the first two lines (one to build it after cloning, the other grammarinator-process).
Following the instructions starting here and filling in the details as though it's written for GitHub Actions:
git clone https://github.com/renatahodovan/grammarinator.git
cd grammarinator
pip --version
# pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
pip install .
mkdir x
cd x
cat << END > Expr.g4
grammar Expr;
file_ : expr EOF;
expr : expr ('*' | '/') expr | expr ('+' | '-') expr | '(' expr ')' | ('+' | '-')* atom ;
atom : INT;
INT : [0..9]+;
WS : [ \r\n\t] + -> channel(HIDDEN) ;
END
java --version
# openjdk 11.0.13 2021-10-19
# OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.20.04)
# OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
java -jar /mnt/c/Users/Kenne/Downloads/antlr-4.9.3-complete.jar Expr.g4
# (Antlr4 works.)
grammarinator-process Expr.g4 -o .
# (grammarinator-process works.)
ls -l ExprGenerator.py
# -rwxrwxrwx 1 ken ken 3808 Feb 15 18:29 ExprGenerator.py*
grammarinator-generate
# grammarinator-generate: error: the following arguments are required: NAME
grammarinator-generate ExprGenerator
# Traceback (most recent call last):
# File "/home/ken/.local/bin/grammarinator-generate", line 8, in <module>
# sys.exit(execute())
# File "/home/ken/.local/lib/python3.8/site-packages/grammarinator/generate.py", line 295, in execute
# with Generator(generator=args.generator, rule=args.rule, out_format=args.out,
# File "/home/ken/.local/lib/python3.8/site-packages/grammarinator/generate.py", line 72, in __init__
# self.generator_cls = import_object(generator) if generator else None
# File "/home/ken/.local/lib/python3.8/site-packages/inators/imp.py", line 24, in import_object
# return getattr(importlib.import_module('.'.join(steps[0:-1])), steps[-1])
# File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
# return _bootstrap._gcd_import(name[level:], package, level)
# File "<frozen importlib._bootstrap>", line 1011, in _gcd_import
# File "<frozen importlib._bootstrap>", line 950, in _sanity_check
# ValueError: Empty module name
grammarinator-generate ExprGenerator.ExprGenerator
# Traceback (most recent call last):
# File "/home/ken/.local/bin/grammarinator-generate", line 8, in <module>
# sys.exit(execute())
# File "/home/ken/.local/lib/python3.8/site-packages/grammarinator/generate.py", line 295, in execute
# with Generator(generator=args.generator, rule=args.rule, out_format=args.out,
# File "/home/ken/.local/lib/python3.8/site-packages/grammarinator/generate.py", line 72, in __init__
# self.generator_cls = import_object(generator) if generator else None
# File "/home/ken/.local/lib/python3.8/site-packages/inators/imp.py", line 24, in import_object
# return getattr(importlib.import_module('.'.join(steps[0:-1])), steps[-1])
# File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
# return _bootstrap._gcd_import(name[level:], package, level)
# File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
# File "<frozen importlib._bootstrap>", line 991, in _find_and_load
# File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
# ModuleNotFoundError: No module named 'ExprGenerator'
I just want to see what grammarinator-generate outputs. The instructions are inadequate.
The text was updated successfully, but these errors were encountered:
Current directory isn't on the search path for modules (available inside the python interpreter as sys.path, see https://docs.python.org/3/library/sys.html). This can be added either via the PYTHONPATH environment variable or using the --sys-path command line option (see grammarinator-generate --help).
The following worked for me: grammarinator-generate ExprGenerator.ExprGenerator --max-depth 10 --sys-path . -n 10 (also note --max-depth aka -d, and -n).
The readme actually mentions all these command line options at
I'm trying to understand how to run Grammarinator with a minimal knowledge beyond Linux/Bash/Antlr4. Unfortunately, I can't get far past the first two lines (one to build it after cloning, the other
grammarinator-process
).Following the instructions starting here and filling in the details as though it's written for GitHub Actions:
I just want to see what grammarinator-generate outputs. The instructions are inadequate.
The text was updated successfully, but these errors were encountered: