-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sample doesn't work on Windows environment. #147
Comments
Ooops. Sorry about that. Can you try with dot in your CLASSPATH like
? please let me know that words and I will update the homepage. |
Yes, it was exactly classpath issue. Thank you, and sorry for my panic :) |
|
The |
yes, \r helps and now sample works nice. Thank you :) |
I seem to get the same error as you. I run antlr4 command on Hello file, the Hello*.java files are created, I compile them, and when i run grun I get the message Can't load Hello as lexer or parser. Any suggestions on how to fix this ? Hello.g4 has the grammar available on antlr website. |
Did you edit the Hello.g4 file as mentioned in the comments above? |
Hi D:\ANTLR>echo %CLASSPATH% D:\ANTLR>java -cp D:\ANTLR\antlr-4.0-complete.jar;. org.antlr.v4.runtime.misc.TestRig Hello r -tree -gui -trace Directory of D:\ANTLR 25/09/13 12:23 101 hello.g4 Hello.g4 Thanks for any help !! |
feel free to compile the source :) |
Hi, Not sure I follow The grammar file was copied and has the \r .. yet it does not work for me Thanks Ben From: Terence Parr [mailto:notifications@github.com] feel free to compile the source :) — |
hi. javac compiles .java to .class which is what actually is executed by the VM. TestRig is not a compiler and so cannot run .java files. |
Thanks a lot Ben From: Terence Parr [mailto:notifications@github.com] hi. javac compiles .java to .class which is what actually is executed by the VM. TestRig is not a compiler and so cannot run .java files. — |
Oh... I think I have to punch myface for not having compiled the classes. I was much concerned about the grammar and all stuff that my eyes missed the "javac _.java" at page 6 of the book... (_facepalm*). |
hahahah. no problem. Good luck! |
dot in classpath. is that missing in the getting started? |
Of course. That was the problem. I thought it was hanging and didn't realize it was waiting for input. Thank you. |
I am able to compile the grammar. However, when I issue the "grun" command on the CLI, it just hangs, no output, as if it is going into infinite loop. Any ideas? Compiled/running using Java(TM) SE Runtime Environment (build 1.7.0_60-b19). |
i have also similar issue....... |
try EOF (ctrl-D or ctrl-Z) on line by itself if reading from stdin. You will find the FAQ oh so useful folks. https://theantlrguy.atlassian.net/wiki/pages/viewpage.action?pageId=7143433 |
I am using the c grammar written by you. I have just added following lines in the grammar. Then I tried to test a small c program using the command |
see faq link |
I have seen it. It's not EOF problem. grun C program -tree test.c is working fine when i used |
This is the code. I do not do what's wrong with it. /* Redistribution and use in source and binary forms, with or without
/** C 2011 grammar built from the C11 Spec */ grammar cpp; program : entryPoint* EOF;
primaryExpression genericSelection genericAssocList genericAssociation postfixExpression argumentExpressionList unaryExpression unaryOperator castExpression multiplicativeExpression additiveExpression shiftExpression relationalExpression equalityExpression andExpression exclusiveORExpression inclusiveORExpression logicalAndExpression logicalORExpression conditionalExpression asSIGNmentExpression asSIGNmentOperator expression constantExpression declaration declarationSpecifiers declarationSpecifiers2 declarationSpecifier initDeclaratorList initDeclarator storageClassSpecifier typeSpecifier structORUnionSpecifier structORUnion structDeclarationList structDeclaration specifierQualifierList structDeclaratorList structDeclarator enumSpecifier enumeratorList enumerator enumerationConstant atomicTypeSpecifier typeQualifier functionSpecifier alignmentSpecifier declarator directDeclarator gccDeclaratorExtension gccAttributeSpecifier gccAttributeList gccAttribute nestedParenthesesBlock pointer typeQualifierList parameterTypeList parameterList parameterDeclaration identifierList typeName abstractDeclarator directAbstractDeclarator typedefName initializer initializerList deSIGNation deSIGNatorList deSIGNator staticAssertDeclaration statement labeledStatement compoundStatement blockItemList blockItem expressionStatement selectionStatement iterationStatement jumpStatement compilationUnit translationUnit externalDeclaration functionDefinition declarationList // LEXER RULES AUTO : 'auto'; ALIGNAS : '_Alignas'; LEFTPAREN : '(' ; LESS : '<'; PLUS : '+'; AND : '&'; QUESTION : '?'; ASSIGN : '='; EQUAL : '=='; ARROW : '->'; IDENTIFIER fragment fragment fragment fragment fragment CONSTANT fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment fragment STRINGLITERAL fragment fragment fragment LINEDIRECTIVE PRAGMADIERECTIVE WHITESPACE NEWLINE BLOCKCOMMENT LINECOMMENT On Sun, May 24, 2015 at 8:33 PM, Terence Parr notifications@github.com
|
Hi Terrance, I have seen the FAQ. I have no problem in parser generator, java grun cpp program -tree on windows and as well as on linux but results are same. I do not know how to correct this issue. Best Regards, On Sun, May 24, 2015 at 8:33 PM, Terence Parr notifications@github.com
|
i've no idea |
I have figured out the problem. compilationUnit itself is the main rule of the grammar. No need to add anything into the grammar. |
No it doesn't: "I am running it on windows and my CLASSPATH has the dot." |
dare i ask if you know java code needs to be compiled? On Jul 31, 2015, at 5:29 AM, Alex Tilkin notifications@github.com wrote:
|
@parrt, yesterday, 10 minutes after posting the comment I solved the issue and deleted it from the thread. It was exactly what you pointed out. Thank you for your quick response. :) |
hello @parrt `/*
package cmdtest; /**
public class CmdTest { D:\skripsi\jar>java org.antlr.v4.runtime.misc.TestRig java compilationUnit -tree Thanks anyway 👍 |
Hello Parrt, Could I ask what does this mean?
This link die and I do not know what to look at. I am looking forward for your reply, |
hit ctrl-Z to end the input to stdin. |
Try it on the line by itself Sent from my iPhone
|
Hello Parr, I figured it out. Thank you very much ^^ Nana, |
Hi, this is not the place for support, please close this and go to the google discussion group Eric
|
Hi, this is not the place for support, please join the google discussion group and close this. Eric
|
Thanks @siliconvoodoo could you make a pull request on the doc page https://github.com/antlr/antlr4/blob/master/doc/getting-started.md ? |
How do you solved it? |
I was trying the first V4 example from the "Getting started page".
http://www.antlr.org/wiki/display/ANTLR4/Getting+Started+with+ANTLR+v4
Java files were generated and compiled but I have no success, because obtained "Can't load Hello as lexer or parser" while calling TestRig.
http://screencast.com/t/LbFc7BcZU
The content of grammar file I've just copy-pasted from web page.
The text was updated successfully, but these errors were encountered: