
the start of the private section there are implementation details which must be made available to the compiler to support separate compilation - like calling conventions - or items which might be changed and should not be depended on, like whether you’re using arrays or a linked-list internally. the type is fully defined in the private section, so that the clients using that type are prevented from depending on the internal implementation. The keyword private appears twice, each instance respectively indicates:. Tagged is the keyword that indicates that the type being declared is for an object (C++/Java “class”) - in Ada class indicates “that tagged-type or any type inheriting from it”, and is indicated as an attribute of tagged types. Element is introduced with () which indicates that it is indefinite, and probably discriminated. The enumeration Data_Type is defined in the public section of the specification, where Element is introduced but not defined. To break the circularity the Limited With is used to allow the reference to lists in a non-circular manner by exposing a more limited view - this recycling of keywords into a sort of phrase is the result of the ARG. This unit depends on the LIST type defined in LISP-lists.ads… which depends on LISP-elements.ads. (* In Ada the only casing that matters is the language’s name, it’s a proper name, and the internals of strings.) This defines a type “List”*, which is the extension of a language-defined vector-object to the parameter Element_Type we assign the element defined in LISP-Elements.ads we then derive a type from its own Vector type, and extend its methods. It also declares two exceptions we will not be using right now, but at a later date. This is a pure package, this is Ada-terminology for declaring that there is no state-variable in the unit. So let’s get down to explaining what’s going on in these three files, first a short explanation of the files themselves, then a bit more detail as to what they are doing. These specification files are valid but not complete, partially because this is a tutorial and I don’t want to bog you down with too much at once. When List_Type => List_Val : Not Null Accessįunction Create Return Element is ( Data => Empty_Type ) įunction Get_Type ( Item : Element ) return Data_Type is ( Item. Type Element ( Data : Data_Type ) is tagged record LIST įunction As_List ( Item : Element ) return Lists. List ) Return Element įunction To_String ( Item : Element ) return String įunction Get_Type ( Item : Element ) return Data_Type įunction To_List ( Item : Element ) return Lists. Print some text to indicate an orderly shutdown was achieved.įunction Create ( Item : Integer ) Return Element įunction Create ( Item : String ) Return Element įunction Create ( Item : Lists. Set up the exit-condition the name is optional but useful when dealing Call read, eval, and print: this is the lungs, heart and blood of our interpreter. All discrete types, including enumerations, have this.Īda. Here we use an attribute, “image”, to obtain the string-value of the EXAMPLE: Below we name the Read-Eval-Print Loop as “REPL”. tied to the loop that it is associated with. help because instead of numbering the constructs to ‘break’, the exit is adding or deleting them, as is common when altering algorithms.
We can name loops, and declaration blocks, this allows for stability when Hack to terminate the loop we will replace this later, with an
This explicit naming of the null-statement means that the compiler The reserved-word ‘null’ can be used to indicate a null-statement.
This names the current procedure “testbed”.