From 004755b39d5c0457a60f8dc96969eb796fb44a18 Mon Sep 17 00:00:00 2001 From: Mike Lowis Date: Wed, 16 Dec 2015 12:08:44 +0000 Subject: [PATCH] Removed commented out code and cleaned up some odds and ends --- source/ast.c | 42 ----------------------------------------- source/main.c | 6 +++--- source/parser.c | 50 ------------------------------------------------- source/pprint.c | 12 ++++++------ source/sclpl.h | 7 +------ 5 files changed, 10 insertions(+), 107 deletions(-) diff --git a/source/ast.c b/source/ast.c index a4a09f8..dd76487 100644 --- a/source/ast.c +++ b/source/ast.c @@ -294,45 +294,3 @@ void fnapp_add_arg(AST* fnapp, AST* arg) vec_push_back(&(fnapp->value.fnapp.args), gc_addref(arg)); } - -//AST* Ann(char* name, AST* value) -//{ -// (void)name; -// (void)value; -// return NULL; -//} -// -//char* ann_name(AST* ann) -//{ -// (void)ann; -// return NULL; -//} -// -//AST* ann_value(AST* ann) -//{ -// (void)ann; -// return NULL; -//} -// -//AST* Block(void) -//{ -// return NULL; -//} -// -//void block_append(AST* expr) -//{ -// (void)expr; -//} -// -//size_t block_size(AST* block) -//{ -// (void)block; -// return 0; -//} -// -//AST* block_get(size_t index) -//{ -// (void)index; -// return NULL; -//} - diff --git a/source/main.c b/source/main.c index 0dea5f4..114dac0 100644 --- a/source/main.c +++ b/source/main.c @@ -43,9 +43,9 @@ static int emit_program(void) { void usage(void) { fprintf(stderr, "%s\n", "Usage: sclpl [options...] [-A artifact] [file...]\n" - "\n-A Emit the given type of artifact" - "\n-h Print help information" - "\n-v Enable verbose status messages"); + "\n-A Emit the given type of artifact" + "\n-h Print help information" + "\n-v Enable verbose status messages"); exit(1); } diff --git a/source/parser.c b/source/parser.c index 479df83..fab0d62 100644 --- a/source/parser.c +++ b/source/parser.c @@ -49,11 +49,6 @@ AST* toplevel(Parser* p) else ret = expression(p); } - //printf("%p\n", ret); - //else if (accept_str(p, T_ID, "type")) - // return type_definition(p); - //else if (accept_str(p, T_ID, "ann")) - // return type_annotation(p); return ret; } @@ -179,51 +174,6 @@ static AST* func_app(Parser* p, AST* fn) return app; } - -#if 0 -static AST* type_annotation(Parser* p) -{ - //shifttok(p, T_ID); - //type(p); - //expect(p, T_END); - //reduce(Annotation); - return NULL; -} - -static AST* type_definition(Parser* p) -{ - //expect(p, T_ID); - //expect_str(p, T_ID, "is"); - //type(p); - //expect(p, T_END); - return NULL; -} - -static AST* type(Parser* p) { - //if (accept(p, T_LBRACE)) { - // tuple(p); - //} else { - // expect(p, T_ID); - // if (accept(p, T_LPAR)) { - // function(p); - // } - //} - return NULL; -} - -static AST* tuple(Parser* p) { - ////size_t mrk = mark(p); - ////insert(p, T_ID, lexer_dup("tuple")); - //do { - // type(p); - //} while (accept(p, T_COMMA)); - //expect(p, T_RBRACE); - ////reduce(p, mrk); - return NULL; -} -#endif - - /* Parsing Routines *****************************************************************************/ Parser* parser_new(char* prompt, FILE* input) diff --git a/source/pprint.c b/source/pprint.c index 350e609..2dea5c7 100644 --- a/source/pprint.c +++ b/source/pprint.c @@ -101,12 +101,12 @@ static void pprint_literal(FILE* file, AST* tree, int depth) { printf("%s:", tree_type_to_string(tree->type)); switch(tree->type) { - case AST_STRING: printf("\"%s\"", string_value(tree)); break; - case AST_SYMBOL: printf("%s", symbol_value(tree)); break; - case AST_IDENT: printf("%s", ident_value(tree)); break; - case AST_CHAR: printf("%c", char_value(tree)); break; - case AST_INT: printf("%ld", integer_value(tree)); break; - case AST_FLOAT: printf("%lf", float_value(tree)); break; + case AST_STRING: printf("\"%s\"", string_value(tree)); break; + case AST_SYMBOL: printf("%s", symbol_value(tree)); break; + case AST_IDENT: printf("%s", ident_value(tree)); break; + case AST_CHAR: printf("%c", char_value(tree)); break; + case AST_INT: printf("%ld", integer_value(tree)); break; + case AST_FLOAT: printf("%lf", float_value(tree)); break; case AST_BOOL: printf("%s", bool_value(tree) ? "true" : "false"); break; diff --git a/source/sclpl.h b/source/sclpl.h index 7bf4b38..18bdd1c 100644 --- a/source/sclpl.h +++ b/source/sclpl.h @@ -27,7 +27,7 @@ void* gc_addref(void* ptr); void gc_delref(void* ptr); void gc_swapref(void** dest, void* newref); -// Redfine main +// Redefine main extern int user_main(int argc, char** argv); /* Vector Implementation @@ -189,11 +189,6 @@ AST* fnapp_fn(AST* fnapp); vec_t* fnapp_args(AST* fnapp); void fnapp_add_arg(AST* func, AST* arg); -///* Annotation */ -//AST* Ann(char* name, AST* value); -//char* ann_name(AST* def); -//AST* ann_value(AST* def); - /* Lexer and Parser Types *****************************************************************************/ typedef struct { -- 2.52.0