compiler

Compiler for the Compilers classes.
Log | Files | Refs

compiler.h (531B)


      1 #ifndef COMPILER_COMPILER_H_
      2 #define COMPILER_COMPILER_H_
      3 
      4 #include "arena.h"
      5 #include "string.h"
      6 
      7 #include <stdio.h>
      8 
      9 typedef struct {
     10     unsigned long line;
     11     unsigned long column;
     12 } Location;
     13 
     14 typedef struct {
     15     Location location;
     16     String   message;
     17     String   dynamic;
     18 } Error;
     19 
     20 constexpr Error ZERO_ERROR = {
     21     {0, 0},
     22     STR(""),
     23     STR("")
     24 };
     25 
     26 bool ErrorOk(Error error);
     27 void PrintError(Error error, const char* file);
     28 
     29 Error Compile(Arena* arena, char* program, FILE* output);
     30 
     31 #endif // COMPILER_COMPILER_H_