summaryrefslogtreecommitdiffstats
path: root/libacc/FEATURES
blob: 20f9d987b5ac0fbadca46ab977a4f81ac0ff25a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

Supported C language subset:

    - Expressions:

        * binary operators, by decreasing priority order: '*' '/' '%',
          '+' '-', '>>' '<<', '<' '<=' '>' '>=', '==' '!=', '&',
          '^', '|', '=', '&&', '||'.

        * '&&' and '||' have the same semantics as C : left to right
          evaluation and early exit.

        * Parenthesis are supported.

        * Comma operator is supported.

        * Trinary operator (?:) is not supported.

        * Unary operators: '&', '*' (pointer indirection), '-'
          (negation), '+', '!', '~', '++' and '--'.

        * Pointer indirection ('*') is supported.

        * Square brackets are supported.

        * '=' and <op>= are supported.

        * Function calls are supported with standard Linux calling
          convention. Function pointers are supported.
          Functions can be used before being declared.

        - sizeof() is not supported.

    - Types:
        + int, short, char, float, double
        + pointers
        + variables can be initialized in declarations.
        + Only ANSI-style function declarations are supported.
           - "..." is not supported.
        - short is supported
        - const is not supported
        - signed and unsigned are not supported.
        - arrays are supported
        - long doubles are not supported
        - structs and unions are supported
        - typedef is supported
        - explicit storage class specifiers are not supported: register, auto, static, extern

    - Unknown functions and variables are bound at compile time by calling
      back to the caller. For the 'acc' command-line tool unknown functions
      and variables are looked up using dlsym, to allow using many libc
      functions and variables.

    - Instructions: blocks ('{' '}') are supported as in C. 'if' and
      'else' can be used for tests. The 'while' and 'for' C constructs
      are supported for loops. 'break' can be used to exit
      loops. 'return' is used for the return value of a function.

      - switch / case is not supported.
      - goto and labels are not supported.
      - continue is not supported.

    - Identifiers are parsed the same way as C. Local variables are
      handled, but there is no local name space (not a problem if
      different names are used for local and global variables).

    - Numbers can be entered in decimal, hexadecimal ('0x' or '0X'
      prefix), or octal ('0' prefix).

    - Float and double constants are supported.

    - '#define' is supported without function like arguments.
    - Macro recursion is allowed.
    - Self-referential macros are handled as in gcc.
    - '#pragma' is supported. The pragma text is passed to a callback function,
       and is used to implement meta-information.
    - Other preprocessor directives are ignored.

    - C Strings and C character constants are supported. All ANSI C
      character escapes are supported.

    - Both C comments ( /* */ ) and C++ comments ( // ... end-of-line ) are
      supported.

    - Some syntax errors are reported, others may cause a crash.

    - Memory: the code, data, and symbol sizes are limited to 100KB
      (it can be changed in the source code).