* Tools Generating Ada @ 2014-02-07 8:57 vincent.diemunsch 2014-02-07 9:34 ` Jacob Sparre Andersen ` (4 more replies) 0 siblings, 5 replies; 14+ messages in thread From: vincent.diemunsch @ 2014-02-07 8:57 UTC (permalink / raw) Hello everybody, I have a question regarding Ada Code Generation tools, like Aflex / Ayacc for instance. How can I insert them into the automatic build process ? I use GNAT GPL, so is it possible to create a GPRBuild project that generates Ada files from an AYacc source and then compile the Ada sources ? Do I need to use a make file ? Where can I find examples ? Regards, Vincent ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-07 8:57 Tools Generating Ada vincent.diemunsch @ 2014-02-07 9:34 ` Jacob Sparre Andersen 2014-02-07 9:41 ` Simon Wright ` (3 subsequent siblings) 4 siblings, 0 replies; 14+ messages in thread From: Jacob Sparre Andersen @ 2014-02-07 9:34 UTC (permalink / raw) vincent.diemunsch@gmail.com writes: > I have a question regarding Ada Code Generation tools, like Aflex / > Ayacc for instance. How can I insert them into the automatic build > process ? I use GNAT GPL, so is it possible to create a GPRBuild > project that generates Ada files from an AYacc source and then compile > the Ada sources ? Do I need to use a make file ? Where can I find > examples ? You should be able to do it with GPRBuild. I haven't tried yet. I use make files for that kind of problems. Some examples: http://repositories.jacob-sparre.dk/alsa-binding http://repositories.jacob-sparre.dk/photo-blog http://repositories.jacob-sparre.dk/gnatcoll-orm-foreign-key-twins Greetings, Jacob -- "[...] *transfer* a bit of salary from the person who writes a bug to the person that finds a bug..." -- Keith Ray ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-07 8:57 Tools Generating Ada vincent.diemunsch 2014-02-07 9:34 ` Jacob Sparre Andersen @ 2014-02-07 9:41 ` Simon Wright 2014-02-07 16:32 ` Pascal Obry 2014-02-08 8:33 ` vincent.diemunsch 2014-02-07 16:52 ` Vadim Godunko ` (2 subsequent siblings) 4 siblings, 2 replies; 14+ messages in thread From: Simon Wright @ 2014-02-07 9:41 UTC (permalink / raw) vincent.diemunsch@gmail.com writes: > I have a question regarding Ada Code Generation tools, like Aflex / > Ayacc for instance. How can I insert them into the automatic build > process ? I use GNAT GPL, so is it possible to create a GPRBuild > project that generates Ada files from an AYacc source and then compile > the Ada sources ? Do I need to use a make file ? Where can I find > examples ? This looks to be related: http://www.adacore.com/adaanswers/gems/gem-155-enhancing-gprbuild-database-for-new-language/ ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-07 9:41 ` Simon Wright @ 2014-02-07 16:32 ` Pascal Obry 2014-02-08 8:33 ` vincent.diemunsch 1 sibling, 0 replies; 14+ messages in thread From: Pascal Obry @ 2014-02-07 16:32 UTC (permalink / raw) Le vendredi 07 février 2014 à 09:41 +0000, Simon Wright a écrit : > vincent.diemunsch@gmail.com writes: > > > I have a question regarding Ada Code Generation tools, like Aflex / > > Ayacc for instance. How can I insert them into the automatic build > > process ? I use GNAT GPL, so is it possible to create a GPRBuild > > project that generates Ada files from an AYacc source and then compile > > the Ada sources ? Do I need to use a make file ? Where can I find > > examples ? > > This looks to be related: > http://www.adacore.com/adaanswers/gems/gem-155-enhancing-gprbuild-database-for-new-language/ Not really what's the OP want to achieve. The goal is to generate a set of sources from a project file (using aflex/ayacc or any other generator) and make the newly generated files part of the current compilation. I'm not sure this is possible... Pascal. -- Pascal Obry / Magny Les Hameaux (78) The best way to travel is by means of imagination http://v2p.fr.eu.org http://www.obry.net gpg --keyserver keys.gnupg.net --recv-key F949BD3B ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-07 9:41 ` Simon Wright 2014-02-07 16:32 ` Pascal Obry @ 2014-02-08 8:33 ` vincent.diemunsch 1 sibling, 0 replies; 14+ messages in thread From: vincent.diemunsch @ 2014-02-08 8:33 UTC (permalink / raw) Le vendredi 7 février 2014 10:41:15 UTC+1, Simon Wright a écrit : > vincent D. writes: > > > > > I have a question regarding Ada Code Generation tools, like Aflex / > > > Ayacc for instance. How can I insert them into the automatic build > > > process ? I use GNAT GPL, so is it possible to create a GPRBuild > > > project that generates Ada files from an AYacc source and then compile > > > the Ada sources ? Do I need to use a make file ? Where can I find > > > examples ? > > > > This looks to be related: > > http://www.adacore.com/adaanswers/gems/gem-155-enhancing-gprbuild-database-for-new-language/ Thanks all for your responses. I certainly will use a makefile, but I hoped someone has used GPRBuild to do that, defining a new language, and using a "subsystem" or "subproject" for code generation. But as Pascal mentioned the big question is will GPRBuild handle correcty the fact that some Ada source files have been modified by the subproject. It needs a try ! Regards, Vincent ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-07 8:57 Tools Generating Ada vincent.diemunsch 2014-02-07 9:34 ` Jacob Sparre Andersen 2014-02-07 9:41 ` Simon Wright @ 2014-02-07 16:52 ` Vadim Godunko 2014-02-07 19:32 ` gautier_niouzes 2014-02-08 8:47 ` Stephen Leake 4 siblings, 0 replies; 14+ messages in thread From: Vadim Godunko @ 2014-02-07 16:52 UTC (permalink / raw) On Friday, February 7, 2014 12:57:28 PM UTC+4, vincent....@gmail.com wrote: > > I have a question regarding Ada Code Generation tools, like Aflex / Ayacc for instance. How can I insert them into the automatic build process ? I use GNAT GPL, so is it possible to create a GPRBuild project that generates Ada files from an AYacc source and then compile the Ada sources ? Do I need to use a make file ? Where can I find examples ? > You need to use Makefile or shell script to run <something>-to-Ada code generators. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-07 8:57 Tools Generating Ada vincent.diemunsch ` (2 preceding siblings ...) 2014-02-07 16:52 ` Vadim Godunko @ 2014-02-07 19:32 ` gautier_niouzes 2014-02-08 8:47 ` Stephen Leake 4 siblings, 0 replies; 14+ messages in thread From: gautier_niouzes @ 2014-02-07 19:32 UTC (permalink / raw) > I have a question regarding Ada Code Generation tools, like Aflex / Ayacc for instance. How can I insert them into the automatic build process ? I use GNAT GPL, so is it possible to create a GPRBuild project that generates Ada files from an AYacc source and then compile the Ada sources ? Do I need to use a make file ? Where can I find examples ? The Ayacc/Aflex tools generate Ada source files (1) which are for instance an Ada code generator (2). So Ada sources are generated at two levels! So not sure what you want to do exactly... The parser (1) needs to be compiled only when you change the .y / .l files (parser grammar / lexer). Code generated at (2) needs to be compiled when the input side of the code generator has changed. You can for instance configure the code generator to call gprbuild each time the generator has finished generating the Ada sources. As an example where the latter is automatized, there is GWenerator ( see @ http://sf.net/projects/gnavi/ ) which does all that automatically. You can continue using the GNAT Programming Studio while letting GWenerator running in the background. For other examples, with no automatic activation, I have also two other Ada code generators and a few other ayacc tools if you are interested (all open source). HTH _________________________ Gautier's Ada programming http://gautiersblog.blogspot.com/search/label/Ada NB: follow the above link for a valid e-mail address ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-07 8:57 Tools Generating Ada vincent.diemunsch ` (3 preceding siblings ...) 2014-02-07 19:32 ` gautier_niouzes @ 2014-02-08 8:47 ` Stephen Leake 2014-02-11 17:48 ` Vincent DIEMUNSCH 4 siblings, 1 reply; 14+ messages in thread From: Stephen Leake @ 2014-02-08 8:47 UTC (permalink / raw) vincent.diemunsch@gmail.com writes: > Hello everybody, > > I have a question regarding Ada Code Generation tools, like Aflex / > Ayacc for instance. How can I insert them into the automatic build > process ? Yes; you have to write an XML file to tell gprbuild about the tool. I did this for Auto_Text_IO, which produces *.Text_IO packages from Ada packages. The process is not well documented, and the XML file often needs tweaking with new releases of the GNAT compiler; I submit a bug report to find out how to tweak. I don't recommend doing this without an AdaCore support contract. Unless you have read and understand all of the gprbuild source :). >I use GNAT GPL, so is it possible to create a GPRBuild > project that generates Ada files from an AYacc source and then compile > the Ada sources ? That takes two projects, to keep the source information distinct. >Do I need to use a make file ? No, the project that compiles the Ada code can 'with' the project that produces the Ada code. However, gprbuild doesn't always get the dependencies right; sometimes you have to run it twice. >Where can I find > examples ? Here. This works with GNAT 7.1.2, and probably with GPL 2013: with "sal_text_io"; project Common_Text_IO is for Languages use ("Auto_Text_IO"); for Source_Dirs use ("../1553", "../base", "../base/test", "../models", "../../opentoken"); for Object_Dir use "auto"; for Source_Files use ("gds-hardware-bus_1553-time_tone.ads", "gds-unconstrained_arrays.ads", "simple_flight-rwa.ads", "simple_flight-safehold_css.ads"); package Compiler is for Default_Switches ("Auto_Text_IO") use ("-05"); end Compiler; end Common_Text_IO; with "opentoken"; with "sal"; with "standard_common"; with "../common_text_io"; project GDS is for Source_Dirs use ("../auto", "../../1553", "../../asist_if", "../../base", "../../fpga", "../../hardware", "../../itos_if", "../../models", "../../models/sofa", "../../spacewire", "../../system", "../../windows"); for Object_Dir use "objects"; for Exec_Dir use "."; for Languages use ("Ada", "C"); package Compiler is for Default_Switches ("Ada") use Standard_Common.Compiler.Release_Switches & Standard_Common.Compiler.Style_Checks & Standard_Common.Compiler'Default_Switches ("Ada"); for Local_Configuration_Pragmas use "../gnat_config_pragmas.adc"; for Default_Switches ("C") use Standard_Common.Compiler.Release_Switches_C; end Compiler; package Binder is for Default_Switches ("Ada") use Standard_Common.Binder'Default_Switches ("Ada"); end Binder; package Builder is for Default_Switches ("Ada") use Standard_Common.Builder'Default_Switches ("Ada"); -- We use ".exe" extension even on non-Windows, to simplify the makefiles. for Executable_Suffix use ".exe"; end Builder; end GDS; ---- auto_text_io.xml ----- <?xml version="1.0" ?> <!-- Run auto_text_io To tell gprbuild how to run auto_text_io: copy this file to <gnat>/share/gprconfig use gprbuild - -autoconf --> <gprconfig> <compiler_description> <name>Auto_Text_IO</name> <executable prefix="-1">auto_text_io.exe</executable> <languages>Auto_Text_IO</languages> <version> <external>auto_text_io.exe -?</external> <grep regexp="auto_text_io version .*"/> </version> <!-- target must match gprconfig target --> <target> <external>${PREFIX}gcc -dumpmachine</external> <grep regexp="[^\r\n]+"></grep> </target> </compiler_description> <configuration> <compilers> <compiler language="Auto_Text_IO"/> </compilers> <config> package Compiler is for Driver ("Auto_Text_IO") use "${PATH(auto_text_io)}auto_text_io.exe"; for Include_Path ("Auto_Text_IO") use "ADA_INCLUDE_PATH"; for Required_Switches ("Auto_Text_IO") use ("-f"); for Dependency_Switches ("Auto_Text_IO") use ("-M"); end Compiler; package Naming is for Body_Suffix ("Auto_Text_IO") use ".ads"; end Naming; for Inherit_Source_Path ("Auto_Text_IO") use ("Ada"); for Object_Generated ("Auto_Text_IO") use "false"; </config> </configuration> </gprconfig> -- -- Stephe ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-08 8:47 ` Stephen Leake @ 2014-02-11 17:48 ` Vincent DIEMUNSCH 2014-02-11 21:08 ` briot.emmanuel 2014-02-13 15:31 ` Stephen Leake 0 siblings, 2 replies; 14+ messages in thread From: Vincent DIEMUNSCH @ 2014-02-11 17:48 UTC (permalink / raw) On Saturday, February 8, 2014 9:47:20 AM UTC+1, Stephen Leake wrote: > Vincent writes: > > > > > Hello everybody, > > > > > > I have a question regarding Ada Code Generation tools, like Aflex / > > > Ayacc for instance. How can I insert them into the automatic build > > > process ? > > > > Yes; you have to write an XML file to tell gprbuild about the tool. > > > > I did this for Auto_Text_IO, which produces *.Text_IO packages from Ada > > packages. > > > > The process is not well documented, and the XML file often needs > > tweaking with new releases of the GNAT compiler; I submit a bug report > > to find out how to tweak. I don't recommend doing this without an > > AdaCore support contract. Unless you have read and understand all of the > > gprbuild source :). > > > > >I use GNAT GPL, so is it possible to create a GPRBuild > > > project that generates Ada files from an AYacc source and then compile > > > the Ada sources ? > > > > That takes two projects, to keep the source information distinct. > > > > >Do I need to use a make file ? > > > > No, the project that compiles the Ada code can 'with' the project that > > produces the Ada code. > > > > However, gprbuild doesn't always get the dependencies right; sometimes > > you have to run it twice. > > > > >Where can I find > > > examples ? > > > > Here. This works with GNAT 7.1.2, and probably with GPL 2013: > > > > with "sal_text_io"; > > project Common_Text_IO is > > for Languages use ("Auto_Text_IO"); > > > > for Source_Dirs use > > ("../1553", > > "../base", > > "../base/test", > > "../models", > > "../../opentoken"); > > for Object_Dir use "auto"; > > for Source_Files use > > ("gds-hardware-bus_1553-time_tone.ads", > > "gds-unconstrained_arrays.ads", > > "simple_flight-rwa.ads", > > "simple_flight-safehold_css.ads"); > > > > package Compiler is > > for Default_Switches ("Auto_Text_IO") use ("-05"); > > end Compiler; > > end Common_Text_IO; > > > > > > with "opentoken"; > > with "sal"; > > with "standard_common"; > > with "../common_text_io"; > > project GDS is > > > > for Source_Dirs use > > ("../auto", > > "../../1553", > > "../../asist_if", > > "../../base", > > "../../fpga", > > "../../hardware", > > "../../itos_if", > > "../../models", > > "../../models/sofa", > > "../../spacewire", > > "../../system", > > "../../windows"); > > > > for Object_Dir use "objects"; > > for Exec_Dir use "."; > > > > for Languages use ("Ada", "C"); > > > > package Compiler is > > for Default_Switches ("Ada") use > > Standard_Common.Compiler.Release_Switches & > > Standard_Common.Compiler.Style_Checks & > > Standard_Common.Compiler'Default_Switches ("Ada"); > > > > for Local_Configuration_Pragmas use "../gnat_config_pragmas.adc"; > > > > for Default_Switches ("C") use Standard_Common.Compiler.Release_Switches_C; > > > > end Compiler; > > > > package Binder is > > for Default_Switches ("Ada") use Standard_Common.Binder'Default_Switches ("Ada"); > > end Binder; > > > > package Builder is > > for Default_Switches ("Ada") use Standard_Common.Builder'Default_Switches ("Ada"); > > > > -- We use ".exe" extension even on non-Windows, to simplify the makefiles. > > for Executable_Suffix use ".exe"; > > end Builder; > > > > end GDS; > > > > ---- auto_text_io.xml ----- > > <?xml version="1.0" ?> > > <!-- Run auto_text_io > > > > To tell gprbuild how to run auto_text_io: > > > > copy this file to <gnat>/share/gprconfig > > > > use gprbuild - -autoconf > > > > --> > > <gprconfig> > > <compiler_description> > > <name>Auto_Text_IO</name> > > <executable prefix="-1">auto_text_io.exe</executable> > > <languages>Auto_Text_IO</languages> > > <version> > > <external>auto_text_io.exe -?</external> > > <grep regexp="auto_text_io version .*"/> > > </version> > > <!-- target must match gprconfig target --> > > <target> > > <external>${PREFIX}gcc -dumpmachine</external> > > <grep regexp="[^\r\n]+"></grep> > > </target> > > </compiler_description> > > > > <configuration> > > <compilers> > > <compiler language="Auto_Text_IO"/> > > </compilers> > > <config> > > package Compiler is > > for Driver ("Auto_Text_IO") use "${PATH(auto_text_io)}auto_text_io.exe"; > > for Include_Path ("Auto_Text_IO") use "ADA_INCLUDE_PATH"; > > for Required_Switches ("Auto_Text_IO") use ("-f"); > > for Dependency_Switches ("Auto_Text_IO") use ("-M"); > > end Compiler; > > package Naming is > > for Body_Suffix ("Auto_Text_IO") use ".ads"; > > end Naming; > > for Inherit_Source_Path ("Auto_Text_IO") use ("Ada"); > > for Object_Generated ("Auto_Text_IO") use "false"; > > </config> > > </configuration> > > </gprconfig> > > > > > > > > -- > > -- Stephe Thank you very much for your complete response ! I'll try this, maybe with the help of AdaCore's support. By the way, does GPRBuild creates "ali" files for an external tool ? If not, then how can it knows what the dependencies ares ? Does your tool creates an ali file ? Kind regards, Vincent ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-11 17:48 ` Vincent DIEMUNSCH @ 2014-02-11 21:08 ` briot.emmanuel 2014-02-12 11:52 ` Vincent DIEMUNSCH 2014-02-13 15:31 ` Stephen Leake 1 sibling, 1 reply; 14+ messages in thread From: briot.emmanuel @ 2014-02-11 21:08 UTC (permalink / raw) > By the way, does GPRBuild creates "ali" files for an external tool ? gprbuild never creates an ALI file. The compiler does. > If not, then how can it knows what the dependencies ares ? In your case, you would generate a Makefile fragment showing the dependencies. I have written a gem on the subject, but I do not think it has been published yet on AdaCore's website. Perhaps next month. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-11 21:08 ` briot.emmanuel @ 2014-02-12 11:52 ` Vincent DIEMUNSCH 2014-02-12 13:38 ` Pascal Obry 2014-02-12 16:18 ` Robert A Duff 0 siblings, 2 replies; 14+ messages in thread From: Vincent DIEMUNSCH @ 2014-02-12 11:52 UTC (permalink / raw) On Tuesday, February 11, 2014 10:08:14 PM UTC+1, briot.e...@gmail.com wrote: > > By the way, does GPRBuild creates "ali" files for an external tool ? > > > > gprbuild never creates an ALI file. The compiler does. Does the linker, or the binder, modify the ALI file ? > > > > > > > If not, then how can it knows what the dependencies ares ? > > > > In your case, you would generate a Makefile fragment showing the dependencies. > > I have written a gem on the subject, but I do not think it has been published yet > > on AdaCore's website. Perhaps next month. Thanks for the answer, Emmanuel. I'll wait for your gem ! ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-12 11:52 ` Vincent DIEMUNSCH @ 2014-02-12 13:38 ` Pascal Obry 2014-02-12 16:18 ` Robert A Duff 1 sibling, 0 replies; 14+ messages in thread From: Pascal Obry @ 2014-02-12 13:38 UTC (permalink / raw) Le mercredi 12 février 2014 à 03:52 -0800, Vincent DIEMUNSCH a écrit : > > gprbuild never creates an ALI file. The compiler does. > > Does the linker, or the binder, modify the ALI file ? No, the ALI is only modified by the compiler. gprbuild use it to call the binder and the linker. For sure the linker does not even knows about the existence of the ALI file. -- Pascal Obry / Magny Les Hameaux (78) The best way to travel is by means of imagination http://v2p.fr.eu.org http://www.obry.net gpg --keyserver keys.gnupg.net --recv-key F949BD3B ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-12 11:52 ` Vincent DIEMUNSCH 2014-02-12 13:38 ` Pascal Obry @ 2014-02-12 16:18 ` Robert A Duff 1 sibling, 0 replies; 14+ messages in thread From: Robert A Duff @ 2014-02-12 16:18 UTC (permalink / raw) Vincent DIEMUNSCH <vincent.diemunsch@gmail.com> writes: > Does the linker, or the binder, modify the ALI file ? The builder (gnatmake or gprbuild) reads the ALI files (or takes note of the fact that some ALI files don't exist) in order to decide what needs to be compiled. The compiler writes the ALI files. The binder reads the ALI files to check that everything is up-to-date and consistent (but this step is normally skipped when you use the builder, because the builder already makes sure of that). The binder does not write on the ALI files. ALI files are specific to GNAT/Ada. The linker is language independent, so it doesn't know anything about ALI files, and neither reads nor writes them. - Bob ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Tools Generating Ada 2014-02-11 17:48 ` Vincent DIEMUNSCH 2014-02-11 21:08 ` briot.emmanuel @ 2014-02-13 15:31 ` Stephen Leake 1 sibling, 0 replies; 14+ messages in thread From: Stephen Leake @ 2014-02-13 15:31 UTC (permalink / raw) Vincent DIEMUNSCH <vincent.diemunsch@gmail.com> writes: > On Saturday, February 8, 2014 9:47:20 AM UTC+1, Stephen Leake wrote: >> Vincent writes: >> (please trim your responses; paging thru lots of irrelevant old posts is annoying) > Thank you very much for your complete response ! You're welcome. > > I'll try this, maybe with the help of AdaCore's support. > > By the way, does GPRBuild creates "ali" files for an external tool ? As others have pointed out, only the compiler generates ali files. But gprbuild can call the compiler, so the answer is "yes, it can be used for that". However, you need to specify different compilation switches; the ali files contain slightly different information when intended for ASIS than when intended for the binder and linker. (auto_text_io is an ASIS application). auto_text_io can call the compiler to create the ali files it needs, or you can use gprbuild to generate the ali files for auto_text_io; it depends on your overall flow. -- -- Stephe ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-02-13 15:31 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-02-07 8:57 Tools Generating Ada vincent.diemunsch 2014-02-07 9:34 ` Jacob Sparre Andersen 2014-02-07 9:41 ` Simon Wright 2014-02-07 16:32 ` Pascal Obry 2014-02-08 8:33 ` vincent.diemunsch 2014-02-07 16:52 ` Vadim Godunko 2014-02-07 19:32 ` gautier_niouzes 2014-02-08 8:47 ` Stephen Leake 2014-02-11 17:48 ` Vincent DIEMUNSCH 2014-02-11 21:08 ` briot.emmanuel 2014-02-12 11:52 ` Vincent DIEMUNSCH 2014-02-12 13:38 ` Pascal Obry 2014-02-12 16:18 ` Robert A Duff 2014-02-13 15:31 ` Stephen Leake
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox