Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8526351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:14:52+00:00 2026-06-11T08:14:52+00:00

I am using ANTLRWorks 1.4.3 together with ANTLR 3.4 to generate a Java-based parser

  • 0

I am using ANTLRWorks 1.4.3 together with ANTLR 3.4 to generate a Java-based parser and lexer from a grammar file. The generated .java-files contain strings like

C:\\Users\\[path to the eclipse project]\\src\\some\\package\\name\\MyGrammar.g

This absolute path is used as

  • return string e.g. in method getGrammarFileName() of lexer and parser, and
  • throughout the both files various times as comment.

I see following disadvantages:

  • If somebody else with different paths in his development environment will regenerate these files, a lot of changes will be introduced even if no changes in the grammar file were done.
  • Nobody, especially in an open source project, needs to know where I exactly store my grammar files. E.g., what about C:\\Users\\simon\\customerA\\crap_software\\[rest of the path to grammar file]

Is there a way to control this in ANTLRWorks or ANTLR s.th. at least only relative paths are used?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:14:54+00:00Added an answer on June 11, 2026 at 8:14 am

    Finally I found a way to solve my own problem.

    Paths seem to depend from where and how you invoke ANTLR. I was not able to achieve this with ANTLRWorks, but using command line ANTLR you are able to perform this. You can do the following (example is for Windows but should be reproducible on other OSes, too):

    1. Download Antlr for command line and copy it to e.g.

      C:\Program Files (x86)\ANTLRworks\antlr-3.4-complete.jar.

    2. Open a Windows command line (cmd.exe) and change to the directory where your grammar file is located:

      cd C:\Users[path to the eclipse project]\src\some\package\name

    3. Invoke

      java -jar "C:\Program Files (x86)\ANTLRworks\antlr-3.4-complete.jar" MyGrammar.g
      

      from commandline.

    The generated java files will only contain the name of your grammar file and no path anymore.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ANTLR 3.1.3 to generate the parser. After importing the generated testParser,
Using Java,I have to fetch multiple sets of values from an XML file to
I'm able to successfully generate C# code (CSharp2) for my grammar written using ANTLRWorks.
Recently I tried to write ANTLR grammar file (.g) using the ANTLR Editor for
Using ASIHTTPRequest, I downloaded a zip file containing a folder with several audio files.
I am using the following simple grammar to get an understanding of ANTLR. grammar
I'm using ANTLRWorks, and have specified my java package using the @header action: @header
According to these instructions , I'm trying to use ANTLR generated *.as files in
I'm using ANTLRWorks 1.4.2 to create a simple grammar for the purpose of evaluating
I examine heterogeneous trees in ANTLR (using ANTLRWorks 1.4.2). Here is the example of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.