]> git.mdlowis.com Git - proto/sclpl.git/commitdiff
Removed commented out code and cleaned up some odds and ends parser-rework
authorMike Lowis <mike.lowis@gentex.com>
Wed, 16 Dec 2015 12:08:44 +0000 (12:08 +0000)
committerMike Lowis <mike.lowis@gentex.com>
Wed, 16 Dec 2015 12:08:44 +0000 (12:08 +0000)
source/ast.c
source/main.c
source/parser.c
source/pprint.c
source/sclpl.h

index a4a09f8f383838d07ae99e3d26342eac5acef9aa..dd764876c748621968197d4ebff588bb7b2135a8 100644 (file)
@@ -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;
-//}
-
index 0dea5f4a9af24b9765aae93b8266f03923712f1a..114dac0c7ea5e3f1de44011caf57dcaffac28374 100644 (file)
@@ -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<type>   Emit the given type of artifact"
-        "\n-h         Print help information"
-        "\n-v         Enable verbose status messages");
+        "\n-A<artifact> Emit the given type of artifact"
+        "\n-h           Print help information"
+        "\n-v           Enable verbose status messages");
     exit(1);
 }
 
index 479df8376772f8c4f7bf7f7beae279d1e64d6cbf..fab0d62e7b7c49976d83f596410f40fc287dc074 100644 (file)
@@ -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)
index 350e609f773f400f8c60441af66e986688ef39a3..2dea5c7e732c9591cc743bd7e74a4779557868f9 100644 (file)
@@ -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;
index 7bf4b388ea74e460985f1dd09d766b15dd0d74c5..18bdd1c55c6d16e81ffcd11351f78ca6686355c2 100644 (file)
@@ -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 {