comp.lang.ada
 help / color / mirror / Atom feed
* Trying to use ANTLR4 from GPRBuild
@ 2019-06-12 18:02 Lucretia
  0 siblings, 0 replies; only message in thread
From: Lucretia @ 2019-06-12 18:02 UTC (permalink / 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?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-12 18:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 18:02 Trying to use ANTLR4 from GPRBuild Lucretia

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