# I'd really like to see an Ada solution to this Rosetta Code task: 'Brzozowski algebraic method'

**URL:** <https://forum.ada-lang.io/t/id-really-like-to-see-an-ada-solution-to-this-rosetta-code-task-brzozowski-algebraic-method/4894>\
**Category:** General\
**Created:** [October 25, 2026, 4:25pm UTC](https://forum.ada-lang.io/t/id-really-like-to-see-an-ada-solution-to-this-rosetta-code-task-brzozowski-algebraic-method/4894 "2026-10-25T16:25:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ret\_Build\_Engineer](https://forum.ada-lang.io/letter_avatar_proxy/v4/letter/r/ccd318/32.png) [@Ret\_Build\_Engineer](https://forum.ada-lang.io/u/Ret_Build_Engineer)\
**Post date:** [October 25, 2026, 4:25pm UTC](https://forum.ada-lang.io/t/id-really-like-to-see-an-ada-solution-to-this-rosetta-code-task-brzozowski-algebraic-method/4894/1 "2026-10-25T16:25:29Z")

</div>

Hi;

There are a number of solutions to this Rosetta Code task, but I’d really like to see an Ada solution. [Brzozowski algebraic method - Rosetta Code](https://rosettacode.org/wiki/Brzozowski_algebraic_method)

I wonder how many of you would use your own resources or if you would supplement it with an AI assisted solution…

It’s totally beyond me…the only thing I would/could do is to simply translate an existing solution to Ada and that would **NOT** illustrate any of the strength and capabilities of Ada…

Thanks,  
RBE

---

<div class="post-metadata">

**Author:** ![dmitry-kazakov](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/dmitry-kazakov/32/522_2.png) [@dmitry-kazakov](https://forum.ada-lang.io/u/dmitry-kazakov)\
**Post date:** [October 25, 2026, 5:47pm UTC](https://forum.ada-lang.io/t/id-really-like-to-see-an-ada-solution-to-this-rosetta-code-task-brzozowski-algebraic-method/4894/2 "2026-10-25T17:47:16Z")

</div>

> [@Ret\_Build\_Engineer](#):
>
> Ada and that would **NOT** illustrate any of the strength and capabilities of Ada

Well, FSA is not a thing for which you could show Ada’s strength. It is ultra low level stuff, where even Assembly would perfectly do. Nor would you seriously consider regular expressions for text processing.

Why do not you implement it yourself? Take some graph representation (for FSA) and apply the algorithm. GNAT comes with an implementation of RE. Use it as the target.

---

<div class="post-metadata">

**Author:** ![OneWingedShark](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/onewingedshark/32/305_2.png) [@OneWingedShark](https://forum.ada-lang.io/u/OneWingedShark)\
**Post date:** [October 25, 2026, 6:22pm UTC](https://forum.ada-lang.io/t/id-really-like-to-see-an-ada-solution-to-this-rosetta-code-task-brzozowski-algebraic-method/4894/3 "2026-10-25T18:22:01Z")

</div>

> [@dmitry-kazakov](#):
>
> Well, FSA is not a thing for which you could show Ada’s strength.

FSA? As in state-machines? Ada does great with them.

```ada
Generic
   Type State is (<>);
   Type Event is (<>);
   Start : State:= State'First;
   Error : State:= State'Last;
Package State_Machine is

Type State_Table is Array(State, Event) of State;

Type FSM( Table : not null access State_Table ) is record
   Current: State:= Start;
end record;

Procedure Trigger( Object : in out FSM; X : Event );
Procedure Reset ( Object : in out FSM );

-- Returns the current-state and then applies the event.
Function Trigger( Object : in out FSM; X : Event ) return State;

-- And whatever other subprograms are useful in-general.

End State_Machine;
-- …and implementation

```

---

<div class="post-metadata">

**Author:** ![dmitry-kazakov](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/dmitry-kazakov/32/522_2.png) [@dmitry-kazakov](https://forum.ada-lang.io/u/dmitry-kazakov)\
**Post date:** [October 25, 2026, 7:28pm UTC](https://forum.ada-lang.io/t/id-really-like-to-see-an-ada-solution-to-this-rosetta-code-task-brzozowski-algebraic-method/4894/4 "2026-10-25T19:28:59Z")

</div>

A simple case statement + gotos is the best here, which is the point. The only thing Ada adds is checking the choices. On the other there is no fall-through or loop continue which are frequently used.
