From b0a18bcb2c6e64aaa96e9213c9c9a77cb904317a Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 30 Aug 2022 05:58:19 +0000 Subject: [PATCH] Update 'Object Type Definitions' --- Object-Type-Definitions.md | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Object-Type-Definitions.md diff --git a/Object-Type-Definitions.md b/Object-Type-Definitions.md new file mode 100644 index 0000000..d66d82a --- /dev/null +++ b/Object-Type-Definitions.md @@ -0,0 +1,41 @@ +# Syntax + +``` +objt ro Basic:Obj + ro that:Basic + ro this:Basic + +objt ro ComplexInit:Obj + ro whatever:{Int 3} + 230984 + 849 394580 + ro complex0:Bird + .that 98 + .this 2 + ro complex1:Bird + .that 98902 + .this 235 + ro basic:Int 87 +``` + +Object section syntax allows for members to be declared underneath it. It must have a type that it inherits from. It should not have anything after the type specifier. + +Currently, object section syntax does not support nested object definitions. + +Each member should start with a permission, then have a name, then a type specifier. After that, +they can have an optional initialization value. + +Arf supports bitfields, like in C, although it is done with an amperseand symbol. This is a member of type integer with a width of 1: + +``` +ro someMember:Int & 1 +``` + +# Semantics + +The "type" of an object type definition is what object it inherits. Most objects +will inherit from Obj, which is a blank object. + +Object definitions have a list of members, preceded by a permission. Members can +have simple or complex initializations, or none at all. These act as the default +values for those members. \ No newline at end of file