TestRig/grun卡住了无法解析示例文件 [英] TestRig / grun gets stuck parsing the example file
问题描述
在这个问题之后,我正在尝试学习如何使用TestRig/grun工具.考虑此存储库中的语法文件.我运行了以下命令:
Following this question, I'm trying to learn how to use the TestRig / grun tool. Consider the grammar file in this repo. I ran the below commands :
export CLASSPATH=".:/usr/local/Cellar/antlr/<version>/antlr-<version>-complete.jar:$CLASSPATH"
antlr <grammarName>.g4
javac <grammarName>*.java
但是我跑步时
grun <grammarName> <inputFile>
它卡住了,没有返回任何错误消息.我已经用其他示例对此进行了测试,但无济于事.如果您能帮助我知道问题出在哪里以及如何解决,我将不胜感激.
it gets stuck without returning any error messages. I have tested this with other examples as well to no avail. I would appreciate it if you could help me know what is the problem and how I can resolve it.
推荐答案
普通的 grun
别名将grammarName和startRule作为参数,并期望来自stdin的输入:
the normal grun
alias takes the grammarName and startRule as parameters and expects the input from stdin:
grun <grammarName> <startRule> < <inputFile>
示例:
grun ElmerSolver sections -tree < examples/ex001.sif
如果您只想运行Lexer,则可以使用"pseudo-startrule"令牌":
If you want to run just the Lexer, you can use the "pseudo-startrule" "tokens":
grun ElmerSolver tokens -tokens < examples/ex001.sif
有了您的样品,这给了我
With your sample, this gives me:
[@0,0:9='Simulation',<'Simulation'>,1:0]
[@1,11:13='End',<'End'>,2:0]
[@2,16:24='Equation ',<'Equation '>,4:0]
[@3,25:25='1',<Integer>,4:9]
[@4,27:29='End',<'End'>,5:0]
[@5,30:29='<EOF>',<EOF>,5:3]
(这是使用我在上一个答案中所做的语法更改,但应该证明结果)
(That's using the grammar changes I made in the previous answer, but should demonstrate the results)
这篇关于TestRig/grun卡住了无法解析示例文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!