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

Add titles to ABC documentation

parent 8cfecd0b
definition module Builtin.ABC
from Data.Either import :: Either
from Cloogle.DB import :: ABCInstructionEntry
builtin_abc_instructions :: [ABCInstructionEntry]
builtin_abc_instructions :: [Either String ABCInstructionEntry]
......@@ -4,21 +4,22 @@ import _SystemArray
import StdList
import StdMisc
import Data.Either
import Text
import Cloogle.API
import Cloogle.DB
builtin_abc_instructions :: [ABCInstructionEntry]
builtin_abc_instructions :: [Either String ABCInstructionEntry]
builtin_abc_instructions =
[ i_create
: arith_instructions ++
stack_operations ++
branches ++
miscellaneous ++
directives ++
[{zero & aie_instruction=i} \\ i <- other_instructions]
]
withTitle "Arithmetic" arith_instructions ++
withTitle "Stack manipulation" stack_operations ++
withTitle "Branching" branches ++
withTitle "Miscellaneous" miscellaneous ++
withTitle "Directives" directives ++
withTitle "Undocumented instructions" [{zero & aie_instruction=i} \\ i <- other_instructions]
where
withTitle title instrs = [Left title:map Right instrs]
instance zero ABCInstructionEntry
where
......@@ -45,13 +46,6 @@ INT_ :== ABCArgument ABCTypeInt True
REAL :== ABCArgument ABCTypeReal False
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 =
[ arith1 "absR" "Real" "absolute value"
......@@ -190,6 +184,7 @@ stack_operations =
, i_build_r
, i_build_u
, i_buildAC
, i_create
, i_create_array
, i_create_array_
, fill "Bool" BOOL
......@@ -278,6 +273,12 @@ where
, 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 =
{ zero
& aie_instruction = "create_array"
......@@ -508,7 +509,7 @@ where
, aie_arguments = [INT]
, 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."
, "See also {{`load_i}}, {{`load_si32`}}, {{`load_ui8`}}."
, "See also {{`load_i`}}, {{`load_si32`}}, {{`load_ui8`}}."
]
}
i_load_si32 =
......
......@@ -135,7 +135,7 @@ where
map FunctionEntry (concatMap constructor_functions builtin_types) ++
map FunctionEntry (concatMap record_functions builtin_types) ++
map SyntaxEntry builtin_syntax ++
map ABCInstructionEntry builtin_abc_instructions
map ABCInstructionEntry [i \\ Right i <- builtin_abc_instructions]
printStats :: !*CloogleDB !*File -> *(*CloogleDB, *File)
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