On this page:
typedef
struct
union
enum
array
pointer

4 Parenthetical C

 (require c/pc) package: c-utils

For now, this library only provides a few convenience forms for constructing AST nodes. Eventually I intend to create a “Parenthetical C” language with an S-Expression-based alternative syntax for the whole of C.

syntax

(typedef type alias-id)

 
type = struct
  | type-id

syntax

(struct tag-id)

(struct tag-id (struct-field ...))
(struct (struct-field ...))
 
struct-field = [type field-id]
  | field-id

syntax

(union tag-id)

(union tag-id (union-variant ...))
(union (union-variant ...))
 
union-variant = [type variant-id]
  | variant-id

syntax

(enum tag-id)

(enum tag-id (enum-variant ...))
(enum (enum-variant ...))
 
enum-variant = [variant-id expr]
  | variant-id

procedure

(array type size)  type:array?

  type : type?
  size : expr?

procedure

(pointer type)  type:pointer?

  type : type?