Small-C icon indicating copy to clipboard operation
Small-C copied to clipboard

Small-C Struct Support

Open ZaneDubya opened this issue 6 years ago • 1 comments

Add support for structs to the Small-C compiler See here for syntax: https://en.wikipedia.org/wiki/Struct_(C_programming_language)

  • [x] Determine struct syntax: definition, declaration, assignment, copying, member access.
  • [x] Reserve 'struct' keyword
  • [x] Create data structure to hold defined struct types (by name, with reference to members, and total size)
  • [x] Create data structure to hold struct members (by name, with type; type can be a struct, allowing nested structs)
  • [x] Recognize 'struct' keyword
  • [x] Recognize struct layout
  • [x] Don't allow initialization in struct def
  • [x] Read in struct definitions to defStructs and defSMembers
  • [x] 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)
  • [x] Recognize definitions of local structs
  • [ ] Allow passing struct as parameter
  • [ ] Allow returning struct from a function
  • [x] Allow definitions of arrays of structs
  • [x] Allow pointers to structs

ZaneDubya avatar Dec 21 '17 14:12 ZaneDubya