Skip to content

copton/c-base

Repository files navigation

This is an implementation of the C99 programming language as a base language for MPS.

You can use this language if you want to generate C code with the MPS language workbench.

Discrepancies

The ISO/IEC 9899:1999 standard is implemented in large parts. There are some discrepancies, though, which we introduced in order to keep the MPS model simple. In the following, if a feature is "not supported" this means that you can not generate C code which uses this feature. In general, all features which are not supported are not

Section 5.2.1.1 / Trigraphs

Trigraph sequences are not supported.

Section 6.4.2 / Identifiers

Universal character names in identifiers are not supported.

Section 6.4.4 / Zero

For simplicity, the zero constant is a concept on it's own. The standard defines, that 0 is an octal constant, though.

Section 6.4.4.1 / Hexadecimal Constants

The hexadecimal prefix 0X is not supported (but 0x is).

Section 6.4.4.2 / Floating Constants

The exponent prefix E is not supported (but e is).

Section 6.4.4.2 / Hexadecimal Floating Constants

The hexadecimal prefix 0X is not supported (but 0x is).

Section 6.4.5 / String Literals

Concatenation of string literal tokens is not supported.

Section 6.4.6 / Digraphs

Digraphs are not supported.

Section 6.4.9 / Comments

In C99 comments are no language tokens and thus not part of the language grammar. For a meta-model driven sytem like MPS this is a problem. In order to support at least some comments we did the following:

  • Block comments are not supported
  • Line comments can be placed on file scope between external declarations
  • Line comments can be placed within compount statements between other statements
  • All other line comments are not supported

Section 6.7.2.2 / Enumerator List

A trailing comma at the end of an enumerator list is not supported.

Section 6.7.8 / Initializer List

A trailing comma at the end of an initializer list is not supported.

Section 6.7.5 / Array Declaration

The static keyword after a qualifier list inside the square brackets of an array declaration is not supported (it's only supported before a qualifier list).

Section 6.7.5 / Function Declaration

Function declarators with empty parantheses (not prototype-format parameter type declarators) are not supported. (See 6.11.6)

Section 6.7.5 / Function Definition

Function definitions with separate parameter identifier and declaration lists (not prototype-format parameter type and identifier declarators) are not supported. (See 6.11.7)

Implementation Defined Properties

Most implementation defined properties play no role in this implementation, because there is no compile and no execution time. Instead, theses properties are finally inherited from the tool chain which is used to process the generated files. Some properties, though, are already restricted by this implementation.

5.2.1 / Source Character Set

The source character set of this implementation contains all valid characters of the Java programming language, given MPS supports the creation of the character. Note, that the usage of characters which are not in the basic character set of the C99 language only makes sense if this character is in the extended character set of the underlying C99 toolchain.

About

C99 base language for MPS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published