mewmew / uc

A compiler for the µC language.
57 stars 5 forks source link

semantics: Type declarations #54

Closed mewmew closed 8 years ago

mewmew commented 8 years ago

Add support for type declarations, which could clean up corner cases in the type-checker, and eventually allow for user-defined types.

Type ast.TypeDecl node, will be implemented now, and the static semantic analysis type-checker will be extended to include keyword type declarations in the universe scope.

The parser will be extended in the future to allow for user-defined type declarations.

mewmew commented 8 years ago
mewmew commented 8 years ago

The type-checker now makes use of TypeDecl nodes to add type keywords to the universe scope. We should still make sure that the type keywords (e.g. int, char, void) are not re-defined in nested scopes using type declarations. A TODO for this is already in the code base. We may close this issue when the TODO has been resolved.

mewmew commented 8 years ago

We should definitely make sure that type keywords (e.g. int) may not be redeclared. However, as uC does not include typedef in its subset of C, we may safely assume that uC programs do not redefine the keyword types.

Marked as a future ambition. Closing for now.