Execute SNUSP/Ada: Difference between revisions

m
Fixed syntax highlighting.
m (Further edita)
m (Fixed syntax highlighting.)
 
Line 8:
 
memory.ads:
<langsyntaxhighlight Adalang="ada">with Ada.Finalization;
generic
type Byte is mod <>;
Line 41:
procedure Finalize (Storage : in out Memory);
 
end Memory;</langsyntaxhighlight>
 
memory.adb:
<langsyntaxhighlight Adalang="ada">with Ada.Containers.Ordered_Maps;
with Ada.Unchecked_Deallocation;
package body Memory is
Line 115:
end Finalize;
 
end Memory;</langsyntaxhighlight>
 
Next is a Machine for interpreting SNUSP code.
 
snusp.ads:
<langsyntaxhighlight Adalang="ada">with Ada.Containers.Vectors;
with Ada.Strings.Fixed;
with Ada.Text_IO;
Line 153:
end record;
 
end SNUSP;</langsyntaxhighlight>
 
snusp.adb:
<langsyntaxhighlight Adalang="ada">package body SNUSP is
 
procedure Move_IP (IP : in out Code_Pointer) is
Line 287:
end Run;
 
end SNUSP;</langsyntaxhighlight>
 
Sample usage:
 
main.adb:
<langsyntaxhighlight Adalang="ada">with Ada.Text_IO;
with SNUSP;
procedure Main is
Line 310:
SNUSP.Run (My_SNUSP_Machine, Test_Code);
 
end Main;</langsyntaxhighlight>
 
Output:
9,485

edits