r/ada • • Sep 12 '26

Show and Tell Building an Ada Compiler with AI: The adac Experiment

3 Upvotes

Hello,

For a while now, I've been developing an Ada compiler called adac, making extensive use of AI throughout the development process.

The long-term goal is to build a standalone Ada compiler written in Ada. The plan is to keep the frontend and backend separate, use our own target-independent IR, gradually reach self-hosting, support multiple platforms, and eventually add a WebAssembly backend as well as an optional LLVM backend.

The reason I started the project was actually pretty simple.

I wanted to compile Guiyom, the GUI toolkit I'm developing, to WebAssembly so that it could run on the web. But I couldn't find a suitable Ada compiler that both fit the licensing requirements I had in mind and provided a practical path to Wasm.

So at some point I thought:

"Why not just make one?"

And that's how it started.

More recently, while working on Clair and Guiyom, I came across about four issues that appear to be bugs in GNAT or the surrounding toolchain. In the past, reproducing, minimizing, and tracing the causes of problems like these would probably have required a considerable amount of time and effort.

But after making active use of AI in the development process, I've found that the cost of reproducing and minimizing problems, forming hypotheses, and then testing those hypotheses has dropped significantly.

I've had a similar experience developing Adac.

I define the long-term goal, have the AI create a roadmap toward that goal, and then review the overall direction and major design decisions while the AI works through the roadmap in small units, repeatedly implementing and testing each one.

In practice, the instructions I give the AI are often surprisingly simple:

"Continue with the roadmap."

"Proceed with the next task."

"Review the current state of the work and keep going."

Most of the time, it's something along those lines.

The reason such short instructions are enough is that the roadmap, project documentation, and tests already describe the current state of the project and what should come next. The AI reads those materials, figures out where the project currently stands, implements the next unit of work, tests it, updates the roadmap based on the results, and continues from there.

One thing I've learned from this process is that having the AI write a lot of code is not, by itself, the most important part. Keeping the roadmap up to date, breaking work into clear issues or work items, documenting discovered problems as reproducible bug reports, and turning fixed bugs into regression tests all seem to matter quite a bit.

The amusing part is that the AI also does most of the roadmap writing, issue organization, bug report writing, and regression test writing. :)

The roadmap provides the long-term direction and identifies what should come next. Issues and work items define the scope of the problem currently being solved. Bug reports make it possible to revisit exactly what went wrong and under what conditions. Regression tests help ensure that once a problem has been fixed, it does not quietly come back later. And continuous testing lets us verify that newly implemented features actually satisfy their requirements.

I didn't start this project as an Ada compiler expert, and I hardly write any of the implementation code myself.

These days, when I think about what my role actually is, I seem to be less of a developer in the traditional sense and more of an AI roadmap manager and an AI work-direction manager. :)

Most of what I do is decide and review what should be built, in what order, whether the current results are aligned with the goal, and what should be fixed or worked on next. The AI handles the actual implementation, and I review the results and test outcomes before deciding where to go next.

So I honestly don't know how far this project will ultimately go.

Adac is still at an early stage, and it has a long way to go before I would call it a practical Ada compiler. For a limited subset of the language, it can already produce and test native executables, but there are still many features to implement before it can compile a broad range of real-world Ada programs.

Still, if development continues this way, I hope that in about a year it will reach a pretty interesting point where it can compile a much wider variety of small Ada programs than it can today.

I'm also curious to see what happens if the same cycle of design, implementation, testing, and revision continues for several years.

So for me, adac is both an Ada compiler project and a long-term experiment.

"What happens if AI is used not merely as a coding assistant, but as an active participant in a software project over a long period of time? How far can the project go?"

That's the experiment.

There's also one thing I've found unexpectedly interesting while working on it.

Ada itself seems to be a surprisingly good fit for AI. :)

Perhaps because of its strong type system and relatively explicit code structure, mistakes in AI-generated code tend to surface quickly during compilation, and I've found the cycle of fixing and verifying those mistakes fairly convenient.

Of course, this is only my personal experience so far.

I'd be interested to hear what people who have been using Ada for a long time think about AI-assisted development.

You can find the project here:

https://github.com/hodong-kim/adac


r/ada • • Jul 15 '26

Show and Tell AdaLang_Analyzer

0 Upvotes

⚠️ Every CTO in safety-critical software carries the same quiet risk: the defect that ships not because your engineers are careless, but because nothing caught it before code review — and code review is run by humans, on deadline.

In Ada codebases — ✈️ avionics, 🚄 rail, 🛰️ space, 🛡️ defense, 🏭 industrial control — that risk isn't theoretical. It's the line item your safety case has to account for.

🔧 AdaLang Analyzer is a static analysis tool we built to move that catch earlier and make it automatic.

Why it matters at the engineering-leadership level, not just the IDE:

⏱️ Shifts cost left. A dead store, an unreachable branch, a division that's statically zero — caught at commit time costs minutes. Caught in integration testing, or after deployment, costs a lot more than minutes.

✅ Turns coding standards into an enforced gate, not a document nobody reads. 34 checks spanning control flow, data flow, exception handling, and complexity — run automatically in CI, not hoped for in review.

📂 Scales to the whole codebase, not file-by-file. Point it at your GNAT project file and it analyzes every source directory your build already knows about — no separate file list to maintain and let drift out of date.

🔓 No vendor lock-in, no black box. It's open source (GPL-3.0). Your team — or your certification auditors — can read exactly what every check does and why it fired. That's a very different conversation with an assessor than "trust the vendor's tool."

💸 Zero licensing cost. Built on Libadalang, AdaCore's open-source semantic engine, and Alire — tooling your Ada team likely already has in its stack.

🎯 It's not a compliance certification and it doesn't claim to be one. It's a control your team can point to when someone asks "what's actually enforcing your coding standard."

👉 Repo's here if your team wants to kick the tires: https://github.com/mmartign/AdaLang_Analyzer

#EngineeringLeadership #RiskManagement #SafetyCritical #Ada #SoftwareQuality #OpenSource #TechnicalDebt #CTO


r/ada • • Jun 15 '10

AdaCrypt - Research in cryptography with implementations in Ada

Thumbnail
adacrypt.com
0 Upvotes

r/ada • • Nov 07 '18

Help needed with ada

0 Upvotes

<!-- SC_OFF --><div class="md"><p>Hello reddit!,I&#39;m starting with ada and I have some problems with records.</p>

<p>In one execise I must show the name the age and the average note of a student, but i only have the notes of the student and the birth year.Which commands I need to use.</p> <p>All notes are in the same array</p> <p>Can someone help me with this issue, please?</p>

<p>&#x200B;</p> </div><!-- SC_ON -->


r/ada • • Sep 18 '26

Programming hi , some ressources to learn Ada

0 Upvotes

r/ada • • Feb 05 '25

General Hardware that Ada does not run on (almost)

2 Upvotes

This is notebook based on Elbrus 2c3 CPU, with VLIW e2k ISA, manufactured by Promobit. It has compilers for C, C++. There is some experimental LLVM-based Rust compiler. It runs DOOM, DOOM 3, OpenTTD, Half Life, I lost track of what games enthusiasts managed to run on it. It has ports of JDK and Mono. And there is TraceMonkey, the accelerated JavaScript engine. So it can run plenty of stuff, but not anything in Ada, without tricks.

It has two x86 JITs, lintel for full x86 PC emulation. And rtc, for Linux-on-Linux emulation. RTC is the mainstream way to run anything Ada. RTC is a little strange. Ordinary qemu-user can be integrated into system to run alien programs ISA side by side with native ones. RTC has nothing in common with qemu-user and is unfortunately slightly worse. It is possible to enter, but not possible to exit. From inside RTC native VLIW binaries cannot start. That was major obstacle to play with AdaMagic. AdaMagic is closed source Linux binary that wants to produce C(++) sources and invoke C(++) translator on them. But AdaMagic is x86 binary and C(++) translator is VLIW binary, and so AdaMagic cannot invoke lcc without tricks.

It is hard to pretend to replace C(++) with Ada without translators like AdaMagic, and AdaMagic has little attention recently. Also, AdaMagic requires limitation by Ada 95. So if anyone writes in Ada 2005 or more recent, it becomes non-portable junk. There will be plenty of Half Life and OpenTTD running natively, and anything Ada won't run. And until AdaMagic gets upgrade, it does not change.


r/ada • • Jul 14 '26

General Whats the purpose of ada in 2026, genuine question guys

6 Upvotes

r/ada • • Oct 21 '22

SOME HELP IS NEEDED with ada program,THNXXX

0 Upvotes

Hey I have recently started programming with ada,and they have asked me to do a problem:Change a number from decimal to binary,I did it on phyton and I did not have any problem,but in ADA when I started to do the program similarly to the phyton one It does not work,here is the program:

I would appreciate a lot help with the program as well as some tips for ada looking for the future.

Thnxx
Asipux


r/ada • • Sep 07 '16

Life Isn't All Ada Programming :-) A bit of Ada Lovelace fiction from Beneath Ceaseless Skies - "To Rise No More" by Marie Brennan

Thumbnail
beneath-ceaseless-skies.com
0 Upvotes

r/ada • • Mar 23 '24

Homework How Can I Possibly Implement This as a Doubly Linked List?

1 Upvotes

On top of that, the data needs to be sorted in ascending order with priority of jobtype, age, then name, and the head nodes for each job should include null for name, the jobtype, and the amount of employees in that field for the age.

with Ada.Text_IO; use Ada.Text_IO;

procedure LinkSort is type JobType is (Programmer, Manager, Accountant, Analysist, Sales, Manufacturing, Inventory, SoftwareEnginner); package JobTypeIO is new Ada.Text_IO.Enumeration_IO(JobType); use JobTypeIO;

type EmpName is (David, Kevin, Sam, Mary, Bob, Marty, Sable, Betty, Tom, Teddy, Jerry, Ben, Sara, Donald, Damon, Darlene, Dustin, Desire); package EmpNameIO is new Ada.Text_IO.Enumeration_IO(EmpName);
use EmpNameIO;

subtype AgeType is integer range 0..100;

type LegalResponce is (yup, affirmative, nope, negative); subtype PositiveResponce is LegalResponce range yup..affirmative; package LegalIO is new Ada.Text_IO.Enumeration_IO(LegalResponce); use LegalIO;

package IntIO is new Ada.Text_IO.Integer_IO(Integer); use IntIO;

type Emp is record Name: EmpName; Job: JobType; Age: AgeType; LLink: integer; RLink: integer; end record;

SortByJob: Array(JobType) of integer := (others => 0);

SortSpace: Array(1..10) of Emp; Avail: integer := 1; -- Dynamic storage allocator. Previous: integer; Current: integer;

Again: LegalResponce := affirmative;

begin for Avail in SortSpace'Range loop put("Enter name: "); get(SortSpace(Avail).Name); --Get emp info. put("Enter job type: "); get(SortSpace(Avail).Job); put("Enter age: "); get(SortSpace(Avail).Age); -- Insert in appropriate list (by job). SortSpace(Avail).LLink := SortByJob(SortSpace(Avail).Job); SortByJob(SortSpace(Avail).Job) := Avail; -- Prepare for next dynamically allocated node. if Avail + 1 not in SortSpace'Range then exit; end if; put("Enter another name (yup or nope): "); get(Again); if Again not in PositiveResponce then exit; end if; end loop;

for I in JobType loop -- Traverse. new_line; put("Job Type = "); put (I); new_line; Previous := SortByJob(I); -- Point to first node in job list. while Previous /= 0 loop put(SortSpace(Previous).Name); put(" "); put(SortSpace(Previous).Job); put(" link = "); put(SortSpace(Previous).LLink,4); new_line; Previous := SortSpace(Previous).LLink; -- Move down list. end loop; end loop; end LinkSort;


r/ada • • Nov 17 '23

General ChatGPT says there is a pragma Finalize_Procedure - is that correct?

1 Upvotes

I was playing around with ChatGPT producing code it produced...

   -- Finalization procedure
   procedure Finalize is
   begin
      -- Perform cleanup or finalization actions here
      Resource := 0;  -- Reset the resource when the object goes out of scope
   end Finalize;
   pragma Finalize_Procedure (Finalize);

A quick search found no reference to this pragma, so is ChatGPT imagining this?


r/ada • • Aug 25 '22

General How do Ada on JVM and Kotlin compare?

0 Upvotes

How do Ada and Kotlin compare?

Particularly, since Kotlin seems to have a strong Java interop, and it's also the language for Android, then why would I still want to learn Ada on JVM?


r/ada • • Apr 26 '11

DISCUSSION ABOUT ADA: Appears to be gleanings from comp.lang.ada that the site owner finds interesting.

Thumbnail adaprogramming.info
0 Upvotes

r/ada • • Jan 23 '10

Ada Tutorial [French]

Thumbnail telecom-robotics.org
0 Upvotes

r/ada • • Aug 30 '24

Learning Does SPARK is for ADA as Typescript is for JavaScript ?

3 Upvotes

r/ada • • Oct 16 '22

Programming spark adacore project

0 Upvotes

Hey there I need help with a project in which we are given 6 packages we have to modify them and design a break system. If anyone can help please dm


r/ada • • Oct 16 '26

SPARK • I'm a 38-year-old welder. In 3 months, I learned Linux, Ada/SPARK, and built a formally verified TCB on top of the seL4 microkernel. Here is what I learned.

19 Upvotes

Hi r/ada,

I'm a 38-year-old welder from St. Petersburg, Russia. No formal CS background. I bought my first laptop for programming in June 2026, installed Linux, and started learning. Three months later I had a working prototype called Schild TCB - a trusted computing base on the seL4 microkernel, with an Ada/SPARK userland.

Here's what I found useful, especially the parts that didn't work, because those tend to be the most useful for anyone considering Ada/SPARK for a real project.

What it is

Schild TCB is two artifacts, not one:

A bare-metal OS written from scratch in Ada: bootloader, NVMe driver, e1000e NIC driver, TCP/IP stack, HTTP server. Runs on a ThinkPad T580.

An seL4-based artifact: the microkernel is upstream (I didn't write it), and my contribution is the root task and several daemons in Ada/SPARK. Network and storage run isolated in Ring 3 processes, communicating over IPC.

The point of the second artifact is formal verification. The bare-metal one answers "does it work"; the seL4 one answers "is it proven".

Verification

The kernel logic is 185 Ada modules, verified with gnatprove (GNAT Community toolchain) at SPARK Level 4. Result: not-proved: 0. Seven daemons in the root task are also proven at the same level.

I want to be precise here: not everything is proven. Drivers (NVMe, e1000e, network stack) are not proven and are not claimed to be. They're isolated in separate domains so their failure cannot reach the proven core. Proving a driver is a separate large effort - hardware has no formal specification, so there's nothing to write contracts against. Isolating is the right approach.

The most useful lesson

Formal verification caught a bug that all tests missed.

I set the page rights for MLS rings as ReadOnly := 1. But in seL4's CapRights layout, bit 0 is Write and bit 1 is Read. So my "read-only" page was actually "write-only", which x86 doesn't support, and the kernel masked it to "no access at all". Tests didn't catch this because the code simply never read those pages.

When I moved the root task to SPARK mode and started proving contracts, gnatprove showed the contract didn't match reality. One-line fix: ReadOnly := 2.

This is the single best argument for SPARK I can give: tests check what you thought to test. Proof checks what you claimed.

Where I'm stuck

Three things, all upstream, none in my code:

IOMMU (VT-d). No DMA isolation. I built seL4 with IOMMU support, the kernel detects VT-d, but under certain configurations the seL4 sporadic task replenishment path hangs non-deterministically (33-67% of runs, depending on period). Documented, left as-is.

SMAP. Hardware protection that prevents the kernel from accessing user memory without explicit permission. In this seL4 version, SMAP is gated on the printing option. Need logs - no SMAP. Need SMAP - no logs. I chose logs.

x86_64 MCS is formally verified weaker than ARM MCS. Official upstream status. I can only state it, not fix it.

One bug I did find and fix in upstream seL4: on a 32 GB laptop, the root task hung on first retype. Root cause was the MAX_NUM_DRHU formula - it treats the whole 1 GiB kernel-device window as IOMMU slots, yielding 262142, which bloated .boot.bss to ~6 MiB and shifted the kernel boundary. Capping it at 8 (real platforms have at most 8 IOMMUs) fixed the hang. Not my bug, but I found it.

On using AI

I used an AI agent as a coding assistant. I want to be upfront about this because it's relevant to how the project moved so fast.

I set the tasks, verified results, debugged on hardware, made architectural decisions. The agent wrote code. It's a separate skill, and I learned it during the project. The agent also made mistakes in microkernel specifics that I had to catch and correct.

I mention this because I think the Ada/SPARK community should know what's now possible for someone with no formal background, and also because I don't want to pretend I wrote every line myself.

What I'm looking for

I'm not publishing the repository yet. But I'd like feedback on the approach, especially from anyone who's done SPARK verification on a real system:

Is isolating drivers rather than proving them the right call, or is there a middle ground I'm missing?

The x86_64 MCS verification gap - is anyone tracking this upstream, or is ARM the only realistic path forward?

Any obvious mistakes in my trust model?

Happy to answer questions.


r/ada • • Oct 01 '22

Programming Made an Ada program that compiles and runs but result in "raised PROGRAM_ERROR : EXCEPTION_ACCESS_VIOLATION"

4 Upvotes

Made an Ada program that compiles and runs but result in "raised PROGRAM_ERROR : EXCEPTION_ACCESS_VIOLATION" at Win10 level.Using gcc version 10.3.1 20210520 (for GNAT Community 2021 20210519) (GCC).

The problematic code that generate the violation I suspect is defined with a separate stack/heap compared to the main program where the memory allocated for a protected object. Any Ideas on how to avoid the error?

Tried to use the advice from https://ugetfix.com/ask/how-to-fix-exception-access-violation-error-on-windows-10/

This led to the response from Win10 that I'm not allowed to turn off DEP for 64bit executables, for my monads.exe.

Program listing:

pragma Warnings (Off);

pragma Ada_2022;

with Ada.Text_IO;

with GNAT.Source_Info;

package body Monad_Functors is

MRP_I : Monad_Record_Ptr; -- 220917 Internal copy of pointer to external Monad record pointer

task body Element_Wrapper is

Cnt : Integer := 0;

Write : Writer_Function;

Read : Reader_Function;

Initiated : Boolean := false;

function Error_Cond(VE_MRP : Monad_Record_Ptr := MRP) return String is

begin

return String("-- " & GNAT.Source_Info.file &

GNAT.Source_Info.Line'Image &

" Element out of range for Monad_Element = " & MRP_I.E'Image);

end Error_Cond;

begin -- Element_Wrapper

loop

select

accept Init (EW_MRP : Monad_Record_Ptr := MRP) do

MRP_I := EW_MRP;

Initiated := true;

end Init;

or

when Initiated => accept Unit (A : Element) do

Cnt := 0;

MRP_I.E := A;

MRP_I.M := Write_Element(MRP_I.E);

Ada.Text_IO.Put_Line ("-- " & GNAT.Source_Info.file &

GNAT.Source_Info.Line'Image &

" Unit A = " & MRP_I.E'Image);

end Unit;

or

when Initiated => accept Bind (B_MRP : Monad_Record_Ptr := MRP) do

Cnt := Cnt + 1;

Ada.Text_IO.Put_Line ("-- " & GNAT.Source_Info.file &

GNAT.Source_Info.Line'Image &

" Bind E = " & B_MRP.E'Image);

MRP_I.F := Write;

MRP_I.R := Read;

Ada.Text_IO.Put_Line ("-- " & GNAT.Source_Info.file &

GNAT.Source_Info.Line'Image &

" M = " & Write(MRP_I.E)'Image);

-- raised PROGRAM_ERROR : EXCEPTION_ACCESS_VIOLATION

-- [2022-10-01 10:07:02] process exited with status 1, elapsed time: 00.81s

if Monad_Valid_Element(MRP_I.E'Image, MRP_I.F(MRP_I.E)'Image) then

MRP_I.M := MRP_I.F(MRP_I.E);

else Ada.Text_IO.Put_Line ("-- " & GNAT.Source_Info.file &

GNAT.Source_Info.Line'Image &

" Error: " & Error_Cond(MRP_I));

end if;

-- if not valid return error condition in object

Ada.Text_IO.Put_Line ("-- " & GNAT.Source_Info.file &

GNAT.Source_Info.Line'Image &

" Bind with M and E = " & B_MRP.M'Image);

end Bind;

or

terminate;

end select;

end loop;

end Element_Wrapper;

function Create_Monad_Record_Ptr return Monad_Record_Ptr is

begin

return new Monad_Record;

end Create_Monad_Record_Ptr;

function Create_Element_Wrapper_Ptr return Element_Wrapper_Ptr is

begin

return new Element_Wrapper(Create_Monad_Record_Ptr);

end Create_Element_Wrapper_Ptr;

function Copy_Monad_Record_Ptr return Monad_Record_Ptr is

begin

return MRP_I;

end Copy_Monad_Record_Ptr;

end Monad_Functors;

Main program is:

procedure Monads is

pragma Suppress_All;

use Ada.Text_IO;

use GNAT.Source_Info;

function WE (E : Integer) return Float is

begin

return Float(E);

end WE;

function RM(F : Float) return Integer is

-- error : exception;

begin

return Integer(F);

end;

function Valid_Element( A: String; B : String) return boolean is

R : Boolean;

begin

R := Float'Value(B) = Float'Value(A);

return R;

end Valid_Element;

package my_monad_functors is new monad_functors(Integer, Float, WE, RM, Valid_Element);

use my_monad_functors;

-- 220918 Objects to be manipulated by the monad_functor task type Element_Wrapper needs to be a protected type!!!!

protected type Obj is

-- Operations go here (only subprograms)

procedure Set(L : in Element_Wrapper_Ptr);

entry Get(L : in out Element_Wrapper_Ptr);

-- function Init_Get return Element_Wrapper_Ptr;

private

-- Data goes here

Local : Element_Wrapper_Ptr;

Is_Set : Boolean := False;

end Obj;

protected body Obj is

-- procedures can modify the data

procedure Set(L : in Element_Wrapper_Ptr) is

begin

Local := L;

Is_Set := True;

end Set;

-- functions cannot modify the data

entry Get(L : in out Element_Wrapper_Ptr) when Is_Set is

begin

L := Local;

end Get;

end Obj;

function Init_Element_Wrapper return Element_Wrapper_Ptr is

EW_Object : Obj;

L : Element_Wrapper_Ptr;

begin

EW_Object.Set(Create_Element_Wrapper_Ptr);

EW_Object.Get(L);

return L;

end Init_Element_Wrapper;

EW_Object : Obj;

EW : Element_Wrapper_Ptr := Init_Element_Wrapper; -- 220916 Use a Init entry in Element_Wrapper and a activated boolean function as entry barriers, to avoid program_errors

-- 220916: like: raised PROGRAM_ERROR : monad_functors.adb:6 access before elaboration

-- 220918 The task Type Element:Wrapper_Ptr object must be wrapped into a protected object, due to concurrent use of task type Element_Wrapper.

function Monad_Unit (A : in Integer; EWP : not null Element_Wrapper_Ptr := EW) return Element_Wrapper_Ptr is

begin

EWP.Unit(A);

return EWP;

end Monad_Unit;

function "*" (Left : Monad_Record; Right : Integer) return Monad_Record is

M : Monad_Record := Left;

begin

M.M := M.F(M.E) * M.F(Right);

return M;

end "*";

function Monad_Bind (EWP : not null Element_Wrapper_Ptr := EW) return Element_Wrapper_Ptr is

begin

EWP.Bind;

return EWP;

end Monad_Bind;

function Monad_Get_E(EWP : not null Element_Wrapper_Ptr := EW) return Integer is

begin

return Copy_Monad_Record_Ptr.E;

end Monad_Get_E;

function Monad_Get(EWP : not null Element_Wrapper_Ptr := EW) return Monad_Record_Ptr is

begin

return Copy_Monad_Record_Ptr;

end Monad_Get;

subtype Check_Integer is Integer range Integer'First..Integer'Last;

subtype Check_Float is Float range Float'First..Float'Last;

begin -- Procedure Monads

Put_Line("-- Running : " & GNAT.Source_Info.File &

" : at Line : " & GNAT.Source_Info.Line'Image &

" : Compiled at : " & GNAT.Source_Info.Compilation_Date);

Put_line("-- " & GNAT.Source_Info.Line'Image & " Monads beginning");

EW := Create_Element_Wrapper_Ptr;

EW.Init;

Put_Line("-- " & GNAT.Source_Info.File & GNAT.Source_Info.Line'Image & " Monad_Unit(1) = " & Monad_Unit(1)'Image);

EW.Bind;

Put_Line("-- " & GNAT.Source_Info.File & GNAT.Source_Info.Line'Image & " Monad_Get_E = " & Monad_Get_E'Image);

Put_Line("-- " & GNAT.Source_Info.File & GNAT.Source_Info.Line'Image & " Monad_Get.E = " & Monad_Get.E'Image);

Put_Line("-- " & GNAT.Source_Info.File & GNAT.Source_Info.Line'Image & " Monad_Get.M = " & Monad_Get.M'Image);

Put_Line("-- " & GNAT.Source_Info.File & GNAT.Source_Info.Line'Image & " Monad_Get.F = " & Monad_Get.F'Image);

Put_Line("-- " & GNAT.Source_Info.File & GNAT.Source_Info.Line'Image & " Monad_Get.R = " & Monad_Get.F'Image);

-- Put_Line("-- " & GNAT.Source_Info.File & GNAT.Source_Info.Line'Image & " Monad_Get.R(1.0) = " & Monad_Get.R(Float'Value("1.0"))'Image);

Copy_Monad_Record_Ptr.EMin := Integer(Check_Integer'First);

Copy_Monad_Record_Ptr.EMax := Integer(Check_Integer'Last);

Copy_Monad_Record_Ptr.MMin := Float(Check_Float'First);

Copy_Monad_Record_Ptr.MMax := Float(Check_Float'Last);

end Monads;

The program runs with the output:

C:\...\...\...\...\monads\obj\monads.exe

-- Running : monads.adb : at Line : 115 : Compiled at : Oct 01 2022

-- 117 Monads beginning

-- monad_functors.adb 39 Unit A = 1

-- monads.adb 121 Monad_Unit(1) = (access 1001470)

-- monad_functors.adb 46 Bind E = 1

raised PROGRAM_ERROR : EXCEPTION_ACCESS_VIOLATION

[2022-10-01 10:07:02] process exited with status 1, elapsed time: 00.81s

The specification for the package Monad_Functors is:

generic

type Element is private;

type Monad_Element is private;

with function Write_Element(E : Element) return Monad_Element;

with function Read_Monad(M : Monad_Element) return Element;

-- with package My_Variable_Strings is new Variable_Strings(Element);

with function Monad_Valid_Element( E1 : String;

E2 : String) return Boolean;

package Monad_Functors is

type Writer_Function is access function (E : in Element) return Monad_Element;

type Reader_Function is access function (M : Monad_Element) return Element;

type Monad_Record is record

E : Element;

EMin : Element;

EMax : Element;

M : Monad_Element;

MMin : Monad_Element;

MMax : Monad_Element;

F : Writer_Function;

R : Reader_Function;

end record;

type Monad_Record_Ptr is access Monad_Record;

task type Element_Wrapper (MRP : not null Monad_Record_Ptr) is

entry Init (EW_MRP : Monad_Record_Ptr := MRP); -- 220917 Need to control the start of the monad, due to the use of access to task type with Element_Wrapper_Ptr

entry Unit (A : Element);

entry Bind (B_MRP : Monad_Record_Ptr := MRP);

end Element_Wrapper;

type Element_Wrapper_Ptr is access Element_Wrapper;

function Create_Element_Wrapper_Ptr return Element_Wrapper_Ptr;

function Copy_Monad_Record_Ptr return Monad_Record_Ptr;

end Monad_Functors;


r/ada • • Oct 24 '11

AdaCLIPS : A semi-thick binding to the public-domain CLIPS expert system shell.

Thumbnail telepath.com
1 Upvotes

r/ada • • Nov 20 '24

Initialisation de variable GtkAda

0 Upvotes

J'utilise GtkAda pour écrire des IHM avec les widgets.

J'ai la variable suivante

Self : Gtk_Color_Chooser;

Le type Gtk_Color_Chooser est défini comme :

type Gtk_Color_Chooser is new type Glib.Type.GType_Interface;

Et je ne trouve rien de valable sur le type dont Gtk_Color_Chooser est dérivé.

Merci

Ps : GnatStudio est formidable, mais je n comprends vraiment pas du tout pourquoi on peut pas sélectionner, copier / coller avec le clic droit de la souris.. Aller sur "Edit" à chaque fois est quand même .


r/ada • • Oct 06 '18

huge parameter problem

1 Upvotes

so im writing a program and in my main procedure i call a procedure that establishes certain values with out paramenters. when that procedure is done i call another procedure immediately that uses the values of those out parameters and adds on to them. For some reason when the second procedure gets called all my parameters values change while getting sent to that second procedure. I have no clue why.


r/ada • • Dec 01 '22

Learning circumfernce of cicle

1 Upvotes

can someone help me with algorithm of find circumference of circle form diameter in ada language in gnat studio.

Implement the Arith package that provides the function Circ, calculating the circumference of the circle with the provided diameter argument.  Additionally extend the source code with ada pre- and postconditions to ensure the following contracts:

  • Circ accepts positive arguments only,

  • Circ accepts only diameter arguments so there is no overflow in the Results variable,

  • the result of Circ must always be positive,

  • the diameter argument times 3 is always less than the result of the Circ function.

will be very helpful if you provide any source. Thank you


r/ada • • Mar 29 '17

Job Opportunity: Convert Ada to C++ for Cruise Missiles

1 Upvotes

I'm not sure why an organization would want to convert Ada to C++ for weapon systems. This makes me sad.

Here's the requisition text:

We are currently supporting various programs within Missiles and Fire Control including Joint Air-to-Surface Standoff Missile (JASSM) and Joint Strike Missile (JSM). I've listed a few of our current openings below. These are long-term, contract positions offering competitive rates, benefits, 401k and possible relocation assistance/per diem.

  1. Embedded Software Engineer - participate in development and conversion of embedded application for JASSM cruise missile from Ada to C++.

  2. Embedded Software Architect – design and re-architect embedded application for JASSM cruise missile from Ada to C++.

[update]

OP: What is the desire to convert Ada to C++ for weapon systems?

Recruiter: ... Lockheed has made the decision to migrate to C++ because it is more cost effective and easier to maintain.


r/ada • • Sep 09 '26

Learning Should I learn Ada or Rust for beckend?

11 Upvotes

Sorry if this is already asked but does Ada have any RAILS-style backends? Even so, how does it compare to rust on performance and stability?

Should I use GCC GNAT or GNAT Pro?

Thanks.