augustt198 / latex2sympy

Parse LaTeX math expressions
MIT License
386 stars 162 forks source link

Antlr4 on Linux reference to undefined rule: exp #24

Closed wassgha closed 7 years ago

wassgha commented 7 years ago

Hello,

This is what I get when I try installing latex2sympy on CentOS

[..latex2sympy]# java -jar antlr-4.5.3-complete.jar PS.g4 -o gen
error(56): PS.g4:113:9: reference to undefined rule: exp
error(56): PS.g4:114:16: reference to undefined rule: exp_nofunc
error(56): PS.g4:118:9: reference to undefined rule: eval_at_sup
error(56): PS.g4:118:37: reference to undefined rule: eval_at_sup
augustt198 commented 7 years ago

I'm not sure how to reproduce this. Works fine for me on a clean CentOS installation:

[root@test ~]# git clone https://github.com/augustt198/latex2sympy
Cloning into 'latex2sympy'...
remote: Counting objects: 155, done.
remote: Total 155 (delta 0), reused 0 (delta 0), pack-reused 155
Receiving objects: 100% (155/155), 41.27 KiB | 0 bytes/s, done.
Resolving deltas: 100% (94/94), done.
[root@test ~]# cd latex2sympy/
[root@test latex2sympy]# wget http://www.antlr.org/download/antlr-4.5.3-complete.jar
--2016-09-23 00:51:40--  http://www.antlr.org/download/antlr-4.5.3-complete.jar
Resolving www.antlr.org (www.antlr.org)... 151.101.32.133
Connecting to www.antlr.org (www.antlr.org)|151.101.32.133|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1485121 (1.4M) [application/java-archive]
Saving to: ‘antlr-4.5.3-complete.jar’

100%[========================================================================================================================================>] 1,485,121   --.-K/s   in 0.04s   

2016-09-23 00:51:40 (31.5 MB/s) - ‘antlr-4.5.3-complete.jar’ saved [1485121/1485121]

[root@test latex2sympy]# java -jar antlr-4.5.3-complete.jar PS.g4 -o gen
[root@test latex2sympy]# ls gen
__init__.py  PSLexer.py  PSLexer.tokens  PSListener.py  PSParser.py  PS.tokens

Maybe try reordering the rule definitions so that rules are defined above rules where they are used?

wassgha commented 7 years ago

Nevermind, it was a Django problem. Updated everything and now it works.