chharvey / counterpoint

A robust programming language.
GNU Affero General Public License v3.0
2 stars 0 forks source link

Syntax & Semantics: Variable Declaration Typings #41

Closed chharvey closed 3 years ago

chharvey commented 4 years ago

Add typings to variable declarations.

DeclarationVariable
    ::= "let" "unfixed"? IDENTIFIER ":" Type "=" Expression ";";

Example:

let my_var: int = 42;

Declares the my_var with type int (for Integer).

The following type units may be used:

Type expressions are syntax productions that combine types using operators.

(‹T› and ‹U› are metavariables for syntactically allowed type expressions.)