From 1aa2a62f22237d02bdc998a9bfeeb30697c08b26 Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 27 May 2015 22:18:47 +0200 Subject: [PATCH] removed deprecated lemon code and moved hyrise related files to subfolder --- .../deploy_to_hyrise.sh | 0 .../web-interface}/bootstrap.min.css | 0 .../web-interface}/hyrise-connector.js | 0 .../web-interface}/index.html | 0 .../web-interface}/jquery-1.11.1.min.js | 0 .../web-interface}/run_server.sh | 0 .../web-interface}/sample-queries.sql | 0 .../web-interface}/style.css | 0 .../web-interface}/ui.js | 0 lemon_example/.gitignore | 5 -- lemon_example/build_and_run.sh | 9 --- lemon_example/flex_scanner.l | 22 ------ lemon_example/lemon_parser.y | 23 ------ lemon_example/main.cpp | 71 ------------------- lemon_example/token_def.h | 9 --- 15 files changed, 139 deletions(-) rename deploy_to_hyrise.sh => hyrise/deploy_to_hyrise.sh (100%) rename {frontend-hyrise => hyrise/web-interface}/bootstrap.min.css (100%) rename {frontend-hyrise => hyrise/web-interface}/hyrise-connector.js (100%) rename {frontend-hyrise => hyrise/web-interface}/index.html (100%) rename {frontend-hyrise => hyrise/web-interface}/jquery-1.11.1.min.js (100%) rename {frontend-hyrise => hyrise/web-interface}/run_server.sh (100%) rename {frontend-hyrise => hyrise/web-interface}/sample-queries.sql (100%) rename {frontend-hyrise => hyrise/web-interface}/style.css (100%) rename {frontend-hyrise => hyrise/web-interface}/ui.js (100%) delete mode 100644 lemon_example/.gitignore delete mode 100644 lemon_example/build_and_run.sh delete mode 100644 lemon_example/flex_scanner.l delete mode 100644 lemon_example/lemon_parser.y delete mode 100644 lemon_example/main.cpp delete mode 100644 lemon_example/token_def.h diff --git a/deploy_to_hyrise.sh b/hyrise/deploy_to_hyrise.sh similarity index 100% rename from deploy_to_hyrise.sh rename to hyrise/deploy_to_hyrise.sh diff --git a/frontend-hyrise/bootstrap.min.css b/hyrise/web-interface/bootstrap.min.css similarity index 100% rename from frontend-hyrise/bootstrap.min.css rename to hyrise/web-interface/bootstrap.min.css diff --git a/frontend-hyrise/hyrise-connector.js b/hyrise/web-interface/hyrise-connector.js similarity index 100% rename from frontend-hyrise/hyrise-connector.js rename to hyrise/web-interface/hyrise-connector.js diff --git a/frontend-hyrise/index.html b/hyrise/web-interface/index.html similarity index 100% rename from frontend-hyrise/index.html rename to hyrise/web-interface/index.html diff --git a/frontend-hyrise/jquery-1.11.1.min.js b/hyrise/web-interface/jquery-1.11.1.min.js similarity index 100% rename from frontend-hyrise/jquery-1.11.1.min.js rename to hyrise/web-interface/jquery-1.11.1.min.js diff --git a/frontend-hyrise/run_server.sh b/hyrise/web-interface/run_server.sh similarity index 100% rename from frontend-hyrise/run_server.sh rename to hyrise/web-interface/run_server.sh diff --git a/frontend-hyrise/sample-queries.sql b/hyrise/web-interface/sample-queries.sql similarity index 100% rename from frontend-hyrise/sample-queries.sql rename to hyrise/web-interface/sample-queries.sql diff --git a/frontend-hyrise/style.css b/hyrise/web-interface/style.css similarity index 100% rename from frontend-hyrise/style.css rename to hyrise/web-interface/style.css diff --git a/frontend-hyrise/ui.js b/hyrise/web-interface/ui.js similarity index 100% rename from frontend-hyrise/ui.js rename to hyrise/web-interface/ui.js diff --git a/lemon_example/.gitignore b/lemon_example/.gitignore deleted file mode 100644 index cc6294c..0000000 --- a/lemon_example/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -flex_scanner.h -flex_scanner.c -lemon_parser.h -lemon_parser.c -lemon_test \ No newline at end of file diff --git a/lemon_example/build_and_run.sh b/lemon_example/build_and_run.sh deleted file mode 100644 index 32e2206..0000000 --- a/lemon_example/build_and_run.sh +++ /dev/null @@ -1,9 +0,0 @@ -rm -f lemon_test lemon_parser.c lemon_parser.h flex_scanner.c flex_scanner.h -echo "Lemon" -lemon lemon_parser.y -echo "Flex" -# flex lexer.l -flex --outfile=flex_scanner.c --header-file=flex_scanner.h flex_scanner.l -echo "Compile" -g++ main.cpp lemon_parser.c flex_scanner.c -o lemon_test -std=c++11 -pthread -./lemon_test \ No newline at end of file diff --git a/lemon_example/flex_scanner.l b/lemon_example/flex_scanner.l deleted file mode 100644 index b8e512f..0000000 --- a/lemon_example/flex_scanner.l +++ /dev/null @@ -1,22 +0,0 @@ -%{ - -#include "lemon_parser.h" -#include -#include "token_def.h" - - -%} - - -%option reentrant -%option noyywrap -%option bison-bridge - - -%% -[0-9]+|[0-9]+.[0-9]+ { yylval->fval = atof(yytext); return NUMBER; } -[+] return PLUS; -[\n] return NL; -[ \t] ; /* skip whitespace */ -. {printf("Unknown character '%c'\n", yytext[0]); return 0;} -%% diff --git a/lemon_example/lemon_parser.y b/lemon_example/lemon_parser.y deleted file mode 100644 index 5e29119..0000000 --- a/lemon_example/lemon_parser.y +++ /dev/null @@ -1,23 +0,0 @@ -%include { - #include - #include - #include "token_def.h" -} -%syntax_error { printf("Lemon syntax error\n"); } - -%token_type {LexerToken*} -%extra_argument { float* result } - -%type expr {float} -%left PLUS MINUS . - -start ::= prog. - -prog ::= prog print NL . -prog ::= prog print . -prog ::= . - -print ::= expr(a) . { *result = a; } - -expr(a) ::= NUMBER(b) . { a = b->fval; } -expr(a) ::= expr(b) PLUS expr(c) . { a = b + c; } \ No newline at end of file diff --git a/lemon_example/main.cpp b/lemon_example/main.cpp deleted file mode 100644 index 382cadf..0000000 --- a/lemon_example/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -#include "token_def.h" -#include "lemon_parser.h" -#include "flex_scanner.h" - -// Based on https://github.com/theory/flex-lemon-example -// and http://stackoverflow.com/questions/24833465/bison-yacc-vs-lemon-vs-standard-input -typedef float ResultType; - -void *ParseAlloc(void *(*mallocProc)(size_t)); -void ParseFree(void *p, void (*freeProc)(void*)); -void Parse(void *yyp, int yymajor, LexerToken* token, ResultType*); - -// int yylex(void); -// int yylval; - - -float parseString(const char* string) { - yyscan_t scanner; - yylex_init(&scanner); - - // Scan the provided string - YY_BUFFER_STATE state = yy_scan_string(string, scanner); - - void* lemonParser = ParseAlloc(malloc); - int tokenCode; - ResultType result; - do { - LexerToken token; - tokenCode = yylex(&token, scanner); - Parse(lemonParser, tokenCode, &token, &result); - // printf("Token %d\n", tokenCode); - } while (tokenCode > 0); - - return result; -} - -int parse_count = 0; -void multithreadTest(int numOfParses, int id) { - for (int n = 0; n < numOfParses; ++n) { - int a = rand() % 1000 + 1; - int b = rand() % 1000 + 1; - int c = a + b; - char string[32]; - sprintf(string, "%d + %d", a, b); - - parse_count++; - int result = parseString(string); - if (parse_count != 1) printf("+"); - parse_count--; - - if (result != c) printf("Error[%d]! %s != %d\n", id, string, result); - } -} - -int main(void) { - const int numThreads = 20; - int numRuns = 300; - - std::thread threads[numThreads]; - for (int n = 0; n < numThreads; ++n) { - threads[n] = std::thread(multithreadTest, numRuns, n); - } - - for (int n = 0; n < numThreads; ++n) { - threads[n].join(); - } - return 0; -} \ No newline at end of file diff --git a/lemon_example/token_def.h b/lemon_example/token_def.h deleted file mode 100644 index fd13ab5..0000000 --- a/lemon_example/token_def.h +++ /dev/null @@ -1,9 +0,0 @@ - - -struct LexerToken { - char* sval; - float fval; -}; - -#define YYSTYPE LexerToken -