Purple  0.1
Standard Language Specification
Classes | Macros | Typedefs
type.h File Reference

Function headers and defines for. More...

#include "scan.h"
#include "types/function.h"
#include "types/number.h"
Include dependency graph for type.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Type
 Container for type data. More...
 

Macros

#define TYPE_VOID
 Generates a void type struct. More...
 
#define TYPE_NUMBER_FROM_NUMBERTYPE_FROM_TOKEN(ttype)
 Generates a number type struct given a TokenType. More...
 
#define TYPE_NUMBER_FROM_NUMBERTYPE_FROM_NUMBER(n)
 Generates a number type struct given a Number. More...
 
#define TYPE_NUMBER_FROM_NUMBERTYPE(nt)
 Generates a number type struct given a NumberType. More...
 
#define TYPE_FUNCTION(out, input_list, num_inputs)
 

Typedefs

typedef struct Type Type
 Container for type data. More...
 

Detailed Description

Function headers and defines for.

Author
Charles Averill
Date
28-Sep-2022

Macro Definition Documentation

◆ TYPE_FUNCTION

#define TYPE_FUNCTION (   out,
  input_list,
  num_inputs 
)
Value:
(Type) \
{ \
.type = T_FUNCTION_DECLARATION, .is_function = true, \
.value.function = FUNCTION_FROM_OUT_IN(out, input_list, num_inputs) \
}
#define FUNCTION_FROM_OUT_IN(output_type, input_list, num_inputs)
Generates a Function struct given an output type and a linked list of input types.
Definition: function.h:39
@ T_FUNCTION_DECLARATION
Definition: scan.h:76
struct Type Type
Container for type data.

◆ TYPE_NUMBER_FROM_NUMBERTYPE

#define TYPE_NUMBER_FROM_NUMBERTYPE (   nt)
Value:
(Type) \
{ \
.type = number_to_token_type((Number){.type = nt}), .is_function = false, \
.value.number = NUMBER_FROM_TYPE_VAL(nt, 0) \
}
int number_to_token_type(Number number)
Definition: number.c:43
#define NUMBER_FROM_TYPE_VAL(t, v)
Generates a Number struct given a NumberType and a value.
Definition: number.h:107
Container for various kinds of number data.
Definition: number.h:51

Generates a number type struct given a NumberType.

◆ TYPE_NUMBER_FROM_NUMBERTYPE_FROM_NUMBER

#define TYPE_NUMBER_FROM_NUMBERTYPE_FROM_NUMBER (   n)
Value:
(Type) \
{ \
.type = number_to_token_type(n), .value.number = n, .is_function = false \
}

Generates a number type struct given a Number.

◆ TYPE_NUMBER_FROM_NUMBERTYPE_FROM_TOKEN

#define TYPE_NUMBER_FROM_NUMBERTYPE_FROM_TOKEN (   ttype)
Value:
(Type) \
{ \
.type = ttype, .value.number = NUMBER_FROM_TYPE_VAL(token_type_to_number_type(ttype), 0), \
.is_function = false \
}
NumberType token_type_to_number_type(int token_type)
Convert a TokenType to a NumberType.
Definition: number.c:17

Generates a number type struct given a TokenType.

◆ TYPE_VOID

#define TYPE_VOID
Value:
(Type) \
{ \
.type = T_VOID, .is_function = false \
}
@ T_VOID
Definition: scan.h:51

Generates a void type struct.

Typedef Documentation

◆ Type

typedef struct Type Type

Container for type data.