blob: ce48c6f9c896bd3342aee4b32a20c166dd14c2f8 [file] [log] [blame]
Frabrice Bellarda9693052009-05-11 14:50:37 -07001
Jack Palevichc9b8ffc2009-08-03 14:42:57 -07002Supported C language subset:
Frabrice Bellarda9693052009-05-11 14:50:37 -07003
4 - Expressions:
5
6 * binary operators, by decreasing priority order: '*' '/' '%',
7 '+' '-', '>>' '<<', '<' '<=' '>' '>=', '==' '!=', '&',
8 '^', '|', '=', '&&', '||'.
9
10 * '&&' and '||' have the same semantics as C : left to right
11 evaluation and early exit.
12
13 * Parenthesis are supported.
14
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070015 * Comma operator is supported.
16
17 * Trinary operator (?:) is not supported.
18
Frabrice Bellarda9693052009-05-11 14:50:37 -070019 * Unary operators: '&', '*' (pointer indirection), '-'
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070020 (negation), '+', '!', '~', '++' and '--'.
Frabrice Bellarda9693052009-05-11 14:50:37 -070021
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070022 * Pointer indirection ('*') is supported.
Frabrice Bellarda9693052009-05-11 14:50:37 -070023
Jack Palevich22f5c6b2009-10-27 17:34:45 -070024 * Square brackets are supported.
Frabrice Bellarda9693052009-05-11 14:50:37 -070025
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070026 * '=' and <op>= are supported.
Frabrice Bellarda9693052009-05-11 14:50:37 -070027
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070028 * Function calls are supported with standard Linux calling
29 convention. Function pointers are supported.
30 Functions can be used before being declared.
Frabrice Bellarda9693052009-05-11 14:50:37 -070031
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070032 - sizeof() is not supported.
Frabrice Bellarda9693052009-05-11 14:50:37 -070033
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070034 - Types:
35 + int, short, char, float, double
36 + pointers
37 + variables can be initialized in declarations.
38 + Only ANSI-style function declarations are supported.
39 - "..." is not supported.
Jack Palevich22f5c6b2009-10-27 17:34:45 -070040 - short is supported
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070041 - const is not supported
Jack Palevich22f5c6b2009-10-27 17:34:45 -070042 - signed and unsigned are not supported.
43 - arrays are supported
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070044 - long doubles are not supported
Jack Palevich22f5c6b2009-10-27 17:34:45 -070045 - structs and unions are supported
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070046
47 - Unknown functions and variables are bound at compile time by calling
48 back to the caller. For the 'acc' command-line tool unknown functions
49 and variables are looked up using dlsym, to allow using many libc
50 functions and variables.
Frabrice Bellarda9693052009-05-11 14:50:37 -070051
52 - Instructions: blocks ('{' '}') are supported as in C. 'if' and
53 'else' can be used for tests. The 'while' and 'for' C constructs
54 are supported for loops. 'break' can be used to exit
55 loops. 'return' is used for the return value of a function.
56
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070057 - switch / case is not supported.
58 - goto and labels are not supported.
59 - continue is not supported.
60
Frabrice Bellarda9693052009-05-11 14:50:37 -070061 - Identifiers are parsed the same way as C. Local variables are
62 handled, but there is no local name space (not a problem if
63 different names are used for local and global variables).
64
65 - Numbers can be entered in decimal, hexadecimal ('0x' or '0X'
66 prefix), or octal ('0' prefix).
67
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070068 - Float and double constants are supported.
69
Jack Palevich22f5c6b2009-10-27 17:34:45 -070070 - '#define' is supported without function like arguments.
71 - Macro recursion is allowed.
72 - Self-referential macros are handled as in gcc.
73 - '#pragma' is supported. The pragma text is passed to a callback function,
74 and is used to implement meta-information.
75 - Other preprocessor directives are ignored.
Frabrice Bellarda9693052009-05-11 14:50:37 -070076
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070077 - C Strings and C character constants are supported. All ANSI C
78 character escapes are supported.
Frabrice Bellarda9693052009-05-11 14:50:37 -070079
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070080 - Both C comments ( /* */ ) and C++ comments ( // ... end-of-line ) are
81 supported.
Frabrice Bellarda9693052009-05-11 14:50:37 -070082
Jack Palevichc9b8ffc2009-08-03 14:42:57 -070083 - Some syntax errors are reported, others may cause a crash.
Frabrice Bellarda9693052009-05-11 14:50:37 -070084
85 - Memory: the code, data, and symbol sizes are limited to 100KB
86 (it can be changed in the source code).
87