Add sources

This commit is contained in:
2018-06-05 22:30:22 +02:00
parent e28912dc5e
commit 9b56ec979d
143 changed files with 8636 additions and 0 deletions

40
test/compiler.cpp Normal file
View File

@@ -0,0 +1,40 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "Parser.h"
#include "Generator.h"
int main(int argc, char ** argv)
{
if (2 != argc)
{
printf("Usage: ./compiler <shader>\n");
return(1);
}
FILE * f = fopen(argv[1], "r");
// obtain file size
fseek(f , 0 , SEEK_END);
long lSize = ftell(f);
rewind(f);
char * source = (char *)malloc(sizeof(char)*lSize);
size_t result = fread(source, sizeof(char), lSize, f);
assert(result == sizeof(char)*lSize);
fclose(f);
Parser p(source);
p.buildAST();
//Generator::scheme::print_ast(p.getAST());
Generator::GLSL::print_ast(p.getAST());
return(0);
}