Verified Commit 8a7b07d8 authored by Camil Staps's avatar Camil Staps 🚀

Add titles to ABC documentation

parent 8cfecd0b
definition module Builtin.ABC definition module Builtin.ABC
from Data.Either import :: Either
from Cloogle.DB import :: ABCInstructionEntry from Cloogle.DB import :: ABCInstructionEntry
builtin_abc_instructions :: [ABCInstructionEntry] builtin_abc_instructions :: [Either String ABCInstructionEntry]
...@@ -4,21 +4,22 @@ import _SystemArray ...@@ -4,21 +4,22 @@ import _SystemArray
import StdList import StdList
import StdMisc import StdMisc
import Data.Either
import Text import Text
import Cloogle.API import Cloogle.API
import Cloogle.DB import Cloogle.DB
builtin_abc_instructions :: [ABCInstructionEntry] builtin_abc_instructions :: [Either String ABCInstructionEntry]
builtin_abc_instructions = builtin_abc_instructions =
[ i_create withTitle "Arithmetic" arith_instructions ++
: arith_instructions ++ withTitle "Stack manipulation" stack_operations ++
stack_operations ++ withTitle "Branching" branches ++
branches ++ withTitle "Miscellaneous" miscellaneous ++
miscellaneous ++ withTitle "Directives" directives ++
directives ++ withTitle "Undocumented instructions" [{zero & aie_instruction=i} \\ i <- other_instructions]
[{zero & aie_instruction=i} \\ i <- other_instructions] where
] withTitle title instrs = [Left title:map Right instrs]
instance zero ABCInstructionEntry instance zero ABCInstructionEntry
where where
...@@ -45,13 +46,6 @@ INT_ :== ABCArgument ABCTypeInt True ...@@ -45,13 +46,6 @@ INT_ :== ABCArgument ABCTypeInt True
REAL :== ABCArgument ABCTypeReal False REAL :== ABCArgument ABCTypeReal False
REAL_ :== ABCArgument ABCTypeReal True REAL_ :== ABCArgument ABCTypeReal True
i_create :: ABCInstructionEntry
i_create =
{ zero
& aie_instruction = "create"
, aie_description = "Creates a new empty node and pushes its address to the A-stack."
}
arith_instructions :: [ABCInstructionEntry] arith_instructions :: [ABCInstructionEntry]
arith_instructions = arith_instructions =
[ arith1 "absR" "Real" "absolute value" [ arith1 "absR" "Real" "absolute value"
...@@ -190,6 +184,7 @@ stack_operations = ...@@ -190,6 +184,7 @@ stack_operations =
, i_build_r , i_build_r
, i_build_u , i_build_u
, i_buildAC , i_buildAC
, i_create
, i_create_array , i_create_array
, i_create_array_ , i_create_array_
, fill "Bool" BOOL , fill "Bool" BOOL
...@@ -278,6 +273,12 @@ where ...@@ -278,6 +273,12 @@ where
, aie_description = "Pushes the argument string to the A-stack." , aie_description = "Pushes the argument string to the A-stack."
} }
i_create =
{ zero
& aie_instruction = "create"
, aie_description = "Creates a new empty node and pushes its address to the A-stack."
}
i_create_array = i_create_array =
{ zero { zero
& aie_instruction = "create_array" & aie_instruction = "create_array"
...@@ -508,7 +509,7 @@ where ...@@ -508,7 +509,7 @@ where
, aie_arguments = [INT] , aie_arguments = [INT]
, aie_description = join "\n\n" , aie_description = join "\n\n"
[ "Take the top of the B-stack as a pointer and read a 16-bit signed integer from that pointer with the argument as offset." [ "Take the top of the B-stack as a pointer and read a 16-bit signed integer from that pointer with the argument as offset."
, "See also {{`load_i}}, {{`load_si32`}}, {{`load_ui8`}}." , "See also {{`load_i`}}, {{`load_si32`}}, {{`load_ui8`}}."
] ]
} }
i_load_si32 = i_load_si32 =
......
...@@ -135,7 +135,7 @@ where ...@@ -135,7 +135,7 @@ where
map FunctionEntry (concatMap constructor_functions builtin_types) ++ map FunctionEntry (concatMap constructor_functions builtin_types) ++
map FunctionEntry (concatMap record_functions builtin_types) ++ map FunctionEntry (concatMap record_functions builtin_types) ++
map SyntaxEntry builtin_syntax ++ map SyntaxEntry builtin_syntax ++
map ABCInstructionEntry builtin_abc_instructions map ABCInstructionEntry [i \\ Right i <- builtin_abc_instructions]
printStats :: !*CloogleDB !*File -> *(*CloogleDB, *File) printStats :: !*CloogleDB !*File -> *(*CloogleDB, *File)
printStats db f printStats db f
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment