fixed parser bugs
authorJordan <jordanlavatai@gmail.com>
Thu, 15 Dec 2016 22:43:35 +0000 (14:43 -0800)
committerJordan <jordanlavatai@gmail.com>
Thu, 15 Dec 2016 22:43:35 +0000 (14:43 -0800)
src/lexer.c
src/lexer_lex.rl
src/parser.y

index 1550db9..b2bb535 100644 (file)
@@ -28,7 +28,7 @@
 #include <dirent.h>
 
 /* Local */
-#include "parser.tab.h"
+#include "src/parser.tab.h"
 #ifndef DE_STACKSIZE
 #define DE_STACKSIZE 1024
 #endif
index 5e395d0..22320d0 100755 (executable)
@@ -1,8 +1,8 @@
 /* Ragel State Machine for tokenizing text */\r
 #include <stdio.h>\r
 #include <string.h>\r
-#include <apc/apc.h>\r
-#include <apc/parser.tab.h>\r
+#include "apc.h"\r
+#include "parser.tab.h"\r
 \r
 \r
 int ipow(int, int);\r
index 6fe0969..85c6c50 100644 (file)
@@ -30,7 +30,6 @@
 %}
 %define parse.error verbose
 %define lr.type ielr
-%glr-parser
 
 %union {
   int ref;
@@ -58,7 +57,6 @@
 %token <val> WIDTH
 %token <val> D
 %token <name> NAME
-%token SHIFT
 //nonterminals
 %type <int> ref_id
  /* Syntax Directed Translation Scheme of the APC grammar */
@@ -117,7 +115,7 @@ set_namelist MOPEN map
 ;
 
 map:
-NAME NUM NUM PATH                            {insert_map($1, 0, $3, $4, 0, $5);};
+NAME NUM NUM PATH                            {insert_map(0, $1, $2, $3, 0, $4);};
 | NAME PATH                                  {insert_map($1, 0, 0, 0, 0, $2);};
 | NAME D PATH                                {insert_map($1, $2, 0, 0, 0, $3);};
 | NAME D NUM NUM PATH                        {insert_map($1, $2, $3, $4, 0, $5);};
@@ -129,10 +127,10 @@ NAME NUM NUM PATH                            {insert_map($1, 0, $3, $4, 0, $5);}
 
 //shift list_namelist name > reduce mlink
 mlink:
-MOPEN LINK NAME LINK link_namelist PATH    {insert_mlink($4, 0);     };
+MOPEN LINK NAME LINK link_namelist PATH    {insert_mlink($3, 0);     };
 | MOPEN LINK link_namelist PATH            {insert_mlink(NULL, 0);   };    
-| MOPEN LINK ref_id PATH                   {insert_mlink(NULL, $4);  };
-| MOPEN LINK NAME LINK ref_id PATH         {insert_mlink($4,$6);     };
+| MOPEN LINK ref_id PATH                   {insert_mlink(NULL, $3);  };
+| MOPEN LINK NAME LINK ref_id PATH         {insert_mlink($3,$5);     };
 ;
 
 //shift list_namelist name > reduce vlink