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) \
{ \
.token_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:38
@ T_FUNCTION_DECLARATION
Definition: scan.h:78
struct Type Type
Container for type data.

◆ TYPE_NUMBER_FROM_NUMBERTYPE

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

Generates a number type struct given a NumberType.

◆ TYPE_NUMBER_FROM_NUMBERTYPE_FROM_NUMBER

#define TYPE_NUMBER_FROM_NUMBERTYPE_FROM_NUMBER (   n)
Value:
(Type) \
{ \
.token_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) \
{ \
.token_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:20

Generates a number type struct given a TokenType.

◆ TYPE_VOID

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

Generates a void type struct.

Typedef Documentation

◆ Type

typedef struct Type Type

Container for type data.