I did't want to compile the sources since I have problems building it, I had to make some changes and I was afraid of modify the program behaviour.
Therefore, I have decided to use the previous version in the repository at
http://sourceforge.net/projects/p2ada/files/p2ada/Sources/ (newp2ada-24-aug-2008.zip), and according the instructions (newp2ada.txt), I unzipped the zip (unzip -aaLL) and in the newp2ada folder I have done "gnatmake p2ada" and it is built and runs properly.
However, I would like to use the 2010 version (p2ada-aug-2010-src.tgz) but according the instructions (newp2ada/README), I unzipped the zip (unzip -aaLL) and in the newp2ada folder I have done "gnatmake p2ada" and gives problems:
gnatmake p2ada
gcc -c p2ada.adb
p2ada.adb:27:06: file "pascal_io.ads" not found
gnatmake: "p2ada.adb" compilation error
Therefore I decided follow the instructions of "How to make P2Ada translator work?"
First of all the instructions says about a file newp2ada.zip which I don't have. I assume that file is equvalent to the one that I downloaded p2ada-aug-2010-src.tgz (So here the first weird thing). I have decided to uncompress the tgz, compress again to .zip and decompress with "unzip -aaLL".
Then, I create the folder acu and modify the file p2ada_options.ads. According the instrucctions, we have replace one string DOS by Unix, but the instrucctions are not clear, I assume that is the second one (here the second weird thing):
type Line_endings is (Unix,DOS,Mac); -- LF,CR/LF,CR
new_line_endings: Line_endings:= DOS; -- <-----This one
Then next step is make and if I do it(here the third weird thing):
$ make
make: *** No rule to make target `aflex', needed by `pascal_dfa.adb'. Stop.
Since the readme says that "aflex and ayacc must have been made (see below) and copy or link them here" I follow the instructions "How to change P2Ada for yet another Pascal dialect ?":
1. building AYACC :
- go to directory ayacc
- run "gnatmake ayacc"
it looks ok:
$ gnatmake ayacc
gcc -c ayacc.adb
gcc -c ayacc_file_names.adb
gcc -c command_line_interface.adb
gcc -c error_report_file.adb
gcc -c options.adb
gcc -c output_file.adb
gcc -c parse_table.adb
gcc -c parser.adb
gcc -c rule_table.adb
gcc -c source_file.adb
gcc -c string_pkg.adb
gcc -c symbol_table.adb
gcc -c tokens_file.adb
gcc -c str_pack.adb
gcc -c string_scanner.adb
gcc -c string_lists.ads
gcc -c actions_file.adb
gcc -c parse_template_file.adb
gcc -c goto_file.adb
gcc -c lalr_symbol_info.adb
gcc -c lr0_machine.adb
gcc -c shift_reduce_file.adb
gcc -c symbol_info.adb
gcc -c verbose_file.adb
gcc -c lexical_analyzer.adb
gcc -c lists.adb
gcc -c stack_pkg.adb
gcc -c ragged.adb
gcc -c stack_pack.adb
gcc -c set_pack.adb
gnatbind -x ayacc.ali
gnatlink ayacc.ali
- move the executable in a reachable directory (see: path)
2. building AFLEX :
- go to directory aflex
- run "gnatmake aflex"
- move the executable in a reachable directory (see: path)
it looks ok:
$ gnatmake aflex
gcc -c aflex.adb
gcc -c dfa.adb
gcc -c gen.adb
gcc -c main_body.adb
gcc -c misc.adb
gcc -c misc_defs.adb
gcc -c template_manager.adb
gcc -c ccl.adb
gcc -c ecs.adb
gcc -c int_io.ads
gcc -c nfa.adb
gcc -c skeleton_manager.adb
gcc -c tblcmp.adb
gcc -c tstring.ads
gcc -c parse_tokens.ads
gcc -c scanner.adb
gcc -c command_line_interface.adb
gcc -c external_file_manager.adb
gcc -c parser.adb
gcc -c file_string.ads
gcc -c vstrings.adb
gcc -c ascan_dfa.adb
gcc -c ascan_io.adb
gcc -c sym.adb
gcc -c aflex_scanner.adb
gcc -c parse_goto.ads
gcc -c parse_shift_reduce.ads
gnatbind -x aflex.ali
gnatlink aflex.ali
Then I follow the instructions:
-go to directory lypascal
- type "ayacc pascal.y"
$ ayacc pascal.y
Ayacc (File => "pascal.y",
C_Lex => Off,
Debug => Off,
Summary => On,
Verbose => Off,
Error_Recovery => Off,
Extension => ".a");
637 Productions
420 Nonterminals
105 Terminals
866 States
76 Shift/Reduce conflicts
92 Reduce/Reduce conflicts
- type "aflex -i -E pascal.l" (No output)
- change the file extensions (.a) of new Ada files if needed (e.g. for GNAT) and move them to upper directory
ls:
pascal.a pascal_io.a pascal.l01 pascal.l06 pascal_shift_reduce.ads pascal.y00 pascal.y03 pascal.y07
pascal_dfa.a pascal.l pascal.l02 pascal.l97 pascal_tokens.ads pascal.y01 pascal.y05 pascal.y97
pascal_goto.ads pascal.l00 pascal.l03 pascal.l99 pascal.y pascal.y02 pascal.y06 pascal.y99
(I assume that I have to change pascal.a, pascal_io.a and pascal_dfa.a to .ads and move to the upper directory., here the forth weird thing)
- build P2Ada ("gnatmake p2ada").and then:
$ gnatmake p2ada
gcc -c p2ada.adb
pascal_io.ads:91:01: end of file expected, file can have only one compilation unit
gnatmake: "p2ada.adb" compilation error
I don't understand what happends, it looks that the steps of the README does not correspond to this version.
Any idea?
The status of my files are the following:
https://www.dropbox.com/s/9h25jpumt1pzayp/p2ada-aug-2010-src.zip?dl=0
Thanks