diff --git a/docs/syntax.md b/docs/syntax.md index f236be6..b1a1a99 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -362,3 +362,23 @@ Looks in the path $GROUND_LIBS/`$libraryName`.grnd for the library. ($GROUND_LIB Attempts to import a shared library written in a compiled language like C or C++ for usage within the current program. Looks in the path $GROUND_LIBS/`$libraryName`.so for the library. ($GROUND_LIBS is a system environment variable.) + +### Data Structures + +#### struct -structName + +Creates a new struct which can be initialised. Until the endstruct keyword, the only valid instructions are init, set, fun, endfun, struct, and endstruct. + +Any value created inside the struct will be added to the struct. + +#### endstruct + +Ends the creation of a struct. + +#### getfield $object &fieldName &outputVar + +Gets a field from an initialised object. fieldName must be a valid name of a field in the object. Errors if the field does not exist. + +#### setfield &object &fieldName $value + +Sets a field to a new value in the object. The value must be of the same type as the field's old value.