Ada: add deref (stage 1 complete)
authorChris M Moore <zmower@ntlworld.com>
Thu, 19 Mar 2015 22:19:13 +0000 (22:19 +0000)
committerChris M Moore <zmower@ntlworld.com>
Thu, 19 Mar 2015 22:19:13 +0000 (22:19 +0000)
ada/reader.adb
ada/types.adb
ada/types.ads

index d5dfed8..a0adf62 100644 (file)
@@ -309,6 +309,12 @@ package body Reader is
                Meta => null,
                The_Function => Unquote,
                The_Operand => Read_Form);
+         elsif MT.Symbol = ACL.Commercial_At then
+            return new Mal_Type'
+              (Sym_Type => Unitary,
+               Meta => null,
+               The_Function => Deref,
+               The_Operand => Read_Form);
          else
             return MT;
          end if;
index c030e91..98afdaf 100644 (file)
@@ -107,6 +107,9 @@ package body Types is
                when Splice_Unquote =>
                   return
                     "(splice-unquote " & To_String (T.The_Operand.all) & ")";
+               when Deref =>
+                  return
+                    "(deref " & To_String (T.The_Operand.all) & ")";
             end case;
          when Error =>
             return To_String (T.Error_Msg);
index 7907d39..82a939b 100644 (file)
@@ -16,7 +16,8 @@ package Types is
 
    type Sym_Types is (Int, Floating, List, Sym, Str, Atom, Unitary, Error);
 
-   type Unitary_Functions is (Quote, Unquote, Quasiquote, Splice_Unquote);
+   type Unitary_Functions is
+     (Quote, Unquote, Quasiquote, Splice_Unquote, Deref);
 
    type List_Types is (List_List, Vector_List, Hashed_List);
    function Opening (LT : List_Types) return Character;