From abe957952ecf232481a5e9819b94dececa2a5f21 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Mon, 2 Nov 2020 23:20:34 -0700 Subject: add skeleton of type syntax --- language/types.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 language/types.rst (limited to 'language/types.rst') diff --git a/language/types.rst b/language/types.rst new file mode 100644 index 0000000..0a38239 --- /dev/null +++ b/language/types.rst @@ -0,0 +1,17 @@ +Types +----- + +.. crowbar:element:: Type <- ConstType / PointerType / ArrayType / FunctionType / BasicType + +.. crowbar:element:: ConstType <- 'const' BasicType + +.. crowbar:element:: PointerType <- BasicType '*' + +.. crowbar:element:: ArrayType <- BasicType '[' Expression ']' + +.. crowbar:element:: FunctionType <- BasicType 'function' '(' FunctionTypeArgs? ')' + FunctionTypeArgs <- BasicType (',' BasicType)* ','? + +.. crowbar:element:: BasicType <- 'void' / 'bool' / 'float32' / 'float64' / 'int8' / 'int16' / 'int32' / 'int64' / 'intaddr' / 'intmax' / 'intsize' / 'uint8' / 'uint16' / 'uint32' / 'uint64' / 'uintaddr' / 'uintmax' / 'uintsize' / 'struct' identifier / 'enum' identifier / 'union' identifier / '(' Type ')' + +.. todo:: define like any of these -- cgit v1.2.3