Skip to content
This repository has been archived by the owner on Aug 14, 2021. It is now read-only.

Question about option -recursion-limit #29

Open
Hanseltu opened this issue Jul 29, 2020 · 0 comments
Open

Question about option -recursion-limit #29

Hanseltu opened this issue Jul 29, 2020 · 0 comments

Comments

@Hanseltu
Copy link

Hi, there.

Thanks for your awesome tool! I am playing dharma nowadays and I have a question about the "-recursion-limit" option.

In the --help output, "-recursion-limit" represents the max python recursion limit. I doubt that is this the grammar recursion limit, either?

For example,

%%% test.dg
%section% := value

statement :=
    +ifstatement+

ifstatement :=
    if (1) { +statement+ }

%section% := variable

%section% := variance

main :=
    +statement+

Above grammar rule may usually be used when defining a specific language, but dharma rejects this with "ERROR: No path to leaf in force-leaf mode in value test:statement".

Also, when I used the example in dharma

$dharma -grammars dharma/grammars/canvas2d.dg -storage . -count 1 -recursion-limit 5
Traceback (most recent call last):
  File "/usr/local/bin/dharma", line 11, in <module>
  File "/usr/local/lib/python3.5/dist-packages/dharma-1.3.2-py3.5.egg/dharma/dharma.py", line 61, in main
  File "/usr/lib/python3.5/logging/__init__.py", line 1747, in basicConfig
RecursionError: maximum recursion depth exceeded while calling a Python object
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 26, in enabled
RecursionError: maximum recursion depth exceeded while calling a Python object

Original exception was:
Traceback (most recent call last):
  File "/usr/local/bin/dharma", line 11, in <module>
  File "/usr/local/lib/python3.5/dist-packages/dharma-1.3.2-py3.5.egg/dharma/dharma.py", line 61, in main
  File "/usr/lib/python3.5/logging/__init__.py", line 1747, in basicConfig
RecursionError: maximum recursion depth exceeded while calling a Python object

So, my question is that is this similar recursion grammar can be defined in .dg? What is the difference between grammar max recursion limit and the option "-recursion-limit"?

Please understand if I state something wrong. Any suggestions are welcome. Thank you very much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant