mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-18 09:59:37 +01:00
b6b90ffa49
The compiler_vm module has been significantly refactored into distinct modules in order to better facilitate the addition of other languages and compilers. Currently there is support for C89, C99 and C11 using gcc, as well as support for Perl. This is an initial work-in-progress commit and there are still some minor rough edges to polish up.
40 lines
783 B
Perl
Executable File
40 lines
783 B
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
use strict;
|
|
|
|
package c89;
|
|
use parent 'c11';
|
|
|
|
sub initialize {
|
|
my ($self, %conf) = @_;
|
|
|
|
$self->{sourcefile} = 'prog.c';
|
|
$self->{execfile} = 'prog';
|
|
$self->{default_options} = '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c89 -lm -Wfatal-errors';
|
|
$self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile';
|
|
|
|
$self->{prelude} = <<'END';
|
|
#define _XOPEN_SOURCE 9001
|
|
#define __USE_XOPEN
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <math.h>
|
|
#include <limits.h>
|
|
#include <sys/types.h>
|
|
#include <stdint.h>
|
|
#include <errno.h>
|
|
#include <ctype.h>
|
|
#include <assert.h>
|
|
#include <locale.h>
|
|
#include <setjmp.h>
|
|
#include <signal.h>
|
|
#include <prelude.h>
|
|
|
|
END
|
|
}
|
|
|
|
1;
|