Issue on gnat compiler

Hi,

according to Barnes’ Ada 2022 book and http://www.ada-auth.org/standards/22rm_w_amd1/html/RM-3-8.html

the syntax

type A is record

end record A;

is allowed since Ada 2022, but setting Pragma Ada_2022 on my package and run GNAT 15.2.0, results in error “missing ;” before the type’s name.

So these seems to be an issue in GNAT. Haven’t tested with the very latests version.

Kind regards,
Kay-Uwe

22:08 … correction on syntax issue.

Reading the RM, it should be “end record A;” not “end A;”.

Best regards,
Joakim

You’re right for the syntax … but that doesn’t work (neither).

that is the real code GNAT is complaining about as soon as I changed the last line from
end record; to end record Interface_Group_Flags;

type Interface_Group_Flags is record
TA_Present : Boolean := False;
TB_Present : Boolean := False;
TC_Present : Boolean := False;
TD_Present : Boolean := False;
Interface_Character_Count : Natural range 0 .. 4 := 0;
end record Interface_Group_Flags;

GNAT doesn’t implementat whole Ada 2022 (yet?).

Well, that is sad to hear. There are some nice features announced and advertised. Giving your answer, I started a search for implemented features and the list seems to be really long already:

Hopefully it will add that in the future too.

You may find here all AARM 2022 examples.
Ada codes that don’t compile with GNAT 13 is commented.
There are some specific branches for Ada 202x compiled with GNAT 14.
You may try GNAT 15 or 16.

This is great!

May I use it my Ada Syntax Analyzer test suite?

I need to add a comment on top of each file in order to describe what the test need to be parsed into. E.g.

--
-- Description: Hello world test
--
-- Success: 10:1..13:16 Tree *
--
-- with Ada.Text_IO; use Ada.Text_IO; procedure Hello_World is begin Put_Line ("Hello world!"); end Hello_World;
--
with Ada.Text_IO;  use Ada.Text_IO;

procedure Hello_World is
begin
   Put_Line ("Hello world!");
end Hello_World;

Would a link there to your repository suffice?

Of course go ahead.

Could you be more specific?

For example, code borrowed from Ada programming book:

--
-- Tasks https://en.wikibooks.org/wiki/Ada_Programming/Tasking Ex.10
--
-- Success: 24:1..41:9
--
-- procedure WiKi is
--   task Password_Server is
--      entry Check (User, Pass : String; Valid : out Boolean);
--      entry Set (User, Pass : String);
--   end Password_Server;
--   User_Name, Password : String (1..8);
-- begin
--   Put ("Please give your new password:");
--   Get_Line (Password);
--   select
--      Password_Server.Set (User_Name, Password);
--      Put_Line ("Done");
--   or
--      delay 10.0;
--      Put_Line ("The system is busy now, please try again later.");
--   end select;
-- end WiKi;
--
procedure WiKi is
  task Password_Server is
     entry Check (User, Pass : in String; Valid : out Boolean);
     entry Set (User, Pass : in  String);
  end Password_Server;

  User_Name, Password : String (1 .. 8);
begin
  Put ("Please give your new password:");
  Get_Line (Password);
  select
     Password_Server.Set (User_Name, Password);
     Put_Line ("Done");
  or
     delay 10.0;
     Put_Line ("The system is busy now, please try again later.");
  end select;
end WiKi;

I add a link to the book at the beginning. So I would to your repository.

No problem, of course, go ahead and do it.