diff options
author | Melody Horn <melody@boringcactus.com> | 2020-11-02 23:20:34 -0700 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2020-11-02 23:20:34 -0700 |
commit | abe957952ecf232481a5e9819b94dececa2a5f21 (patch) | |
tree | a57685e3fc6f2d3489f0ebb2c24f80596bebe203 /language | |
parent | c7f8dc29ea3b4307d35d1f38596ba970af9318fd (diff) | |
download | spec-abe957952ecf232481a5e9819b94dececa2a5f21.tar.gz spec-abe957952ecf232481a5e9819b94dececa2a5f21.zip |
add skeleton of type syntax
Diffstat (limited to 'language')
-rw-r--r-- | language/index.rst | 1 | ||||
-rw-r--r-- | language/types.rst | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/language/index.rst b/language/index.rst index e1e2b01..3f776f9 100644 --- a/language/index.rst +++ b/language/index.rst @@ -20,3 +20,4 @@ Syntax elements in this document are given in the form of `parsing expression gr type-definition functions statements/index + types 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 |