From 0ac605d5a09ba80615b2e0c151f31741168e6d2d Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 27 Nov 2011 21:29:39 +0000 Subject: Add feature support and K&R C conformance information --- README | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/README b/README index 17e5c18..f695e1a 100644 --- a/README +++ b/README @@ -22,3 +22,87 @@ Options: added. --tree Instead of compiling the file into assembly, show the parse tree. + +Conformance with the K&R interpretation of C and feature support +================================================================ +A2.2 Comments - unsupported by the parser, but the preprocessor removes them +A2.5 Constants - integers (hexadecimal 0x1a, 0X1A, octal 07, decimal 1), signed + only Treating integers as unsigned is undefined. Unsupported: + floats, char, string literals. +A4 Identifiers - functions, variables (int) are supported. struct, union are + not yet supported +A4.1 Storage class - static is supported (actually, everything is static). + Automatic variables are unsupported. +A4.2-A4.3 Types - supported: int; unsupported: char, enum, float, double, + struct, union, arrays, pointers +A4.4 Type qualifiers - volatile won't be supported, const is unsupported +A5 Objects and lvalues - not explicitly used, but assignment works +A6 Conversions of operands - not supported since everything is treated as + signed int + +Expressions support +------------------- +precedence and associativity - supported by underlying library for parsing +A7.1 Pointer generation - not tested/supported +A7.2 Primary Expressions - identifiers, constants (int) are stored in a + register. String is unsupported +A7.3 Postfix Expressions - unsupported +function calls - supported, result is stored in register R0 (for int functions) + Other types (void) are not checked when using their value. If an + undefined function is used, it'll still try to branch to the label + Parameters are not supported. +A7.4 Unary Operators - supported: ++ -- + - ~ ! Unsupported: sizeof & * +A7.5 Casts - unsupported +A7.6-A7.7, A7.9-7.13 - supported: * / % + - < > <= >= == != & ^ | Left to right +A7.8 Shift - << >> is supported, if negative, no shift will be performed +A7.14-A7.15 Logical AND && and OR || are supported. Result is indeed 0 or 1 +A7.16 Conditional operator ? : - supported +A7.17 Assignment - supported: = Unsupported: *= /= %= += -= <<= >>= &= ^= |= + Supported for variable names only, pointers are not yet supported +A7.18 Comma - supported +A7.19 Constant expressions - not checked + +A8 Declarations +A8.1 Storage class specifiers - unsupported +A8.2 Type specifiers - unsupported, everything is assumed to be int. void in + the meaning of "no value" is not checked. Const is not meaningfully + supported yet +A8.3 Structure and union declarations - unsupported +A8.4 Enumerations - unsupported +A8.5 Declarators - pointers and qualifiers are ignored, only a direct name is + supported +A8.6 Meaning of declarators - pointer and array is unsupported, function is + supported without parameters and assumed to be an int function +A8.7 Initialization - Supported for an expression resulting in an int +A8.8 Type names - not verified +A8.9 Typedef - won't be supported as we have int only +A8.10 Type equivalence - not supported as everything is an int + +A9 Statements +A9.1 Labeled statements - not supported +A9.2 Expression statement - supported by parser +A9.3 Compound statement - supported +A9.4 Selection statements - if and if/else are supported, switch is not +A9.5 Iteration statements - while, do/while and for are supported. A missing + second expression in the for is equivalent to a non-zero constant +A9.6 Jump statements - goto is unsupported. continue, break are not supported + yet. return is supported with and without value. The function + result is undefined for the second case + +A10 External Declarations +A10.1 Function Definitions - unsupported: extern static, parameters. Old style + parameter list is unsupported +A10.2 External declarations - unsupported/unchecked + +A11 Scope and Linkage +A11.1 Lexical scope - objects (variables), functions use the same namespace, + thereby not conforming to the Standard. Block scope is not + supported, everything is global +A11.2 Linkage - not applicable / unsupported + +A12 Preprocessing +Not supported by parser, use a dedicated preprocessor like cpp and enable +removal of comments. Example: cpp -P file.c + +A13 Grammar +Not checked \ No newline at end of file -- cgit v1.2.1