comp.lang.ada
 help / color / mirror / Atom feed
From: Lucretia <laguest9000@googlemail.com>
Subject: Trying to use ANTLR4 from GPRBuild
Date: Wed, 12 Jun 2019 11:02:34 -0700 (PDT)
Date: 2019-06-12T11:02:34-07:00	[thread overview]
Message-ID: <749a3fde-4823-4c4c-8457-c4706b617e72@googlegroups.com> (raw)

Hi,

I've created an antlr4.xml file in a gprbuild dir:

<?xml version="1.0" ?>
<gprconfig>
    <compiler_description>
        <name>ANTLR4</name>
        <executable>java</executable>
        <version>4.7.2</version>
        <languages>ANTLR4</languages>
    </compiler_description>

    <configuration>
        <compilers>
            <compiler name="ANTLR4" language="ANTLR4" />
        </compilers>

        <config>
package Naming is
   for Body_Suffix ("ANTLR4") use ".g4";
end Naming;

package Compiler is
   for Driver ("ANTLR4") use "java";
   for Leading_Required_Switches ("ANTLR4") use ("-Xmx500M", "org.antlr.v4.Tool");
   for Dependency_Kind ("ANTLR4") use "None";
   -- Doesn't like this next switch for some reason!
   --for Objects_Linked ("ANTLR4") use "False";
end Compiler;
        </config>
    </configuration>
</gprconfig>

I've got a gpr file which includes:

   for Languages use ("C++", "Ada", "ANTLR4");

   package Compiler is
      for Default_Switches ("ANTLR4") use ("-o", Out_Dir & ".src", "-Dlanguage=Cpp");
   end Compiler;

I have a ThingLexer.g4 and a ThingParser.g4, but for some reason it's trying to build ThingParser.g4 first, when by alphabetic sorting, it should be trying to build ThingLexer.g4.

Changing to object directory of "Core": "<mysrc>/thing/build/gnat/gen/debug/core/.obj/"
/usr/bin/java -Xmx500M org.antlr.v4.Tool -o gen/debug/core.src -Dlanguage=Cpp <mysrc>/thing/lib/core/ThingParser.g4
error(114): <mysrc>/thing/lib/core/ThingParser.g4:4:17: cannot find tokens file <mysrc>/thing/lib/core/ThingLexer.tokens
...

Re the first line, where gprbuild is changing the directory, is there a way to specify the output dir for antler so I can point it at <mysrc>/thing/build/gnat/gen/debug/core/src for example?


                 reply	other threads:[~2019-06-12 18:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox