undar-lang/emit/c/emit.c

304 lines
2.5 KiB
C

#include "../../emit.h"
#include <stdio.h>
void
c_prolog()
{
}
void
c_epilogue()
{
}
void
c_emit_add()
{
printf("+ ");
}
void
c_emit_sub()
{
printf("- ");
}
void
c_emit_mul()
{
printf("* ");
}
void
c_emit_div()
{
printf("/ ");
}
void
c_emit_lt()
{
printf("< ");
}
void
c_emit_le()
{
printf("<= ");
}
void
c_emit_gt()
{
printf("> ");
}
void
c_emit_ge()
{
printf(">= ");
}
void
c_emit_ne()
{
printf("!= ");
}
void
c_emit_eq()
{
printf("== ");
}
void
c_emit_false()
{
printf("false ");
}
void
c_emit_true()
{
printf("true ");
}
void
c_emit_nil()
{
printf("NULL ");
}
void
c_emit_neg()
{
printf("-");
}
void
c_emit_not()
{
printf("!");
}
void
c_emit_void()
{
}
void
c_emit_bool_type()
{
}
void
c_emit_byte_type()
{
}
void
c_emit_int_type()
{
}
void
c_emit_nat_type()
{
}
void
c_emit_real_type()
{
}
void
c_emit_str_type()
{
}
void
c_emit_u8_type()
{
}
void
c_emit_i8_type()
{
}
void
c_emit_i16_type()
{
}
void
c_emit_u16_type()
{
}
void
c_emit_i32_type()
{
}
void
c_emit_u32_type()
{
}
void
c_emit_f32_type()
{
}
void
c_emit_int(const char *str, i32 length)
{
printf("%.*s ", length, str);
}
void
c_emit_nat(const char *str, i32 length)
{
printf("%.*s ", length, str);
}
void
c_emit_real(const char *str, i32 length)
{
printf("%.*s ", length, str);
}
void
c_emit_byte(const char *str, i32 length)
{
printf("%.*s ", length, str);
}
void
c_emit_str(const char *str, i32 length)
{
printf("%.*s ", length, str);
}
void
c_emit_array()
{
}
void
c_emit_function()
{
}
void
c_emit_plex()
{
}
void
c_emit_method()
{
}
void
c_emit_trait()
{
}
void
c_emit_const()
{
}
void
c_emit_print()
{
printf("printf(\"%%s\", ");
}
void
c_emit_open_paren()
{
printf("(");
}
void
c_emit_close_paren()
{
printf(")");
}
Emitter
c_emitter()
{
return (Emitter){
INFIX,
TEXT,
c_prolog,
c_epilogue,
c_emit_add,
c_emit_sub,
c_emit_mul,
c_emit_div,
c_emit_lt,
c_emit_le,
c_emit_gt,
c_emit_ge,
c_emit_ne,
c_emit_eq,
c_emit_false,
c_emit_true,
c_emit_nil,
c_emit_void,
c_emit_int,
c_emit_nat,
c_emit_real,
c_emit_byte,
c_emit_str,
c_emit_bool_type,
c_emit_byte_type,
c_emit_int_type,
c_emit_nat_type,
c_emit_real_type,
c_emit_str_type,
c_emit_u8_type,
c_emit_i8_type,
c_emit_i16_type,
c_emit_u16_type,
c_emit_i32_type,
c_emit_u32_type,
c_emit_f32_type,
c_emit_array,
c_emit_function,
c_emit_plex,
c_emit_method,
c_emit_trait,
c_emit_const,
c_emit_print,
c_emit_neg,
c_emit_not,
c_emit_open_paren,
c_emit_close_paren,
};
}