-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
Description
Add support for structs to the Small-C compiler
See here for syntax: https://en.wikipedia.org/wiki/Struct_(C_programming_language)
- Determine struct syntax: definition, declaration, assignment, copying, member access.
- Reserve 'struct' keyword
- Create data structure to hold defined struct types (by name, with reference to members, and total size)
- Create data structure to hold struct members (by name, with type; type can be a struct, allowing nested structs)
- Recognize 'struct' keyword
- Recognize struct layout
- Don't allow initialization in struct def
- Read in struct definitions to defStructs and defSMembers
- Recognize definitions of global structs
- struct definitions may optionally be followed by variable definitions.
- later definitions of structs must be preceded by 'struct' keyword.
- Error out on assignment of struct to number
- Recognize assignment of global struct (assign all, in brackets)
- Recognize references to structs
- Recognize references to struct members
- Recognize assignment of struct members
- Recognize partial struct assignment
- Recognize struct assignment from another struct (deep copy)
- Recognize definitions of local structs
- Allow passing struct as parameter
- Allow returning struct from a function
- Allow definitions of arrays of structs
- Allow pointers to structs
Reactions are currently unavailable