changeset 2:ff5e493bc9cb default tip

2003-01-29
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sat, 13 Oct 2012 21:14:50 +0200
parents 1361f218a6e5
children
files Makefile codenodes.c codenodes.h codetext.c codetext.h codetools.c codetools.h dict.c dict.h docs/braki.txt docs/manual.txt docs/node.txt docs/pliki.txt docs/skaner.txt docs/spec.txt docs/squares.txt docs/struct.txt docs/symbols.txt docs/tp4.y docs/tree.txt err.txt error.pas keywords.c keywords.h lexer.c lexer.h main.c node.h node_new.c node_new.h parse_misc.c parse_misc.h parser.c parser.h pascal.l pascal.y sample.pas symbols.c symbols.h token_test.c tokenize.c tokenize.h tp4.output tp4.tab.c tp4.tab.h tp4.y utils.c utils.h view.c view.h write.c write.h
diffstat 50 files changed, 5794 insertions(+), 9372 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat Oct 13 21:11:54 2012 +0200
+++ b/Makefile	Sat Oct 13 21:14:50 2012 +0200
@@ -1,46 +1,60 @@
 # Makefile for PasAna
 
-YACC=bison -v -d
+YACC=bison -d
+LEX = flex
 CC=gcc
 RM= rm -f
 
-OBJS=tp4.tab.o tokenize.o dict.o parser.o
+OBJS=pascal.tab.o utils.o parser.o symbols.o pascal.yy.o main.o keywords.o node_new.o codetext.o codetools.o codenodes.o view.o write.o
 PROG=pasana
 
 GLIB_CFLAGS=`glib-config --cflags`
 GLIB_LIBS=`glib-config --libs`
 
-CFLAGS= -ggdb -Wall $(GLIB_CFLAGS) -DDEBUG
-LIBS=$(GLIB_LIBS)
-INCS=-I./
+CFLAGS= -ggdb -Wall --pedantic $(GLIB_CFLAGS) #-DDEBUG
+LIBS=$(GLIB_LIBS) -lncurses
+INCS=-I./ -I/usr/include/ncurses/
 
 prog: $(OBJS)
 	$(CC) $(LIBS) $(OBJS) -o $(PROG)
 
-test: test_token sample.pas
-	./test_token
+test: $(PROG) sample.pas
+	./$(PROG) sample.pas
 
 clean:
-	$(RM) tp4.tab.c tp4.tab.h
+	$(RM) pascal.tab.c pascal.tab.h pascal.yy.c pascal.output
 	$(RM) $(OBJS)
 	$(RM) $(PROG)
-	$(RM) test_token token_test.o
+
+pasana:	prog
+
+pascal.tab.c: pascal.y
+	$(YACC) pascal.y
 
-tp4.tab.c: tp4.y
-	$(YACC) tp4.y
+pascal.tab.h: pascal.y
+	$(YACC) pascal.y
 
-tp4.tab.h: tp4.y
-	$(YACC) tp4.y
+pascal.yy.c: pascal.l
+	$(LEX) -opascal.yy.c pascal.l
 
 .c.o: $*.c
 	$(CC) $(CFLAGS) $(INCS) -c $*.c -o $@
 
-test_token: token_test.o tokenize.o
-	$(CC) $(LIBS) $^ -o $@
-
-dict.o: dict.c dict.h tp4.tab.h
-dict_test.o: dict_test.c dict.h
-parser.o: parser.c dict.h tokenize.h tp4.tab.h parser.h
-tokenize.o: tokenize.c tokenize.h
-token_test.o: token_test.c tokenize.h
-tp4.tab.o: tp4.tab.c parser.h
+codenodes.o: codenodes.c symbols.h node.h codetext.h codetools.h \
+ codenodes.h pascal.tab.h
+codetext.o: codetext.c codetext.h node.h symbols.h
+codetools.o: codetools.c codetools.h codetext.h node.h symbols.h
+keywords.o: keywords.c parser.h node.h symbols.h pascal.tab.h
+main.o: main.c parser.h node.h symbols.h codetext.h codetools.h \
+ codenodes.h view.h
+node_new.o: node_new.c node.h symbols.h node_new.h parser.h \
+ pascal.tab.h
+parser.o: parser.c symbols.h parser.h node.h keywords.h
+pascal.tab.o: pascal.tab.c symbols.h node.h node_new.h parser.h \
+ keywords.h utils.h
+pascal.yy.o: pascal.yy.c parser.h node.h symbols.h keywords.h \
+ pascal.tab.h utils.h
+symbols.o: symbols.c symbols.h node.h
+utils.o: utils.c symbols.h parser.h node.h utils.h
+view.o: view.c view.h codetext.h node.h symbols.h
+write.o: write.c write.h codetext.h node.h symbols.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/codenodes.c	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,961 @@
+/* Zestaw procedur do zamieniania na tekst roznych rodzajow wezlow. */
+
+#include <glib.h>
+#include "symbols.h"
+#include "node.h"
+#include "codetext.h"
+#include "codetools.h"
+#include "codenodes.h"
+#include "pascal.tab.h"
+
+void printNamespace(CodeText *text, Namespace *nam);
+
+/* Wyświetla dany symbol (nazwę) lub jego zawartość, jeśli nie ma nazwy. */
+void
+printSymbolNode(CodeText *text, SymbolNode * node)
+{
+    if (node == NULL)
+        return;
+
+    if (node->parent != NULL) {
+        switch (node->kind) {
+            case SYM_TYPE_POINTER:
+            case SYM_TYPE_STRING:
+            case SYM_TYPE_ARRAY:
+            case SYM_TYPE_SET:
+            case SYM_TYPE_SUBRANGE:
+            case SYM_TYPE_ENUM:
+            case SYM_TYPE_RECORD:
+            case SYM_TYPE_FILE:
+                codeBeginTag(text, HG_TYPE, node);
+                break;
+            case SYM_LABEL:
+                codeBeginTag(text, HG_LABEL, node);
+                break;
+            case SYM_CONST:
+                codeBeginTag(text, HG_CONST, node);
+                break;
+            default:
+                codeBeginTag(text, HG_IDENT, node);
+        }
+        codePrint(text, node->name->str);
+        codeEndTag(text);
+    } else {
+        printSymbolNodeContents(text, node);
+    }
+
+}
+
+/* Wyświetla treść danego symbolu. */
+void
+printSymbolNodeContents(CodeText *text, SymbolNode * node)
+{
+    GList          *iter;
+
+    if (node == NULL)
+        return;
+
+    switch (node->kind) {
+        case SYM_TAG_FIELD:
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                if (iter->data!=NULL) {
+                    printExprNode(text, iter->data);
+                    codeBeginTag(text, HG_PUNCT, NULL);
+                    codePrint(text, ";");
+                    codeEndTag(text);
+                    codeNewLine(text);
+                }
+            }
+            break;
+        case SYM_TYPE_POINTER:
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "^");
+            codeEndTag(text);
+            printSymbolNode(text, node->type);
+            break;
+        case SYM_TYPE_STRING:
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, "STRING");
+            codeEndTag(text);
+            if (node->expr != NULL) {
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, "[");
+                codeEndTag(text);
+                printExprNode(text, node->expr);
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, "]");
+                codeEndTag(text);
+            }
+            break;
+        case SYM_TYPE_ARRAY:
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, "ARRAY");
+            codeEndTag(text);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "[");
+            codeEndTag(text);
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                printSymbolNode(text, iter->data);
+                if (iter->next != NULL) {
+                    codeBeginTag(text, HG_PUNCT, NULL);
+                    codePrint(text, ", ");
+                    codeEndTag(text);
+                }
+            }
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "] ");
+            codeEndTag(text);
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, "OF ");
+            codeEndTag(text);
+            printSymbolNode(text, node->type);
+            break;
+        case SYM_TYPE_SET:
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, "SET OF ");
+            codeEndTag(text);
+            printSymbolNode(text, node->type);
+            break;
+        case SYM_TYPE_SUBRANGE:
+            printExprNode(text, node->expr);
+            break;
+        case SYM_TYPE_ENUM:
+            codePrint(text, "enumeraton");
+            break;
+        case SYM_TYPE_RECORD:
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, "RECORD");
+            codeEndTag(text);
+            codeNewLine(text);
+            codeIndent(text);
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                if (iter->data!=NULL) {
+                    printSymbolNodeDef(text, iter->data);
+                    codeBeginTag(text, HG_PUNCT, NULL);
+                    codePrint(text, ";");
+                    codeEndTag(text);
+                    codeNewLine(text);
+                }
+            }
+            /* printNamespace(text, node->symbols); */
+            printSymbolNodeDef(text, node->base);
+            codeUnindent(text);
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, "END");
+            codeEndTag(text);
+            break;
+        case SYM_TYPE_FILE:
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, "FILE OF ");
+            codeEndTag(text);
+            printSymbolNode(text, node->type);
+            break;
+        case SYM_VAR_LOCAL:
+        case SYM_VAR_PARAM:
+        case SYM_VAR_VARPARAM:
+        case SYM_VAR_DEARR:
+        case SYM_VAR_DEREF:
+        case SYM_VAR_CAST:
+        case SYM_UNIT:
+            printSymbolNode(text, node);
+#if 0
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            break;
+        case SYM_LABEL:
+            printSymbolNode(text, node);
+#if 0
+            codeBeginTag(text, HG_LABEL, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            break;
+        case SYM_CONST:
+            printSymbolNode(text, node);
+#if 0
+            codeBeginTag(text, HG_CONST, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            break;
+        case SYM_VAR_FIELD:
+            if (node->base == node) {
+                codeBeginTag(text, HG_IDENT, node);
+                codePrint(text, node->name->str);
+                codeEndTag(text);
+            } else {
+                printSymbolNode(text, node->base);
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ".");
+                codeEndTag(text);
+                codeBeginTag(text, HG_IDENT, node);
+                codePrint(text, node->name->str);
+                codeEndTag(text);
+            }
+            break;
+        case SYM_PROC:
+        case SYM_FUNC:
+            codeIndent(text);
+            printNamespace(text, node->symbols);
+            printStmtNode(text, node->stmt);
+            codeUnindent(text);
+            break;
+        case SYM_PROG:
+            codeIndent(text);
+            printNamespace(text, node->symbols);
+
+            printStmtNode(text, node->stmt);
+            codeUnindent(text);
+            break;
+        default:
+            codeBeginTag(text, HG_ERROR, NULL);
+            codePrint(text, "?symbol?");
+            codeEndTag(text);
+    }
+}
+
+/* Wyświetla definicję danego symbolu. */
+void
+printSymbolNodeDef(CodeText *text, SymbolNode * node)
+{
+    GList          *iter;
+
+    if (node == NULL)
+        return;
+
+    if (node->bcomm != NULL) {
+        codeBeginTag(text, HG_COMMENT, NULL);
+        codePrint(text, node->bcomm->str);
+        codeEndTag(text);
+        codeNewLine(text);   
+    }
+
+    if (node->ccomm!=NULL) {
+        codeComment(text, node->ccomm->str);
+    }
+
+    switch (node->kind) {
+        case SYM_TAG_FIELD:
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, "CASE ");
+            codeEndTag(text);
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+            if (node->type!=NULL) {
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ": ");
+                codeEndTag(text);
+                printSymbolNode(text, node->type);
+            }
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, " OF");
+            codeEndTag(text);
+            codeNewLine(text);
+            codeIndent(text);
+            printSymbolNodeContents(text, node);
+            codeUnindent(text);
+            break;
+        case SYM_TYPE_POINTER:
+        case SYM_TYPE_STRING:
+        case SYM_TYPE_ARRAY:
+        case SYM_TYPE_SET:
+        case SYM_TYPE_SUBRANGE:
+        case SYM_TYPE_ENUM:
+        case SYM_TYPE_RECORD:
+        case SYM_TYPE_FILE:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "TYPE ");
+            codeEndTag(text);
+#if 0
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            printSymbolNode(text, node);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, " = ");
+            codeEndTag(text);
+            printSymbolNodeContents(text, node);
+            break;
+        case SYM_VAR_PARAM:
+#if 0
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str); 
+            codeEndTag(text);
+#endif
+            printSymbolNode(text, node);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ": ");
+            codeEndTag(text);
+            printSymbolNode(text, node->type);
+            break;
+        case SYM_VAR_VARPARAM:
+            codeBeginTag(text, HG_TYPE, NULL);
+            codePrint(text, "VAR ");
+            codeEndTag(text);
+#if 0
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            printSymbolNode(text, node);
+            if (node->type!=NULL) {
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ": ");
+                codeEndTag(text);
+                printSymbolNode(text, node->type);
+            }
+            break;
+        case SYM_VAR_LOCAL:
+        case SYM_VAR_DEARR:
+        case SYM_VAR_DEREF:
+        case SYM_VAR_CAST:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "VAR ");
+            codeEndTag(text);
+#if 0
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            printSymbolNode(text, node);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ": ");
+            codeEndTag(text);
+            printSymbolNode(text, node->type);
+            break;
+        case SYM_VAR_FIELD:
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                if (iter->data != NULL) {
+                    printExprNode(text, iter->data);
+                }
+                codeBeginTag(text, HG_PUNCT, NULL);
+                if (iter->next != NULL) {
+                    codePrint(text, ", ");
+                } else {
+                    codePrint(text, ": ");
+                }
+                codeEndTag(text);
+            }
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ": ");
+            codeEndTag(text);
+            printSymbolNode(text, node->type);
+            break;
+        case SYM_LABEL:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "LABEL ");
+            codeEndTag(text);
+#if 0
+            codeBeginTag(text, HG_LABEL, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            printSymbolNode(text, node);
+            break;
+        case SYM_PROC:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "PROCEDURE ");
+            codeEndTag(text);
+#if 0
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            printSymbolNode(text, node);
+            if (node->list != NULL) {
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, "(");
+                codeEndTag(text);
+                for (iter = node->list; iter != NULL; iter = iter->next) {
+                    printSymbolNodeDef(text, iter->data);
+                    if (iter->next != NULL) {
+                        codeBeginTag(text, HG_PUNCT, NULL);
+                        codePrint(text, "; ");
+                        codeEndTag(text);
+                    }
+                }
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ")");
+                codeEndTag(text);
+            }
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ";");
+            codeEndTag(text);
+            codeNewLine(text);
+            printSymbolNodeContents(text, node);
+            break;
+        case SYM_FUNC:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "FUNCTION ");
+            codeEndTag(text);
+#if 0
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            printSymbolNode(text, node);
+            if (node->list != NULL) {
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, "(");
+                codeEndTag(text);
+                for (iter = node->list; iter != NULL; iter = iter->next) {
+                    node = ((SymbolNode *) iter->data);
+                    printSymbolNodeDef(text, node);
+                    if (iter->next != NULL) {
+                        codeBeginTag(text, HG_PUNCT, NULL);
+                        codePrint(text, "; ");
+                        codeEndTag(text);
+                    }
+                }
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ")");
+                codeEndTag(text);
+            }
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ": ");
+            codeEndTag(text);
+            printSymbolNode(text, node->type);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ";");
+            codeEndTag(text);
+            codeNewLine(text);
+            printSymbolNodeContents(text, node);
+            break;
+        case SYM_CONST:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "CONST ");
+            codeEndTag(text);
+#if 0
+            codeBeginTag(text, HG_CONST, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            printSymbolNode(text, node);
+            if (node->type != NULL) {
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ": ");
+                codeEndTag(text);
+                printSymbolNode(text, node->type);
+            }
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, " = ");
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            break;
+        case SYM_UNIT:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "USES ");
+            codeEndTag(text);
+#if 0
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+#endif
+            printSymbolNode(text, node);
+            break;
+        case SYM_PROG:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "PROGRAM ");
+            codeEndTag(text);
+            codeBeginTag(text, HG_IDENT, node);
+            codePrint(text, node->name->str);
+            codeEndTag(text);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "(");
+            codeEndTag(text);
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                codePrint(text, (char *)(iter->data));
+                if (iter->next != NULL) {
+                    codeBeginTag(text, HG_PUNCT, NULL);
+                    codePrint(text, ", ");
+                    codeEndTag(text);
+                }
+            }
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ");");
+            codeEndTag(text);
+            codeNewLine(text);
+            printSymbolNodeContents(text, node);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ".");
+            codeEndTag(text);
+            break;
+        default:
+            codeBeginTag(text, HG_ERROR, NULL);
+            codePrint(text, "?symbol?");
+            codeEndTag(text);
+    }
+}
+
+/* Wyświetla węzeł rozkazu. */
+void
+printStmtNode(CodeText *text, StmtNode * node)
+{
+    GList          *iter;
+
+    if (node == NULL)
+        return;
+
+    if (node->bcomm != NULL) {
+        codeBeginTag(text, HG_COMMENT, NULL);
+        codePrint(text, node->bcomm->str);
+        codeEndTag(text);
+        codeNewLine(text);   
+    }
+
+    if (node->label!=NULL) {
+        codeLabel(text, node->label->name->str);
+        codeLabel(text, ": ");
+    }
+    
+    if (node->ccomm!=NULL) {
+        codeComment(text, node->ccomm->str);
+    }
+
+    switch (node->kind) {
+        case STMT_CASE_CASE:
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                printExprNode(text, iter->data);
+                if (iter->next != NULL) {
+                    codeBeginTag(text, HG_PUNCT, NULL);
+                    codePrint(text, ", ");
+                    codeEndTag(text);
+                }
+            }
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ": ");
+            codeEndTag(text);
+            printStmtNode(text, node->stmt);
+            break;
+        case STMT_CASE_HEAD:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "CASE ");
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, " OF");
+            codeEndTag(text);
+            codeNewLine(text);
+            codeIndent(text);
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                if (iter->data != NULL) {
+                    printStmtNode(text, iter->data);
+                    codeBeginTag(text, HG_PUNCT, NULL);
+                    codePrint(text, ";");
+                    codeEndTag(text);
+                    codeNewLine(text);
+                }
+            }
+            if (node->stmt != NULL) {
+                codeBeginTag(text, HG_KEYWORD, NULL);
+                codePrint(text, "ELSE ");
+                codeEndTag(text);
+                printStmtNode(text, node->stmt);
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ";");
+                codeEndTag(text);
+                codeNewLine(text);
+            }
+            codeUnindent(text);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "END");
+            codeEndTag(text);
+            break;
+        case STMT_REPEAT:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "REPEAT");
+            codeEndTag(text);
+            codeNewLine(text);
+            codeIndent(text);
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                printStmtNode(text, iter->data);
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ";");
+                codeEndTag(text);
+                codeNewLine(text);
+            }
+            codeUnindent(text);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "UNTIL ");
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            break;
+        case STMT_WHILE:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "WHILE ");
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, " DO ");
+            codeEndTag(text);
+            printStmtNode(text, node->stmt);
+            break;
+        case STMT_WITH:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "WITH ");
+            codeEndTag(text);
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                if (iter->data != NULL) {
+                    printSymbolNode(text, (SymbolNode *)iter->data);
+                    if (iter->next != NULL) {
+                        codeBeginTag(text, HG_PUNCT, NULL);
+                        codePrint(text, ", ");
+                        codeEndTag(text);
+                    }
+                }
+            }
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, " DO ");
+            codeEndTag(text);
+            printStmtNode(text, node->stmt);
+            break;
+        case STMT_GOTO:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "GOTO ");
+            codeEndTag(text);
+            printSymbolNode(text, node->symbol);
+            break;
+        case STMT_BLOCK:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "BEGIN");
+            codeEndTag(text);
+            codeNewLine(text);
+            codeIndent(text);
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                if (iter->data != NULL) {
+                    printStmtNode(text, iter->data);
+                    codeBeginTag(text, HG_PUNCT, NULL);
+                    codePrint(text, ";");
+                    codeEndTag(text);
+                    codeNewLine(text);
+                }
+            }
+            codeUnindent(text);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "END");
+            codeEndTag(text);
+            break;
+        case STMT_IF:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "IF ");
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, " THEN ");
+            codeEndTag(text);
+            printStmtNode(text, node->stmt);
+            if (node->stmt2 != NULL) {
+                codeBeginTag(text, HG_KEYWORD, NULL);
+                codePrint(text, " ELSE ");
+                codeEndTag(text);
+                printStmtNode(text, node->stmt2);
+            }
+            break;
+        case STMT_ASSIGN:
+            printSymbolNode(text, node->symbol);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ":= ");
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            break;
+        case STMT_PROC:
+            printSymbolNode(text, node->symbol);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "(");
+            codeEndTag(text);
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                printExprNode(text, iter->data);
+                if (iter->next != NULL) {
+                    codeBeginTag(text, HG_PUNCT, NULL);
+                    codePrint(text, ", ");
+                    codeEndTag(text);
+                }
+            }
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ")");
+            codeEndTag(text);
+            break;
+        case STMT_FOR:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "FOR ");
+            codeEndTag(text);
+            printSymbolNode(text, node->symbol);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ":= ");
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, " TO ");
+            codeEndTag(text);
+            printExprNode(text, node->expr2);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, " DO ");
+            codeEndTag(text);
+            printStmtNode(text, node->stmt);
+            break;
+        case STMT_FOR_DOWN:
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, "FOR ");
+            codeEndTag(text);
+            printSymbolNode(text, node->symbol);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ":= ");
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, " DOWNTO ");
+            codeEndTag(text);
+            printExprNode(text, node->expr2);
+            codeBeginTag(text, HG_KEYWORD, NULL);
+            codePrint(text, " DO ");
+            codeEndTag(text);
+            printStmtNode(text, node->stmt);
+            break;
+        default:
+            codeBeginTag(text, HG_ERROR, NULL);
+            codePrint(text, "?stmt?");
+            codeEndTag(text);
+    }
+}
+
+const char     *
+getOper(enum OperKind oper)
+{
+    switch (oper) {
+        case OPER_PLUS:
+            return "+";
+        case OPER_MINUS:
+            return "-";
+        case OPER_STAR:
+            return "*";
+        case OPER_SLASH:
+            return "/";
+        case OPER_DIV:
+            return "DIV";
+        case OPER_MOD:
+            return "MOD";
+        case OPER_SHL:
+            return "SHL";
+        case OPER_SHR:
+            return "SHR";
+        case OPER_EQ:
+            return "=";
+        case OPER_NEQ:
+            return "<>";
+        case OPER_GT:
+            return ">";
+        case OPER_LT:
+            return "<";
+        case OPER_GEQ:
+            return ">=";
+        case OPER_LEQ:
+            return "<=";
+        case OPER_IN:
+            return "IN";
+        case OPER_XOR:
+            return "XOR";
+        case OPER_OR:
+            return "OR";
+        case OPER_AND:
+            return "AND";
+        case OPER_NOT:
+            return "NOT";
+        case OPER_NONE:
+        default:
+            return " ";
+
+    }
+}
+
+void
+printExprNode(CodeText *text, ExprNode * node)
+{
+    GList          *iter;
+
+    if (node == NULL)
+        return;
+
+    switch (node->kind) {
+        case EXPR_VARIANT:
+            printExprNode(text, node->expr);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text,"(");
+            codeEndTag(text);
+            codeIndent(text);
+            codeNewLine(text);
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                if (iter->data!=NULL) {
+                    printSymbolNodeDef(text, iter->data);
+                    codeBeginTag(text, HG_PUNCT, NULL);
+                    codePrint(text, ";");
+                    codeEndTag(text);
+                    codeNewLine(text);
+                }
+            }
+            printSymbolNodeDef(text, node->symbol);
+            codeUnindent(text);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text,")");
+            codeEndTag(text);
+            break;
+        case EXPR_CASES:
+            for (iter = node->list; iter != NULL; iter = iter->next) {
+                printExprNode(text, iter->data);
+                codeBeginTag(text, HG_PUNCT, NULL);
+                if (iter->next != NULL)
+                    codePrint(text, ", ");
+                else
+                    codePrint(text, ": ");
+                codeEndTag(text);
+            }
+            break;
+        case EXPR_ADDR:
+            if (node->symbol != NULL) {
+                codePrint(text, "@");
+                printSymbolNode(text, node->symbol);
+            } else {
+                printExprNode(text, node->expr);
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ":");
+                codeEndTag(text);
+                printExprNode(text, node->expr2);
+            }
+            break;
+        case EXPR_NUMBER:
+            codeBeginTag(text, HG_NUMBER, node);
+            codePrint(text, node->value->str);
+            codeEndTag(text);
+            break;
+        case EXPR_STRING:
+            codeBeginTag(text, HG_STRING, node);
+            codePrint(text, node->value->str);
+            codeEndTag(text);
+            break;
+        case EXPR_CONST:
+        case EXPR_VAR:
+            printSymbolNode(text, node->symbol);
+            break;
+        case EXPR_PAREN:
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "( ");
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, " )");
+            codeEndTag(text);
+            break;
+        case EXPR_UN:
+            codeBeginTag(text, HG_OPER, node);
+            codePrint(text, getOper(node->oper));
+            codeEndTag(text);
+            printExprNode(text, node->expr);
+            break;
+        case EXPR_BIN:
+        case EXPR_EQ:
+            printExprNode(text, node->expr);
+            codePrint(text, " ");
+            codeBeginTag(text, HG_OPER, node);
+            codePrint(text, getOper(node->oper));
+            codeEndTag(text);
+            codePrint(text, " ");
+            printExprNode(text, node->expr2);
+            break;
+        case EXPR_SET:
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "[");
+            codeEndTag(text);
+            if (node->list != NULL) {
+                for (iter = node->list; iter != NULL; iter = iter->next) {
+                    printExprNode(text, iter->data);
+                    if (iter->next != NULL) {
+                        codeBeginTag(text, HG_PUNCT, NULL);
+                        codePrint(text, ", ");
+                        codeEndTag(text);
+                    }
+                }
+            }
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "]");
+            codeEndTag(text);
+            break;
+        case EXPR_ARRAY:
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "(");
+            codeEndTag(text);
+            if (node->list != NULL) {
+                for (iter = node->list; iter != NULL; iter = iter->next) {
+                    printExprNode(text, iter->data);
+                    if (iter->next != NULL) {
+                        codeBeginTag(text, HG_PUNCT, NULL);
+                        codePrint(text, ", ");
+                        codeEndTag(text);
+                    }
+                }
+            }
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ")");
+            codeEndTag(text);
+            break;
+        case EXPR_NIL:
+            codeBeginTag(text, HG_CONST, node);
+            codePrint(text, "NIL");
+            codeEndTag(text);
+            break;
+        case EXPR_RANGE:
+            printExprNode(text, node->expr);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, "..");
+            codeEndTag(text);
+            printExprNode(text, node->expr2);
+            break;
+        case EXPR_FUNC:
+            printSymbolNode(text, node->symbol);
+            if (node->list != NULL) {
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, "(");
+                codeEndTag(text);
+                for (iter = node->list; iter != NULL; iter = iter->next) {
+                    printExprNode(text, iter->data);
+                    if (iter->next != NULL) {
+                        codeBeginTag(text, HG_PUNCT, NULL);
+                        codePrint(text, ", ");
+                        codeEndTag(text);
+                    }
+                }
+                codeBeginTag(text, HG_PUNCT, NULL);
+                codePrint(text, ")");
+                codeEndTag(text);
+            }
+        default:
+            codeBeginTag(text, HG_ERROR, NULL);
+            codePrint(text, "?expr?");
+            codeEndTag(text);
+    }
+}
+
+void
+printNamespace(CodeText *text, Namespace * nam)
+{
+    GList          *iter;
+    SymbolNode     *node;
+
+    if (nam == NULL)
+        return;
+    for (iter = nam->list; iter != NULL; iter = iter->next) {
+        node = ((SymbolNode *) iter->data);
+        if ((node->kind != SYM_VAR_PARAM) && (node->kind != SYM_VAR_VARPARAM)) {
+            printSymbolNodeDef(text, node);
+            codeBeginTag(text, HG_PUNCT, NULL);
+            codePrint(text, ";");
+            codeEndTag(text);
+            codeNewLine(text);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/codenodes.h	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,24 @@
+/* Procedury do wyswietlania informacji o wezlach. */
+
+#ifndef CODENODES_H
+#define CODENODES_H
+
+#include "node.h"
+#include "codetext.h"
+
+
+/* Wyświetla symbol. */
+void printSymbolNode(CodeText *text, SymbolNode *node);
+
+/* Wyświetla definicję danego symbolu. */
+void printSymbolNodeDef(CodeText *text, SymbolNode *node);
+
+/* Wyświetla treść danego symbolu. */
+void printSymbolNodeContents(CodeText *text, SymbolNode *node);
+
+/* Wyświetla węzeł rozkazu. */
+void printStmtNode(CodeText *text, StmtNode *node);
+
+void printExprNode(CodeText *text, ExprNode *node);
+
+#endif /* not CODENODES_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/codetext.c	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,50 @@
+
+#include <glib.h>
+#include "codetext.h"
+
+/* Tworzy nowy obiekt CodeLIne. */
+CodeLine*
+newCodeLine(CodeText *text)
+{
+    CodeLine *line;
+    
+    line = g_new(CodeLine, 1);
+    line->string = g_string_new("");
+    line->comment = NULL;
+    line->tag_list = NULL;
+    line->label = NULL;
+    line->indent = 0;
+    line->number = ++(text->line_no);
+    return line;
+}
+
+/* Tworzy nowy obiekt CodeTag. */
+CodeTag*
+newCodeTag()
+{
+    CodeTag *tag;
+
+    tag = g_new(CodeTag, 1);
+    tag->group = HG_TEXT;
+    tag->xstart = 0;
+    tag->ystart = 0;
+    tag->xend = 0;
+    tag->yend = 0;
+    tag->node = NULL;
+    return tag;
+}
+
+/* Tworzy nowy obiekt CodeText. */
+CodeText*
+newCodeText()
+{
+    CodeText *text;
+
+    text = g_new(CodeText, 1);
+    text->line_list = NULL;
+    text->tag_stack= NULL;
+    text->last_line = NULL;
+    text->line_no = 0;
+    text->indent = 0;
+    return text;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/codetext.h	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,64 @@
+/* Definicja typu trzymającego tekst kodu programu. */
+
+#ifndef CODETEXT_H
+#define CODETEXT_H
+
+#include <glib.h>
+#include "node.h"
+
+/* Grupy wyrozniania (do kolorowania) */
+enum HiGroup {
+    HG_TEXT,
+    HG_KEYWORD,
+    HG_TYPE,
+    HG_IDENT,
+    HG_OPER,
+    HG_CONST,
+    HG_STRING,
+    HG_COMMENT,
+    HG_LABEL,
+    HG_LINENO,
+    HG_PUNCT,
+    HG_NUMBER,
+    HG_ERROR,
+    HG_MAXIMUM
+};
+
+/* Pojedyńcza linijka kodu. */
+struct CodeLine {
+    int             indent;                                /* Wcięcie danej linijki. */
+    int             number;                                /* Numer linii. */
+    GString        *string;                                /* Tekst kodu do wyświetlenia. */
+    GString        *comment;                               /* Komentarz do wyświetlenia. */
+    GString        *label;                                 /* Etykieta. */
+    GList          *tag_list;                                /* Lista informacji o tokenach. */
+};
+typedef struct CodeLine CodeLine;
+
+/* Informacja o jednym tokenie. */
+struct CodeTag {
+    int             xstart, ystart, xend, yend;            /* Odkąd dokąd się ciągnie. */
+    enum HiGroup    group;                                 /* Jak ma byc kolorowany? */
+    void           *node;                                  /* Wskaźnik do danego węzła. */
+};
+typedef struct CodeTag CodeTag;
+
+/* Cały kod programu. */
+struct CodeText {
+    GList          *line_list;                             /* Poszczególne linijki kodu. */
+    CodeLine       *last_line;                             /* Ostatnio dodana linia (bierzaca). */
+    int             indent;                                /* Wcięcie jakie należy zastosować do nowych linijek. */
+    int             line_no;                               /* Ilosc linii. */
+    GList          *tag_stack;                             /* Stos tokenów do kontroli ich kończenia się. */
+};
+typedef struct CodeText CodeText;
+
+/* Tworzy nowy obiekt CodeLIne. */
+CodeLine       *newCodeLine(CodeText * text);
+
+/* Tworzy nowy obiekt CodeTag. */
+CodeTag      *newCodeTag();
+
+/* Tworzy nowy obiekt CodeText. */
+CodeText       *newCodeText();
+#endif                                                     /* not CODETEXT_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/codetools.c	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,138 @@
+#include <stdio.h>
+#include "codetools.h"
+
+
+#define COMM_INDENT 60
+
+/* Zwiększa wcięcie kolejnych linii. */
+void
+codeIndent(CodeText *text)
+{
+    ++(text->indent);
+    if (text->last_line->string->len==0)
+        ++(text->last_line->indent);
+}
+
+/* Zmniejsza wcięcie. */
+void
+codeUnindent(CodeText *text)
+{
+    --(text->indent);
+    if (text->last_line->string->len==0)
+        --(text->last_line->indent);
+}
+
+/* Przechodzi do nowej linijki. */
+void
+codeNewLine(CodeText *text)
+{
+    CodeLine *line;
+
+    line = newCodeLine(text);
+    line->indent = text->indent;
+    text->last_line = line;
+    text->line_list = g_list_append(text->line_list, line);
+}
+
+/* Dodaje tekst do ostatniej linijki. */
+void
+codePrint(CodeText *text, const char *string)
+{
+    if (text->last_line == NULL)
+        codeNewLine(text);
+    text->last_line->string = g_string_append(text->last_line->string, string);
+}
+
+/* Dodaje tekst etykiety do ostatniej linijki. */
+void
+codeLabel(CodeText *text, const char *string)
+{
+    if (text->last_line == NULL)
+        codeNewLine(text);
+    if (text->last_line->label==NULL) {
+        text->last_line->label = g_string_new(string);
+    } else {
+        text->last_line->label = g_string_append(text->last_line->label, string);
+    }
+}
+
+/* Dodaje tekst komentarza do ostatniej linijki. */
+void
+codeComment(CodeText *text, const char *string)
+{
+    if (text->last_line == NULL)
+        codeNewLine(text);
+    if (text->last_line->comment==NULL) {
+        text->last_line->comment = g_string_new(string);
+    } else {
+        text->last_line->comment = g_string_append(text->last_line->comment, string);
+    }
+}
+
+/* Wyświetla kod na ekranie. */
+void
+codeShow(CodeText *text)
+{
+    GList *iter;
+    CodeLine *line;
+    int ind;
+
+    if (text==NULL)
+        return;
+    for (iter=text->line_list; iter!=NULL; iter=iter->next) {
+        line = ((CodeLine *)iter->data);
+        if (line->label!=NULL) {
+            ind = line->label->len;
+            printf("%s", line->label->str);
+        } else {
+            ind = 0;
+        }
+        while (ind<line->indent*4) {
+            printf(" ");
+            ++ind;
+        }
+        printf("%s", line->string->str);
+        ind += line->string->len;
+        if (line->comment!=NULL) {
+            while (ind<COMM_INDENT) {
+                printf(" ");
+                ++ind;
+            }
+            printf("%s", line->comment->str);
+        }
+        printf("\n");
+    }
+}
+
+/* Zaznacza początek tokena. */
+void
+codeBeginTag(CodeText *text, int group, void *node)
+{
+    CodeTag *tag;
+    int kind;
+    
+    if (text->last_line == NULL)
+        codeNewLine(text);
+    tag = newCodeTag();
+    tag->xstart = text->last_line->string->len;
+    tag->ystart = (text->last_line->number)-1;
+    text->tag_stack = g_list_prepend(text->tag_stack, tag);    
+    text->last_line->tag_list = g_list_append(text->last_line->tag_list, tag);
+    tag->group = group;
+    tag->node = node;
+}
+
+/* Zanzacza koniec tokena. */
+void
+codeEndTag(CodeText *text)
+{
+    GList *first;
+    CodeTag *tag;
+
+    tag = text->tag_stack->data;
+    tag->xend = text->last_line->string->len;
+    tag->yend = (text->last_line->number)-1;
+    first = text->tag_stack;
+    text->tag_stack = g_list_remove_link(text->tag_stack, first);
+    g_list_free(first);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/codetools.h	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,35 @@
+/* Procedury narzędziowe do CodeText. */
+
+#ifndef CODETOOLS_H
+#define CODETOOLS_H
+
+#include "codetext.h"
+
+/* Zwiększa wcięcie kolejnych linii. */
+void codeIndent(CodeText *text);
+
+/* Zmniejsza wcięcie. */
+void codeUnindent(CodeText *text);
+
+/* Przechodzi do nowej linijki. */
+void codeNewLine(CodeText *text);
+
+/* Dodaje tekst do ostatniej linijki. */
+void codePrint(CodeText *text, const char *string);
+
+/* Wyświetla kod na ekranie. */
+void codeShow(CodeText *text);
+
+/* Zaznacza początek tokena. */
+void codeBeginTag(CodeText *text, int group, void *node);
+
+/* Zanzacza koniec tokena. */
+void codeEndTag(CodeText *text);
+
+/* Dodaje tekst komentarza do ostatniej linijki. */
+void codeComment(CodeText *text, const char *string);
+
+/* Dodaje tekst etykiety do ostatniej linijki. */
+void codeLabel(CodeText *text, const char *string);
+
+#endif /* not CODETOOLS_H */
--- a/dict.c	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <glib.h>
-#include "dict.h"
-#include "tp4.tab.h"
-
-/* Słowa kluczowe są globalne. */
-//static GHashTable *keywords_tab;
-
-Dictionary     *
-newDictionary()
-{
-    Dictionary     *dict;
-
-    dict = g_new(Dictionary, 1);
-    dict->table = g_hash_table_new(g_str_hash, g_str_equal);
-    dict->locals = g_hash_table_new(g_str_hash, g_str_equal);
-    return dict;
-}
-
-void
-dictAdd(Dictionary * dict, DictEntry * entry)
-{
-    int i;
-    
-    /* Wszystkie sybole z wielkich liter. */
-    for (i=0; entry->string[i]!='\0'; ++i)
-        entry->string[i] = toupper(entry->string[i]);
-    /* Sprawdzamy, czy taki symbol juz istnieje. */
-    if (g_hash_table_lookup(dict->table, entry->string) != NULL)
-        return;
-    g_hash_table_insert(dict->table, entry->string, entry);
-}
-
-void
-dictAddLocal(Dictionary * dict, DictEntry * entry)
-{
-    int i;
-    
-    /* Wszystkie sybole z wielkich liter. */
-    for (i=0; entry->string[i]!='\0'; ++i)
-        entry->string[i] = toupper(entry->string[i]);
-    /* Sprawdzamy, czy taki symbol juz istnieje. */
-    if (g_hash_table_lookup(dict->locals, entry->string) != NULL)
-        return;
-    g_hash_table_insert(dict->locals, entry->string, entry);
-}
-
-void
-keywordsInit(Dictionary *dict)
-{
-    int             i;
-    const static char *keywords_str[] =
-        {"AND", "ABSOLUTE", "ARRAY", "BEGIN", "CASE", "CONST", "DIV", "DOWNTO", "DO", "ELSE", "END",
-         "EXTERNAL", "FILE", "FORWARD", "FOR", "FUNCTION", "GOTO", "IF", "IMPLEMENTATION",
-         "INTERFACE", "IN", "LABEL", "MOD", "NIL", "NOT", "OF", "OR", "PACKED", "PROCEDURE",
-         "PROGRAM", "RECORD", "REPEAT", "SET", "SHL", "SHR", "STRING", "THEN", "TO", "TYPE", "UNIT",
-         "UNTIL", "USES", "VAR", "WHILE", "WITH", "XOR", "THEN", "ELSE", NULL};
-    const static int keywords_tok[] =
-        {K_AND, K_ABSOLUTE, K_ARRAY, K_BEGIN, K_CASE, K_CONST, K_DIV, K_DOWNTO, K_DO, K_ELSE, K_END,
-         K_EXTERNAL, K_FILE, K_FORWARD, K_FOR, K_FUNCTION, K_GOTO, K_IF, K_IMPLEMENTATION,
-         K_INTERFACE, K_IN, K_LABEL, K_MOD, K_NIL, K_NOT, K_OF, K_OR, K_PACKED, K_PROCEDURE,
-         K_PROGRAM, K_RECORD, K_REPEAT, K_SET, K_SHL, K_SHR, K_STRING, K_THEN, K_TO, K_TYPE, K_UNIT,
-         K_UNTIL, K_USES, K_VAR, K_WHILE, K_WITH, K_XOR, K_THEN, K_ELSE, 0};
-
-    dict->keywords = g_hash_table_new(g_str_hash, g_str_equal);
-    for (i = 0; keywords_str[i] != NULL; ++i) {
-        g_hash_table_insert(dict->keywords, (char *)(keywords_str[i]), GINT_TO_POINTER(keywords_tok[i]));
-    }
-}
-
-DictEntry *
-dictLookup(Dictionary * dict, const char *word)
-{
-    DictEntry      *entry;
-    char *upper;
-    int i;
-
-    upper = g_strdup(word);
-    for (i=0; upper[i]!='\0'; ++i)
-        upper[i] = toupper(upper[i]);
-    entry = g_hash_table_lookup(dict->locals, upper);
-    if (entry==NULL)
-        entry = g_hash_table_lookup(dict->table, upper);
-    else
-        printf("Local variable!\n");
-    g_free(upper);
-    return entry;
-}
-
-int
-keywordLookup(Dictionary *dict, const char *word)
-{
-    char *upper;
-    int i;
-    gpointer p;
-
-    upper = g_strdup(word);
-    for (i=0; upper[i]!='\0'; ++i)
-        upper[i] = toupper(upper[i]);
-    p = g_hash_table_lookup(dict->keywords, upper); 
-    g_free(upper);
-    if (p!=NULL)
-        return GPOINTER_TO_INT(p);
-    else
-        return 0;
-}
--- a/dict.h	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/* Slownik i tablice symboli. */
-
-#ifndef DICT_H
-#define DICT_H
-
-struct Dictionary {
-    GHashTable     *locals;
-    GHashTable     *table;
-    GHashTable     *keywords;
-    /* Tu trzeba dodac rozne zakresy i inne takie. */
-};
-typedef struct Dictionary Dictionary;
-
-struct DictEntry {
-    char           *string;                                /* Do jakiego stringa to ma byc hashowane. */
-    int             token;                                 /* Rodzaj tokena do zwrocenia. */
-    /* ... XXX tu musi byc wiecej jeszcze */
-};
-typedef struct DictEntry DictEntry;
-
-/* Szukanie symbolu w slowniku. */
-DictEntry      *dictLookup(Dictionary * dict, const char *word);
-
-/* Wprowadzenie slow kluczowych. */
-void            keywordsInit(Dictionary * dict);
-
-/* Dodanie symbolu do slownika. */
-void            dictAdd(Dictionary * dict, DictEntry * entry);
-void            dictAddLocal(Dictionary * dict, DictEntry * entry);
-
-/* Wyszukiwanie slow kluczowych. */
-int             keywordLookup(Dictionary * dict, const char *word);
-
-/* Utworzenie nowego slownika. */
-Dictionary     *newDictionary();
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/braki.txt	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,78 @@
+Czego brakuje
+=============
+
+Parser obsługuje składnie Turbo Pascala w wersji 4.0 z pewnymi
+zastrzeżeniami:
+
+Tak już zostanie (czego brakuje ale nie da się łątwo zrobić):
+
+- Dodano częściową obsługę wyrażeń stałych z Turba Pascala 5.0 -- tylko
+  dla najprostrzych wyrażeń;
+- Brak obsługi wstawek w assemblerze (ASM...END) i procedur i funkcji
+  pisanych w assemblerze;
+- Brak obsługi dla zmiennych zdefiniowanych w konkretnym miejscu pamięci;
+- Brak obsługi procedur typu INTERRUPT;
+- Brak typów proceduralnych -- pojawiły sie w TP 5.0;
+- Komentarze nie są formatowane;
+- Wszelkiego rodzaju stałe nie są formatowane -- pozostawiane są w formie
+  w jakiej zostały zapisane (być może nawet niepoprawnej);
+- Procedury i funkcje wewnątrz procedur i funkcji -- jest to trywialne z
+  gramatycznego punktu widzenia, ale może bardzo skomplikować analizę
+  kodu. Własność do rozważenia;
+
+Do poprawienia (co trzeba zrobić):
+
+- Automatyczne wczytywanie symboli z unitu SYSTEM;
+- Obsługa unitów (wczytywanie z nich symboli);
+- Dodanie symboli ze standardowych unitów;
+- Nie jest sprawdzana zgodność typów, ani nawet ilość parametrów w
+  wywołaniach funkcji i procedur;
+- Nie jest sparwdzana zgodność typów stałych;
+zrobione - Nie ma interface-u;
+zrobione - Kod jest wczytywany ze standardowego wejścia -- nie ma obsługi plików;
+zrobione - Gramatyka zawiera jeden (niegroźny) konflikt -- przy parsowaniu
+  nawiasów;
+- Nie są liczone żadne metryki;
+zrobione - Zapisywanie sformatowanego kodu do pliku;
+- Przewijanie ekranu nie jest zwiazane z kursorem -- mozna nim wyjechac poza ekran.
+- W linii statusu nie sa wyswietlane informacje o wszystkich rodzajach wezlow.
+- Stale rekordowe nie sa poprawnie parsowane -- wymaga kontroli typow. (gramatyka
+  staje sie kontekstowa).
+
+Do zrobienia (możnaby to zrobić, ale chyba nie zdążę, do zrobiena na PRP2):
+
+zrobione - Wyświetlenie kolorowanego kodu;
+zarzucone - Wyświetlenie drzewa parsowania z boku ekranu, a la explorer;
+- Zmiana nazwy danego symbolu we wszystkich miejscach w kodzie;
+- Edycja i dodawanie komentarzy;
+- Informowanie o nieużywanych symbolach;
+- Przesuwanie fragmentów kodu;
+- Sprawdzenie miejsc użycia symboli i sugerowanie zdefiniowania ich
+  lokalnie;
+- Sprawdzanie czytania i modyfikowania zmiennych przez polecenia;
+- Zmiana kolejności poleceń i definicji symboli bez zmiany działania
+  programu;
+- Konfiguracja zapisywana do pliku;
+- Sortowanie alfabetyczne definicji symboli;
+- Losowe przemieszczanie poleceń bez zmiany działania programu;
+- Zmiana nazw symboli na losowe;
+- Zapisanie całego programu w jednej linii, z losową wielkością liter w
+  słowach kluczowych;
+- Wyświetlenie grafu wywołań funkcji i procedur (bez cykli, specjalnie
+  oznaczone);
+- Automatyczne dodanie komentarzy;
+- Bardziej zaawansowane metryki programistyczne;
+- Eliminacja instrukcji WITH;
+- Sugerowanie wstawienia instrukcji WITH;
+- Formatowanie komentarzy;
+- Informowanie o niewykonywanych fragmentach kodu;
+- Sprawdzanie zakresów wartości przyjmowanych przez wyrażenia;
+- Sugerowanie zmiany pętli WHILE na REPEAT i odwrotnie;
+- Nazywanie symboli zgodnie z różnymi konwencjami (czeska, słowacka,
+  czechosłowacka, etc.);
+- System menu do wybierania plików do zapisu i odczytu;
+- Szacowanie złożoności fragmentów programu (tylko n^a, po prostu liczenie
+  stopnia zagnieżdżenia pętli);
+- Wyszukiwanie pewnych predefinowancyh fragmentów kodu i proponowanie
+  zamiany ich na równoważne ale bardziej poządane (schematy wczytywane z
+  oddzielnego pliku);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/manual.txt	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,39 @@
+
+Pasana -- podrecznik uzytkownika.
+=================================
+
+1. Uruchamianie.
+----------------
+
+Program uruchamiamy, podajac mu jako pierwszy parametr nazwe pliku, ktory
+chcemy analizowac. Jesli plik nie znajduje sie w aktualnym katalogu, musimy
+podac do niego sciezke.
+
+Uruchomienie programu bez parametrow wyswietli krotka informacje o nim.
+
+2. Dzialanie.
+-------------
+
+Pasana parsuje podany plik z kodem zrodlowym, przeksztalca go na odpowiednie
+drzewo, a nastepnie wsyweitla je na ekranie ponownie w postaci kodu -- ale
+juz sformatowanego i pokolorowanego.
+Po zakonczeniu dzialania programu, sformatowany kod wypisywany jest do pliku
+'output.pas`.
+
+3. Obsluga.
+-----------
+
+W trakcie wysweitlania kodu mozemy uzyc nastepujacych klawiszy:
+
+strzalki -- wybieranie wezla drzewa (czyli elementu naszego programu). Nie wszystkie
+	wezly da sie wybrac -- kursor zatrzymuje sie tylko na najistotniejszych.
+pgup, pgdn -- przewijanie kodu programu o pol strony w gore i w dol.
+inne klawisze -- wyjscie z programu.
+
+4. Bledy.
+---------
+
+Program nie nadaje sie na walidator (w obecnym stadium) i nie `zauwaza' wielu bledow
+w kodzie. Jednak zauwazy bledy skladni -- wowczas wyswietla wlasciwy komentarz. Pierwsza
+linia to wygenerowany przez bison-a komunikat o bledzie, druga to dodana informacja
+o jego umiejscowieniu.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/node.txt	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,178 @@
+Wewnętrzna truktura drzewa parsowania
+=====================================
+
+
+Węzły
+-----
+
+Możliwych jest kilka podejść. Najbardziej bezpośrednim byłoby
+zdefiniowanie oddzielnej struktury danych dla każdej z produkcji gramatyki
+i przypisywanie symbolom powstałym z takiej produkcji takiej właśnie
+struktury danych jako wartość. Nie trzeba chyba wyjaśniać, że takie
+podejście jest bardzo uciążliwe dla człowieka.
+
+Dlatego też wybrałem początkowo inne podejście -- struktury danych
+tworzone są tylko dla niektórych symboli nieterminalnych, a mianowicie
+tych, które reprezentują pewne obiekty w sensie struktury programu, jak
+typy, zmienne, procedury, funkcje, polecenia, wyrażenia i tym podobne.
+Nadal jednak każde z nich miało swoją oddzielną strukturę danych.
+
+Ostatecznie zrezygnowałem z takiego rozdziału. Podzieliłem zbiór
+wszystkich rodzajów węzłów na podzbiory o podobnych własnościach i dla
+każdego z tych podzbiorów zdefiniowałem strukturę danych. Dodatkowe pole
+informuje o dokładnym rodzaju danego węzła.
+
+I tak otrzymałem 3 kategorie węzłow:
+
+1) Symbole -- czyli wszelkie obiekty posiadające nazwę, takie jak: typy,
+zmienne, stałe nazwane, pola rekordów, procedury, funkcje, unity, oraz sam
+program. Nie wszystkie jednak symbole koniecznie muszą mieć jakąś nazwę --
+dotyczy to głównie typów oraz niektórych zmiennych.
+
+2) Polecenia -- czyli pojedyńcze rozkazy programu, takie jak: blok,
+instrukcja skoku, instrukcja warunkowa, pętle, przypisanie, instrukcja
+wiążąca, instrukcja wyboru.
+
+3) Wyrażenia -- czyli wszystko to, co można do czegoś przypisać, co ma
+jakąś wartość, na przykład: stałe, odwołania do zmiennych i stałych
+nazwanych, wywołanie funkcji, operatory binarne, operatory unarne, etc.
+
+Pole mówiące o rodzaju węzła występuje zawsze jako pierwsze i jest zawsze
+tego samego typu -- tak aby używając rzutowania na którąkolwiek z
+kategorii węzłów wskaźnika void* można było poznać właściwą kategorię.
+
+Krawędzie
+---------
+
+Połączenia pomiędzy węzłami to po prostu wskaźniki umieszczone jako pola w
+odpowiednich strukturach danych. Ich znaczenie zależy częściowo od
+kategorii i rodzaju węzła, choć są także `uniwersalne', takie jak pola na
+komentarze.
+
+Informacja o połączeniach w drugą stronę -- to znaczy informacja o przodku
+danego węzła -- jest znacznie prostrza do przechowania i zależy tylko od
+kaztegorii węzła.
+
+1) Symbole -- mogą być potomkami wyłącznie innych symboli. Wobec tego ich
+pole `parent' jest wskaźnikiem na symbol.
+
+2) Polecenia -- mogą być potomkami inncyh poleceń (jak w instrukcji
+warunkowej lub blokowej). Jedyny przypadek gdy tak nie jest dotyczy
+instrukcji blokowej (BEGIN...END) i jest traktowany jako przypadek
+szczególny. Jeśli pole parent takiej instrukcji jest równe NULL, to
+rodzicem takiego węzła jest jakiś symbol, zapisany np. w polu symbol.
+
+3) Wyrażenia -- tutaj jest duży problem. Wyrażenia mogą wystąpić jako
+części składowe większych wyrażeń, jako parametry poleceń, a także w
+definicjach stałych nazwanych i typów.
+Ze względu na dość duży stopień komplikacji, jak i raczej niewielkie
+możliwości zastosowania, wyrażenia nie będą prawdopodobnie znały swoich
+przodków.
+
+
+Symbole
+-------
+
+SymbolNode
+	kind		Zmienna wyliczeniowa, opisuje dokładny rodzaj
+			węzła.
+			
+	name	 	Nazwa danego symbolu (z zachowaniem pierwszy raz
+			napotkanej wielkości liter).
+			
+	namespace	Tablica symboli-dzieci (zarówno w postaci tablicy
+			hashującej jak i listy dla zachowania kolejności).
+			Ma wartość NULL dla symboli nie mogących mieć
+			dzieci (bezpłodne?).  Symbole na liście mogą się
+			powtarzać. Wówczas pierwsze wystąpienie oznacza
+			tylko deklarację, a następne oznacza definicję.
+			
+	parent		Wskaźnik na bezpośredniego przodka w drzewie. Ma
+			wartość NULL dla korzenia.  Wskazuje w którym
+			miejscu symbol został zadeklarowany.
+			
+	body		Wskaźnik na węzeł instrukcji blokowej stanowiącej
+			ciało danego programu, procedury lub funkcji.
+			Także rozkaz przy którym znajduje się dana
+			etykieta. Ma wartość NULL dla pozostałych rodzajów
+			symboli.
+
+	type		Wskaźnik na symbol, w domyśle opisujący typ danego
+			węzła lub jego typ bazowy (dla innych typów). Dla
+			symboli nie mających typu ma wartość NULL.
+
+	used		Lista wskaźników do węzłów w których używany jest
+			ten symbol. Dla programu jest to lista nazw
+			podanych po nazwie.
+
+Polecenia
+---------
+
+StmtNode
+	kind		Zmienna wyliczeniowa, opisuje dokładny rodzaj
+			węzła.
+			
+	parent		Wskaźnik do instrukcji blokowej w której jest to
+			polecenie zawarte. Dla instrukcji blokowej będącej
+			ciałem programu, funkcji lub procedury -- ma
+			wartość NULL.
+	
+	label		Jeśli polecenie jest zaetykietowane jest to
+			wskaźnik do etykiety.  W przeciwnym wypadku NULL.
+
+	list		Dla instrukcji blokowej i pętli REPEAT -- lista
+			poleceń zawartych wewnątrz. Dla wywołania
+			procedury lista parametrów aktualnych. Dla
+			instrukcji wyboru -- lista wariantów CASE. Dla
+			instrukcji WITH -- lista zmiennych rekordowych.
+			Dla pozostałych węzłów NULL.
+	
+	stmt1		Dla pętli WHILE, instrukcji WITH i FOR oraz
+			wariantów CASE jest to wskaźnik do zawartego w
+			nich polecenia. Dla instrukcji warunkowej --
+			polecenia zaraz po THEN. Dla pozostałych węzłow
+			NULL.
+
+	stmt2		Dla instrukcji warunkowej -- polecenie po ELSE.
+			Dla pozostałych węzłów NULL.
+	
+	symbol		Dla instrukcji blokowej -- symbol której jest ona
+			ciałem. Dla instrukcji przypisania -- zmienna do
+			której następuje przypisanie. Dla instrukcji skoku
+			-- etykieta do której nalezy wykonać skok. Dla
+			instrukcji FOR -- licznik pętli.  Dla pozostałych
+			węzłów NULL.
+	
+	expr1		Dla instrukcji przypisania -- wyrażenie które
+			należy przypisać. Dla pętli REPEAT i WHILE --
+			warunek końca (kontynuacji) pętli. Dla pętli FOR
+			-- wartość początkowa licznika. Dla instrukcji
+			wyboru i instrukcji warunkowej -- wyrażenie
+			przełączające. Dla wariantów CASE -- wyrażenie
+			przy którym dany wariant ma zastosowanie. Dla
+			pozostałych NULL.
+	
+	expr2		Dla pętli FOR -- wartość końcowa licznika. Dla
+			pozostałych wartości NULL.
+
+Wyrażenia
+---------
+
+ExprNode
+	kind		Zmienna wyliczeniowa, opisuje dokładny rodzaj
+			węzła.
+
+	list		Dla wywołania funkcji -- lista parametrów
+			formalnych.
+	
+	expr1		Dla operatorów binarnych i unarnych -- wartość na
+			jakiej działają.
+	
+	expr2		Dla operatorów binarnych -- druga wartość na
+			jakiej działa.
+
+	symbol		Dla wywołań zmiennych i funkcji -- dana zmienna
+			lub funkcja. Dla operatora @ -- symbol którego
+			adres zwraca.
+	
+	value		Dla stałych -- właściwa wartość danej stałej.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/pliki.txt	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,76 @@
+Spis plików wraz z przeznaczeniem
+=================================
+
+
+Makefile
+--------
+
+Plik z instrukcjami dla programu make dotyczącymi kompilowania całego
+programu.
+
+
+main.c
+------
+
+Główna procedura programu. Na razie tylko wywołuje parser dla podanego
+pliku.
+
+
+keywords.c, keywords.h
+----------------------
+
+Statyczna tablica słów kluczowych, obsługa wyszukiwania słów kluczowych.
+
+
+parser.c, parser.h
+------------------
+
+Definicja i procedury tworzące i niszczące objekt parsera.
+
+
+pascal.l
+--------
+
+Skaner leksykalny do turbo pascala, napisany w lex'ie (flex'ie).
+Pierwotna wersja skanera, napisana bezpośrednio w C była zbyt
+skomplikowana i trudna do debugowania. Lex automatycznie generuje z tego
+plik źródłowy skanera.
+
+
+pascal.y
+--------
+
+Serce całego programu -- definicja gramatyki turbo pascala, wraz z akcjami
+jakie mają być podjęte przy stosowaniu poszczególnych produkcji.  Powstał
+z pliku tp4.y dołączonego jako przykład do pascalowej wersji Yacc'a. Bison
+generuje z tego pliki źródłowe parsera `pascal.tab.c' i `pascal.tab.h'.
+
+
+symbols.c, symbols.h
+--------------------
+
+Definicje i procedury do obsługi przestrzeni nazw (`namespace'), albo
+inaczej -- tablic symboli.
+
+
+utils.c, utils.h
+----------------
+
+Pomocnicze procedury używane przez `pascal.y' oraz `pascal.l', takie jak
+dodawanie i wyszukiwanie symboli zgodnie z właściwymi regułami, zmienianie
+przestrzenii nazw, etc.
+
+
+node.c. node.h
+--------------
+
+Definicje, konstruktory i destruktory do poszczególnych rodzajów
+wierzchołków drzewa parsowania.
+
+
+showtree.c, showtree.h
+----------------------
+
+Procedury do wyświetlania informacji o poszczególnych rodzajach
+wierzchołków.
+do przestrzeni nazw, wyszukiwanie
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/skaner.txt	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,108 @@
+Opis skanera leksykalnego dla Turbo Pascala
+===========================================
+
+
+Streszczenie
+------------
+
+Jest to opis skanera leksykalnego zawartego w pliku `pascal.l'.  Skaner
+leksykalny zajmuje się podziałem tekstu źródłowego na `tokeny' oraz
+rozpoznawaniem ich typów.  Ze względu na charakter gramatyki języka Turbo
+Pascal, ten skaner leksykalny dokonuje także wyszukiwania symboli w
+tablicach -- aby dostarczyć parserowi dodatkowe, niezbędne mu informacje.
+
+
+Format
+------
+
+Skaner jest napisany w formacie obsługiwanym przez program `lex',
+konkretnie przez jego implementację o nazwie `flex' (fast lex).  Właściwy
+kod źródłowy skanera jest generowany w sposób automatyczny przez ten
+program i umieszczany w pliku `lex.yy.c'.  Dokładny opis formatu znajduje
+się na stronie manuala flex'a, oraz na stronie info.
+
+
+Wyrażenia
+---------
+
+Właściwie treścią tego pliku jest lista wyrażeń regularnych, z
+odpowiadającymi im akcjami.  Wyrażenia regularne opisują poszczególne
+elementy języka, takie jak:
+
+- identyfikatory i słowa kluczowe;
+- stałe liczbowe całkowite;
+- stałe liczbowe zmiennoprzecinkowe;
+- stałe liczbowe szesnastkowe;
+- stałe znakowe;
+- stałe tekstowe;
+- komentarze blokowe;
+- komentarze w kodzie;
+- operatory wieloznakowe, takie jak `:=', `>=', `..', czy `(.';
+- pojedyńcze symbole;
+
+
+Identyfikatory i słowa kluczowe
+-------------------------------
+
+Zarówno identyfikatory, jak i słowa kluczowe trafiają do tej samej
+procedury, w której są następnie rozpoznawane.  W pierwszej kolejności
+sprawdzane jest, czy nie jest to słowo kluczowe -- w tym celu przeglądana
+jest tablica słów kluczowych.  Jeśli słowo zostaje znalezione, to zwracany
+jest jego numer.  W przeciwnym wypadku następuje wyszukiwanie w tablicy
+symboli -- sposób wyszukiwania zależy od stanu parsera.  Możliwe są dwa
+przypadki:
+
+1) Przeszukiwana jest aktualna tablica symboli, jeśli symbol nie został
+odnaleziony, przeszukiwana jest następna na stosie. Kiedy zostanie
+osiągniety koniec stosu a symbol nie został odnaleziony, zwracany jest
+token `ID_NAME' oznaczający identyfikator bez nadanego jeszcze znaczenia.
+
+2) Jeśli zmienna parsera `levelup' jest wyzerowana, to sprawdzana jest
+tylko tablica symboli na wierzchołku stosu.  Dzieje się tak, na przykład,
+przy definicji nowej zmiennej lokalnej o nazwie takiej, jak już istniejąca
+zmienna globalna.  Skaner zwróci wówczas `ID_NAME', czyli nazwę do
+wykorzystania, a nie odleziony symbol zmiennej globalnej.
+
+
+Stałe
+-----
+
+Stałe rozpoznawane są zgodnie z definicją języka Turbo Poscal, przy czym
+ich wartość zapamiętywana jest jako tekst -- aby nie tracić dodatkowego
+znaczenia jakie może mieć sposób zapisu stałej dla programisty.  Jest to
+wygodne i dopuszczalne, gdyż wartości stałych nie są do niczego w
+programie uzywane -- poza ich zapamiętaniem.
+
+
+Komentarze
+----------
+
+Skaner leksykalny rozpoznaje dwa rodzaje komentarzy, które traktuje na
+różne sposoby.  Są to:
+
+1) Komentarze blokowe -- czyli komentarze występujące samodzielnie w danej
+linii.  Ich przeznaczeniem są opisy funkcji, procedur, zastosowanych
+algorytmów, a także różnego rodzaju pomocnicze uwagi.  Wykomentowany kod
+źródłowy także wpada do tej kategorii.
+
+2) Komentarze w kodzie -- są to komentarze występujące w tej samej linii
+co kod (na końcu linii).  Ich przeznaczeniem jest opisywanie zmiennych,
+krótkie komentarze dotyczące kodu, krótkie uwagi.
+
+Dla parsera komentarze są ignorowane -- nie dostaje on o nich żadnej
+informacji.  Natomiast w momencie, kiedy tworzony jest nowy węzeł drzewa
+parsowania, może on otrzymać jeden lub oba z typów komentarzy.
+
+Podobnie jak stałe, komentarze są przechowywane w postaci dosłownego
+tekstu.  Ewentualne reformatowanie komentarzy może nastąpić w dalszej
+części programu, choć istnieje niebezpieczeństwo zniszczenia takich
+konstrukcji jak tabelki, wyliczenia, itp.  Idealne byłyby komentarze w
+XML-u, tak jak w C# :).
+
+Wieloliterowe operatory
+-----------------------
+
+Gramatyka Turbo Pascala zawiera kilka symboli składających się z kilku
+znaków, a także alternatywne sposobu zapisu nawiasów kwadratowych `[]' i
+klamrowych `{}'.  O ile te ostatnie obsługiwane są w części dotyczącej
+komentarzy, o tyle pozostałe muszą zostać uwzględnione oddzielnie.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/squares.txt	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,170 @@
+Algorithms for finding largest free squares
+===========================================
+
+
+Abstract
+--------
+
+This article present several algorithms for finding the largest free
+(UN-obstructed) rectangle on two dimensional map.
+The algorithms are quite efficient, but I think you can improve them
+further.
+
+
+1. rectangle with given starting point
+--------------------------------------
+
+This algorithm checks all the rectangles with it's upper-left corner at
+given point, and picks the largest one.
+
+A rectangle can be represented by two pairs of coordinates: it's upper-left
+corner, called `starting point' from now on, and it's lower-right corner,
+called `end point'.  We will need a structure to keep information on
+squares. We will put there the starting coordinates (sx, sy), the end
+coordinates (ex, ey), and the flags used in the algorithm.
+For starts, let's use two flags: BLOCKED_RIGHT and BLOCKED_DOWN.
+
+Let's create a `one-point' rectangle, with starting and end
+coordinates being equal and both flags cleared.
+
+Let's push it on the stack, set the answer temporarily to this rectangle
+and repeat:
+
+- Pop a rectangle from stack.
+- If BLOCKED_RIGHT flag is clear, check the points immediately right from
+  the rectangle. Check the points from top to bottom. 
+	- If there is point that's not free, and it's not the topmost point, create
+	  new rectangle with the same starting point, but with end point being the
+	  last free point. Set it's BLOCKED_DOWN flag and push it on stack.
+	- If there is point that's not free, set the BLOCKED_RIGHT flag.
+	- If all points are free -- expand our rectangle by one right (increase
+	  the x coordinate of it's end point).
+- else if BLOCKED_DOWN flag is clear, check the points immediately down from
+  the rectangle. Check the points from left to right.
+	- If there is point that's not free, and it's not the leftmost point, create
+	  new rectangle with the same starting point, but with end point being the
+	  last free point. Set it's BLOCKED_RIGHT flag and push it on stack.
+	- If there is point that's not free, set the BLOCKED_DOWN flag.
+	- If all points are free -- expand our rectangle by one down (increase
+	  the y coordinate of it's end point).
+- else if both flags are set, count the rectangle's size, compare it with size of
+  rectangle in temporary answer.  If it's larger, replace the answer with
+  our rectangle.
+- If at least one flag is clear, push the rectangle back on stack.
+
+You can add a loop to get rid of unnecessary stack pushes and pops when at
+least one flag is clear.
+You finish when the stack is empty. The temporary answer contains the
+largest free rectangle with it's upper-left corner in given point.
+
+
+
+2. rectangle containing specified point
+---------------------------------------
+
+You can slightly modify this algorithm to search for the largest rectangle
+containing given point.
+
+First, we will need two more flags, BLOCKED_UP and BLOCKED_LEFT, together
+with corresponding parts of code:
+
+Let's create a `one-point' rectangle, with starting and end
+coordinates being equal and all the flags cleared.
+
+Let's push it on the stack, set the answer temporarily to this rectangle
+and repeat:
+
+- Pop a rectangle from stack.
+- If BLOCKED_RIGHT flag is clear, check the points immediately right from
+  the rectangle. Check the points from top to bottom. 
+	- If there is point that's not free, and it's not the topmost point, create
+	  new rectangle with the same starting point, but with end point being the
+	  last free point. Set it's BLOCKED_DOWN flag and push it on stack.
+	- If there is point that's not free, set the BLOCKED_RIGHT flag.
+	- If all points are free -- expand our rectangle by one right (increase
+	  the x coordinate of it's end point).
+- else if BLOCKED_DOWN flag is clear, check the points immediately down from
+  the rectangle. Check the points from left to right.
+	- If there is point that's not free, and it's not the leftmost point, create
+	  new rectangle with the same starting point, but with end point being the
+	  last free point. Set it's BLOCKED_RIGHT flag and push it on stack.
+	- If there is point that's not free, set the BLOCKED_DOWN flag.
+	- If all points are free -- expand our rectangle by one down (increase
+	  the y coordinate of it's end point).
+- else if BLOCKED_LEFT flag is clear, check the points immediately left from
+  the rectangle. Check the points from top to bottom.
+	- If there is point that's not free, and it's not the topmost point, create
+	  new rectangle with the starting point being the one above the
+	  obstructed point, at height of our given point, and with end
+	  above our rectangle's end point, at height one above the
+	  obstructed point. Set it's BLOCKED_DOWN flag and push it on stack.
+	- If there is point that's not free, set the BLOCKED_LEFT flag.
+	- If all points are free -- expand our rectangle by one left (decrease
+	  the x coordinate of it's start point).
+- else if BLOCKED_UP flag is clear, check the points immediately up from
+  the rectangle. Check the points in two passes, every time beginning
+  above our given point and moving left and right.
+	- If there is point that's not free, and it's not the first point
+	  (the one above our given point), create new rectangle.
+	  It's left boundary should be immediately to the right of first
+	  not free point in right-to-left pass, and it's left boundary
+	  should be immediately to the left of first not free point in
+	  the left-to-right pass. It's top boundary should be one above
+	  our rectangle's boundary, and it's bottom boundary is the same
+	  as our rectangle's. Set it's BLOCKED_RIGHT if there was not-free
+	  point in left-to-right pass, and the BLOCKED_LEFT if there was a
+	  not free point in right-to-left pass. Push it on stack.
+	- If there is point that's not free, set the BLOCKED_UP flag.
+	- If all points are free -- expand our rectangle by one up (decrease
+	  the y coordinate of it's start point).
+- else if both flags are set, count the rectangle's size, compare it with size of
+  rectangle in temporary answer.  If it's larger, replace the answer with
+  our rectangle.
+- If at least one flag is clear, push the rectangle back on stack.
+
+The BLOCKED_UP part is most complicated, because on this stage our
+rectangles are on both sides of our given point.
+
+The BLOCKED_LEFT and BLOCKED_UP parts may examine rectangles that are
+contained in other, separately checked ones.  But I think avoiding it is a
+bit tedious.
+
+
+3. largest rectangle on whole map
+---------------------------------
+
+This is a bit complicated. You can use the first algorithm to check all
+the starting points. But it's a bit ineffective -- you check many points
+multiple times.  What we need is a way of marking the points that the
+largest rectangle cannot start at.
+
+How to recognize those points?
+Every time a rectangle hits an obstacle, you need to find the obstacle
+ends. That is, in your check, when you find a not free point, go further
+and find the first free point. If there isn't one, assume it's the one
+after the last point you check. Remember this point.
+When the rectangle hits an obstacle in the other direction, find the
+second point.
+
+Now you can mark all the points in rectangle, which upper-left corner is
+the starting point of our rectangles and it's lower-left and upper-right
+corners are the two points you found. Any rectangle starting in these
+points is smaller than the one you just considered.
+
+Now skip all the marked points when iterating through map.
+
+
+Notes
+-----
+
+You can use another rectangle-finding algorithm, one that would split
+rectangles into more than two copies, according to number of `holes' in
+obstacles. It would examine all rectangles in a flood-fill area containing
+the starting point.
+
+But I think it's too complicated.
+
+
+These algorithms seem to work correctly at the first glance, and I think I
+know hoe to mathematically prove their correctness. But I haven't
+implemented or tested any of them. Use on your own risk ^^))).
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/symbols.txt	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,73 @@
+Opis tablic symboli
+===================
+
+Wstęp
+-----
+
+W przypadku gramatyki Pascala wygodnie jest wyszukiwać symbole jeszcze przed
+przekazaniem ich do parsera.  Pozwala to na uniknięcie wieloznaczności (na
+przykład konstrukcja 'identyfikator(identyfikator)' może być zarówno
+wywołaniem funkcji, jak i rzutowaniem typu).  Jedynym problemem, który się
+pojawia, jest zasięg symboli loklnych.  Problem ów rozwiązano dzięki użyciu
+poleceń zmieniających lokalną przestrzeń nazw bezpośrednio w produkcjach
+parsera.
+
+Tablice
+-------
+
+Wszystkie symbole trzymane są w tablicach hashujących z biblioteki *glib*,
+czyli *GHashTable*.  Użyto także standardowych, dołączonych funkcji
+hashujących i porównujących.  Wszystkie nazwy symboli przechowywane są
+napisane wielkimi literami, gdyż wielkość liter ma być nierozróżniana.
+Dokładna, oryginalna nazwa symbolu przechowywana jest w strukturze go
+opisującej, wskazywanej przez odpowiedni element tej tablicy.
+
+Słowa kluczowe
+--------------
+
+Oprócz tablic symboli istnieje także tablica hashująca zawierająca słowa
+kluczowe.  Jest ona inicjowana wraz z parserem odpowiednimi stałymi zawartymi
+w programie -- parami string - numer słowa.  Każdy symbol jest najpierw
+wyszukiwany w tej tablicy -- dopiero gdy tam go nie ma, szuka się w tablicach
+symboli.  Dlatego słowa kluczowe nie mogą być NIGDY użyte jako
+identyfikataory.  Być może dałoby się to obejść, stosując techniki podobne do
+tych zastosowanych w przypadku zasięgów, ale na szczęście nie trzeba --
+specyfikacja Pascala tego nie przewiduje.
+
+Zasięg zmiennych
+----------------
+
+Poza główną, globalną tablicą symboli istnieją także tablice symboli związanie
+z konkretnymi symbolami (identyfikatorami funkcji, procedur, rekordów,
+unitów).  Są to tablice o zasięgu lokalnym.  Każda z nich ma wskaźnik do
+tablicy znajdującej się o poziom wyżej w drzewie (z wyjątkiem rekordów), tak,
+aby w razie nie znaleziena w niej symbolu można było kontynuować poszukiwanie
+na wyższym zakresie.  Tablica globalna jest korzeniem dla drzewa wszystkich
+symboli lokalnych, poza symbolami z unitów -- te znajdują się powyżej tablicy
+globalnej.  Korzeniem całego tego drzewa jest unit 'System'.  Tablice w
+rekordach nie mają rodzica -- gdyż w ich przypadku wyszukiwanie powinno być
+przeprowadzone wyłącznie pośród identyfikatorów pól danego rekordu.
+
+Przełączanie zasięgu
+--------------------
+
+Parser przełącza zasięg zmiennch zmieniając aktualną tablicę symboli, czyli
+tablicę, od której rozpoczyna się wyszukiwanie.  Dzieje się to w kilku
+miejscach:
+
+-- Na poczatku definicji i deklaracji funkcji i procedury;
+-- Na poczatku odwołania do zmiennej rekordowej;
+-- Po napotkaniu instrukcji 'with';
+-- Na poczatku odwołania do symbolu z konkrentego unitu;
+
+Następnie parser powraca do poprzedniej przestrzeni nazw, konkretnie robi to
+po napotkaniu:
+
+-- Konca definicji lub deklaracji funkcji lub procedury;
+-- Nazwy pola w odwolaniu do zmiennej rekordowej;
+-- Konca instrukcji 'with';
+-- Nazwy symbolu w odwolaniu do symbolu z unitu;
+
+Aby móc tego dokonać, parser musi trzymać stos zawirtający odnośniki do
+poszczególnych tablic symboli.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/tp4.y	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,613 @@
+
+/* Turbo Pascal 4.0 grammar (prototype) 5-1-91 AG
+
+   This is an "almost complete" TP Yacc grammar for Turbo Pascal Version
+   4.0. Although the grammar is incomplete, untested and I do not have a
+   lexical analyzer for it yet, I decided to include it in the distribution
+   for those of you who are planning to write a Turbo Pascal parser.
+
+   You will notice that this is not an adaption of the Standard Pascal
+   grammar in PAS.Y. Because of the many additional features in the
+   Turbo Pascal language I decided to write a new grammar from scratch.
+
+   Writing a Yacc grammar for Turbo Pascal is not as easy as it first
+   seems to be, because the special language features often defy easy
+   specification as an LALR(1) grammar. Taking the naive approach, you
+   are bound to get a lot of parsing conflicts in your grammar, since
+   some of the constructs just cannot be parsed unambigiously without
+   making use of semantic information.
+
+   One construct that causes trouble is the qualified identifier which,
+   in many contexts, can also be interpreted as a record component
+   designator. To fix this, I simply decided to treat both "ordinary" and
+   qualified identifiers as a single ID token. Of course this means that
+   the lexical analyzer will have to distinguish between ordinary and
+   qualified identifiers (this can be done with some semantic processing
+   to determine which identifiers are unit names).
+
+   There is still one ambiguity left in the grammar (causing one shift/
+   reduce conflict) which comes from type casts in variable designators.
+   The construct in question has the form:
+
+      ID ( variable )
+
+   In certain contexts, this can both be interpreted as a variable and
+   as a function or procedure call. At present, the generated parser
+   will parse such a construct as a variable. This will not be any
+   problem (at least I hope so) unless you actually do semantic processing
+   in your parser.
+
+   If you have any questions/comments/critizism concerning this grammar,
+   direct them to ag@muwiinfa.geschichte.uni-mainz.de. Perhaps someone
+   even extends the grammar towards Turbo Pascal 5.x/6.x (if you do, it
+   would be kind if you let me have a copy of this grammar such that I can
+   include it in the next distribution). */
+
+
+%start compilation_unit
+
+/* Lexical stuff: */
+
+%token
+
+/* The multiple character symbols below are used in the grammar for better
+   readability; identifier synonyms are given for use in the lexical analyzer.
+   These definitions must come before any other token definitions (note that
+   TP Yacc starts counting user-defined literals at 257). */
+
+'..' 257
+':=' 258
+'<=' 259
+'<>' 260
+'>=' 261
+
+%{
+
+const
+
+DOTDOT = 257;
+DEFEQ  = 258;
+LEQ    = 259;
+NEQ    = 260;
+GEQ    = 261;
+
+%}
+
+%token
+
+/* Keywords are stropped with underscores to prevent conflicts with Turbo
+   Pascal keywords. */
+
+_AND_		_ABSOLUTE_	_ARRAY_			_BEGIN_
+_CASE_		_CONST_		_DIV_			_DOWNTO_
+_DO_		_ELSE_		_END_			_EXTERNAL_
+_FILE_		_FORWARD_	_FOR_			_FUNCTION_
+_GOTO_		_IF_		_IMPLEMENTATION_ 	_INTERFACE_
+_IN_		_LABEL_		_MOD_			_NIL_
+_NOT_		_OF_		_OR_			_PACKED_
+_PROCEDURE_	_PROGRAM_	_RECORD_		_REPEAT_
+_SET_		_SHL_		_SHR_			_STRING_
+_THEN_		_TO_		_TYPE_			_UNIT_
+_UNTIL_		_USES_		_VAR_			_WHILE_
+_WITH_		_XOR_
+
+%right _THEN_ _ELSE_            /* resolve dangling else */
+
+%token
+
+ID
+UNSIGNED_INTEGER
+UNSIGNED_REAL
+STRING_CONST
+
+%%
+
+compilation_unit
+	: program
+        | unit
+        ;
+
+/* Programs: */
+
+program	: program_heading uses_clause block '.'
+	;
+
+program_heading
+	: /* empty */
+        | _PROGRAM_ ID ';'
+        | _PROGRAM_ ID '(' id_list ')' ';'
+	;
+
+uses_clause
+	: /* empty */
+        | _USES_ id_list ';'
+        ;
+
+id_list	: ID
+	| id_list ',' ID
+        ;
+
+block	: decl_sect_list compound_stmt
+	;
+
+/* Units: */
+
+unit	: unit_heading interface_part implementation_part
+	  initialization_part '.'
+	;
+
+unit_heading
+	: _UNIT_ ID ';'
+	;
+
+interface_part
+	: _INTERFACE_ uses_clause int_decl_sect_list
+        ;
+
+implementation_part
+	: _IMPLEMENTATION_ decl_sect_list
+        ;
+
+initialization_part
+	: compound_stmt
+        | _END_
+        ;
+
+/* Declaration sections: */
+
+decl_sect_list
+	: /* empty */
+        | decl_sect_list decl_sect
+        ;
+
+decl_sect
+	: label_decl_sect
+	| const_decl_sect
+	| type_decl_sect
+	| var_decl_sect
+	| proc_decl
+	| func_decl
+	;
+
+label_decl_sect
+	: _LABEL_ label_list ';'
+	;
+
+label_list
+	: label
+        | label_list ',' label
+        ;
+
+label	: UNSIGNED_INTEGER
+		/* must be decimal integer in the range 0..9999 */
+	| ID
+        ;
+
+const_decl_sect
+	: _CONST_ const_decl
+	| const_decl_sect const_decl
+	;
+
+type_decl_sect
+	: _TYPE_ type_decl
+	| type_decl_sect type_decl
+	;
+
+var_decl_sect
+	: _VAR_ var_decl
+	| var_decl_sect var_decl
+	;
+
+/* Interface declaration sections: */
+
+/* These appear instead of normal declaration sections in the interface
+   part of a unit. The difference is that there are no label declarations
+   and for procedures and functions only the headings are given. */
+
+int_decl_sect_list
+	: /* empty */
+	| int_decl_sect_list int_decl_sect
+	;
+
+int_decl_sect
+	: const_decl_sect
+	| type_decl_sect
+	| var_decl_sect
+	| proc_heading
+	| func_heading
+	;
+
+/* Constant declarations: */
+
+const_decl
+	: ID '=' const ';'
+        | ID ':' type '=' typed_const ';'
+        ;
+
+const	: unsigned_number
+	| sign unsigned_number
+        | ID
+        | sign ID
+        | STRING_CONST
+	;
+
+unsigned_number
+	: UNSIGNED_INTEGER
+        | UNSIGNED_REAL
+        ;
+
+sign	: '+' | '-'
+	;
+
+typed_const
+	: const
+	| array_const
+	| record_const
+        | set_const
+	;
+
+array_const
+	: '(' typed_const_list ')'
+	;
+
+typed_const_list
+	: typed_const
+	| typed_const_list ',' typed_const
+	;
+
+record_const
+	: '(' const_field_list ')'
+	;
+
+const_field_list
+	: const_field
+	| const_field_list ',' const_field
+	;
+
+const_field
+	: ID ':' typed_const
+	;
+
+set_const
+	: '[' const_elem_list ']'
+        ;
+
+const_elem_list
+	: /* empty */
+        | const_elem_list1
+        ;
+
+const_elem_list1
+	: const_elem
+	| const_elem_list1 ',' const_elem
+	;
+
+const_elem
+	: const
+	| const '..' const
+	;
+
+/* Type declarations: */
+
+type_decl
+	: ID '=' type ';'
+	;
+
+type	: simple_type
+	| pointer_type
+        | structured_type
+        | string_type
+        ;
+
+simple_type
+	: ID
+	| const '..' const	/* subrange */
+	| '(' id_list ')'	/* enumeration */
+	;
+
+pointer_type
+	: '^' ID
+	;
+
+structured_type
+	: unpacked_structured_type
+        | _PACKED_ unpacked_structured_type
+        ;
+
+unpacked_structured_type
+	: array_type
+	| record_type
+	| set_type
+	| file_type
+	;
+
+array_type
+	: _ARRAY_ '[' simple_type_list ']' _OF_ type
+	;
+
+simple_type_list
+	: simple_type
+	| simple_type_list ',' simple_type
+	;
+
+record_type
+	: _RECORD_ field_list _END_
+	;
+
+field_list
+	: fixed_part
+	| variant_part
+	| fixed_part ';' variant_part
+	;
+
+fixed_part
+	: record_section
+	| fixed_part ';' record_section
+	;
+
+record_section
+	: /* empty */
+	| id_list ':' type
+	;
+
+variant_part
+	: _CASE_ tag_field _OF_ variant_list
+	;
+
+tag_field
+	: ID
+	| ID ':' ID
+	;
+
+variant_list
+	: variant
+	| variant_list ';' variant
+	;
+
+variant	: /* empty */
+	| case_tag_list ':' '(' field_list ')'
+	;
+
+case_tag_list
+	: const
+        | case_tag_list ',' const
+        ;
+
+set_type
+	: _SET_ _OF_ simple_type
+	;
+
+file_type
+	: _FILE_ _OF_ type
+	| _FILE_
+	;
+
+string_type
+	: _STRING_
+	| _STRING_ '[' const ']'
+	;
+
+/* Variable declarations: */
+
+var_decl
+	: id_list ':' type absolute_clause ';'
+	;
+
+absolute_clause
+	: /* empty */
+        | _ABSOLUTE_ UNSIGNED_INTEGER ':' UNSIGNED_INTEGER
+        | _ABSOLUTE_ ID
+        ;
+
+/* Procedure and function declarations: */
+
+proc_decl
+	: proc_heading proc_block ';'
+	;
+
+func_decl
+	: func_heading proc_block ';'
+	;
+
+proc_heading
+	: _PROCEDURE_ ID fp_list ';'
+	;
+
+func_heading
+	: _FUNCTION_ ID fp_list ':' fptype ';'
+	;
+
+proc_block         	/* omitted inline and interrupt */
+	: block
+	| _EXTERNAL_
+	| _FORWARD_
+	;
+
+fp_list : /* empty */
+	| '(' fp_sect_list ')'
+	;
+
+fp_sect_list
+	: fp_sect
+	| fp_sect_list ';' fp_sect
+	;
+
+fp_sect	: id_list ':' fptype
+	| _VAR_ id_list ':' fptype
+	| _VAR_ id_list
+	;
+
+fptype	: ID
+	| _STRING_
+	;
+
+/* Statements: */
+
+stmt	: unlabelled_stmt
+	| label ':' unlabelled_stmt
+        ;
+
+unlabelled_stmt
+	: /* empty */
+	| assignment
+	| proc_call
+	| goto_stmt
+	| compound_stmt
+	| if_stmt
+	| case_stmt
+	| repeat_stmt
+	| while_stmt
+	| for_stmt
+	| with_stmt
+	;
+
+assignment
+	: variable ':=' expr
+	;
+
+proc_call
+	: ID param_list
+	;
+
+param_list
+	: /* empty */
+	| '(' expr_list ')'
+	;
+
+expr_list
+	: expr
+	| expr_list ',' expr
+	;
+
+goto_stmt
+	: _GOTO_ label
+	;
+
+compound_stmt
+	: _BEGIN_ stmt_list _END_
+	;
+
+stmt_list
+	: stmt
+	| stmt_list ';' stmt
+	;
+
+if_stmt	: _IF_ expr _THEN_ stmt
+	| _IF_ expr _THEN_ stmt _ELSE_ stmt
+	;
+
+case_stmt
+	: _CASE_ expr _OF_ case_list else_case _END_
+	;
+
+case_list
+	: case
+	| case_list ';' case
+	;
+
+case	: /* empty */
+	| case_label_list ':' stmt
+	;
+
+case_label_list
+	: case_label
+        | case_label_list ',' case_label
+        ;
+
+case_label
+	: const
+        | const '..' const
+        ;
+
+else_case
+	: /* empty */
+	| _ELSE_ stmt
+	| _ELSE_ stmt ';'
+	;
+
+repeat_stmt
+	: _REPEAT_ stmt_list _UNTIL_ expr
+	;
+
+while_stmt
+	: _WHILE_ expr _DO_ stmt
+	;
+
+for_stmt
+	: _FOR_ ID ':=' expr _TO_ expr _DO_ stmt
+	| _FOR_ ID ':=' expr _DOWNTO_ expr _DO_ stmt
+	;
+
+with_stmt
+	: _WITH_ variable_list _DO_ stmt
+	;
+
+variable_list
+	: variable
+        | variable_list ',' variable
+        ;
+
+/* Variables: */
+
+variable
+	: ID
+	| variable '[' expr_list ']'		/* array component */
+	| variable '.' ID			/* record field */
+        | variable '^'				/* pointer value */
+	| ID '(' variable ')'		        /* type cast */
+	;
+
+/* Expressions: */
+
+expr	: simple_expr
+	| simple_expr relop simple_expr
+        ;
+
+relop	: '=' | '<>' | '<' | '>' | '<=' | '>=' | _IN_
+        ;
+
+simple_expr
+	: term
+        | sign term
+        | simple_expr addop term
+        ;
+
+addop	: '+' | '-' | _OR_ | _XOR_
+	;
+
+term	: factor
+	| term mulop factor
+        ;
+
+mulop	: '*' | '/' | _DIV_ | _MOD_ | _SHL_ | _SHR_
+	;
+
+/* Parameterless function calls, and function calls looking like type
+   casts are caught as variables. */
+
+factor	: variable
+	| UNSIGNED_INTEGER
+        | UNSIGNED_REAL
+        | STRING_CONST
+        | '[' elem_list ']'
+        | _NIL_
+        | '@' variable
+        | '(' expr ')'
+        | ID '(' expr_list ')'
+        | _NOT_ factor
+        ;
+
+elem_list
+	: /* empty */
+        | elem_list1
+        ;
+
+elem_list1
+	: elem
+	| elem_list1 ',' elem
+	;
+
+elem	: expr
+	| expr '..' expr
+	;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/tree.txt	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,144 @@
+Rodzaje wezel drzewa parsowania
+===============================
+
+
+Legenda
+-------
+
+Nazwy oznaczaja poszczegolne wezly.
+Tekst po `/' to komentarz.
+Kazdy rodzaj wezla jest wpisany w calosci tylko raz (inaczej bylyby cykle).
+Gwiazdka `*' po nazwie oznacza dowolna ilosc (liste lub tablice hashujaca).
+
+
+Uwagi
+-----
+
+Kazdy z wezlow zawiera poza odnosnikami do innych wezlow takze dodatkowe informacje
+zalezne od swojego typu. Oprocz tego kazdy ma dwa wskazniki do komentarzy: jeden do
+komentarzy blokowych poprzedzajacych wezel, drugi do komentarzy w kodzie zaraz za 
+wezlem.
+Nie wszystkie typy wystepuja w tablicy symboli -- niektore sa tworzone 'na bierzaco'
+za pomoca odpowiednich konstrukcji.
+Istnieje mozliwosc wlaczenia tych konstrukcji do drzewa parsowania.
+Kuszaca jest tez mozliwosc dodania zarowno unitow jak i parametrow do tablic symboli.
+
+Uwagi 2
+-------
+
+Przedstawione ponizej drzewo nie odzwierciedla fkatycznej struktury i wezlow -- jest
+tylko z grbsza planem dzialania.  W praktyce zarowno nazwy wezlow jak i ich powiazania
+moga byc nieco inne.  Wszytkie wezly zdefiniowane sa w pliku node.h, zawierajacym takze 
+komentarze.
+
+
+Drzewo
+------
+
+NodeProgram	/ Caly program
+ |
+ >-- NodeUnit*	/ Unit wlaczony do programu
+ |	|
+ |	`-- NodeNamespace	/ Tablica symboli z danego unitu
+ |
+ >-- NodeNamespace	/ Czyli tablica symboli
+ |	|
+ |	>-- NodeType*	/ Nowy typ
+ |	|	|
+ |	|	`-- NodeNamespace	/ Tylko dla rekordow -- pola
+ |	|
+ |	>-- NodeConst*	/ Nowa stala nazwana
+ |	|	|
+ |	|	>-- NodeValue	/ Wartosc stalej
+ |	|	`-- NodeType	/ Typ stalej
+ |	|
+ |	>-- NodeVar*	/ Nowa zmienna
+ |	|	|
+ |	|	`-- NodeType	/ Typ zmiennej
+ |	|
+ |	>-- NodeLabel*	/ Nowa etykieta
+ |	>-- NodeProc*	/ Definicja procedury
+ |	|	|
+ |	|	>-- NodeVar*	/ Parametry
+ |	|	>-- NodeNamespace	/ Symbole lokalne
+ |	|	`-- NodeBody	/ Kod wykonywany przez procedure
+ |	|
+ |	`-- NodeFunc*	/ Definicja funkcji
+ |		|
+ |		>-- NodeVar*	/ Parametry
+ |		>-- NodeType	/ Typ zwracany przez funkcje
+ |		>-- NodeNamespace	/ Symbole lokalne
+ |		`-- NodeBody	/ Cialo funkcji
+ |
+ `-- NodeBody
+ 	|
+	>-- NodeProcCall*	/ Wywolanie procedury	
+	|	|
+	|	>-- NodeProc	/ Wywolywana procedura
+	|	`-- NodeExpression*	/ Parametry
+	|
+	>-- NodeAssignment*	/ Przypisanie
+	|	|
+	|	>-- NodeVariable	/ Zmienna do ktorej przypisujemy (lub wskaznik, element tablicy, pole rekordu)
+	|	`-- NodeExpression	/ Wyrazenie przypisywane
+	|		|
+	|		>-- NodeType	/ Typ wyrazenia
+	|		>-- NodeVariable*	/ Zmienne w wyrazeniu
+	|		|	|
+	|		|	>-- NodeVar	/ Jakiej zmiennej dotyczy
+	|		|	`-- NodeType	/ Jak zmienil sie jej typ
+	|		|
+	|		>-- NodeConst*	/ Stale nazwane w wyrazeniu
+	|		>-- NodeValue*	/ Stale liczby i stringi
+	|		>-- NodeBiOper*	/ Operatory binarne
+	|		|	|
+	|		|	>-- NodeExpression	/ Pierwsze wyrazenie
+	|		|	`-- NodeExpression	/ Drugie wyrazenie
+	|		|
+	|		>-- NodeSiOper*	/ Operatory jednoargumentowe (znak, nawiasy)
+	|		|	|
+	|		|	`-- NodeExpression	/ Wyrazenie na ktorym dziala
+	|		|
+	|		`-- NodeFuncCall*	/ Wywolanie funkcji
+	|			|
+	|			>-- NodeFunc	/ Jaka to funkcja
+	|			`-- NodeExpression*	/ Parametry	
+	|
+	>-- NodeConditional*	/ If .. then .. else ...
+	|	|
+	|	>-- NodeExpression	/ Warunek
+	|	>-- NodeBody	/ rozkazy po then
+	|	`-- NodeBody	/ rozkazy po else
+	|
+	>-- NodeLoop*	/ Petle repeat i while
+	|	|
+	|	>-- NodeExpression	/ Warunek zakonczenia
+	|	`-- NodeBody	/ wnetrze petli
+	|
+	>-- NodeForLoop*	/ Petla for
+	|	|
+	|	>-- NodeVariable	/ Zmienna indeksujaca
+	|	>-- NodeExpression	/ Wartosc poczatkowa
+	|	>-- NodeExpression	/ Wartosc koncowa
+	|	`-- NodeBody	/ wnetrze petli
+	|
+	>-- NodeGoto*	/ Instrukcja skoku
+	|	|
+	|	`-- NodeLabel	/ Etykieta docelowa
+	|
+	>-- NodeCompound*	/ begin ... end
+	|	|
+	|	`-- NodeBody	/ rozkazy zawarte pomiedzy
+	|
+	>-- NodeSelect*	/ instrukcja wyboru (case)
+	|	|
+	|	>-- NodeExpression	/ Wyrazenie wybierajace
+	|	`-- NodeCase*	/ Poszczegolne przypadki
+	|		|
+	|		>-- NodeExpression	/ Kiedy zastosowac
+	|		`-- NodeBody	/ Co zastosowac
+	|
+	`-- NodeWith*	/ Instrukcja wiazaca
+		|
+		>-- NodeVariable*	/ Z jaka zmienna zwiazac
+		`-- NodeBody	/ Zawartosc
--- a/err.txt	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-Starting parse
-Entering state 0
-Reading a token: token 296 (unit)
-Next token is 296 (K_UNIT)
-Shifting token 296 (K_UNIT), Entering state 2
-Reading a token: token 316 (Error)
-Next token is 316 (ID_NAME)
-Shifting token 316 (ID_NAME), Entering state 8
-Reading a token: token 59 (;)
-Next token is 59 (';')
-Shifting token 59 (';'), Entering state 15
-Reducing via rule 13 (line 166), K_UNIT ID_NAME ';'  -> unit_heading
-state stack now 0
-Entering state 6
-Reading a token: token 276 (interface)
-Next token is 276 (K_INTERFACE)
-Shifting token 276 (K_INTERFACE), Entering state 11
-Reading a token: token 285 (procedure)
-Next token is 285 (K_PROCEDURE)
-Reducing via rule 7 (line 124),  -> uses_clause
-state stack now 0 6 11
-Entering state 20
-Reducing via rule 39 (line 255),  -> int_decl_sect_list
-state stack now 0 6 11 20
-Entering state 46
-Next token is 285 (K_PROCEDURE)
-Shifting token 285 (K_PROCEDURE), Entering state 31
-Reading a token: token 316 (ShowError)
-Next token is 316 (ID_NAME)
-Shifting token 316 (ID_NAME), Entering state 89
-Reducing via rule 121 (line 544), K_PROCEDURE ID_NAME  -> proc_heading_beginning
-state stack now 0 6 11 20 46
-Entering state 41
-Reading a token: token 40 (()
-Next token is 40 ('(')
-Shifting token 40 ('('), Entering state 97
-Reading a token: token 316 (Msg)
-Next token is 316 (ID_NAME)
-Shifting token 316 (ID_NAME), Entering state 16
-Reducing via rule 9 (line 135), ID_NAME  -> id_name_list
-state stack now 0 6 11 20 46 41 97
-Entering state 155
-Reading a token: token 58 (:)
-Next token is 58 (':')
-Shifting token 58 (':'), Entering state 238
-Reading a token: token 292 (string)
-Next token is 292 (K_STRING)
-Shifting token 292 (K_STRING), Entering state 241
-Reducing via rule 138 (line 609), K_STRING  -> fptype
-state stack now 0 6 11 20 46 41 97 155 238
-Entering state 289
-Reducing via rule 134 (line 590), id_name_list ':' fptype  -> fp_sect
-state stack now 0 6 11 20 46 41 97
-Entering state 157
-Reducing via rule 132 (line 586), fp_sect  -> fp_sect_list
-state stack now 0 6 11 20 46 41 97
-Entering state 156
-Reading a token: token 41 ())
-Next token is 41 (')')
-Shifting token 41 (')'), Entering state 240
-Reducing via rule 131 (line 582), '(' fp_sect_list ')'  -> fp_list
-state stack now 0 6 11 20 46 41
-Entering state 98
-Reading a token: token 59 (;)
-Next token is 59 (';')
-Shifting token 59 (';'), Entering state 158
-Reducing via rule 125 (line 568), proc_heading_beginning fp_list ';'  -> proc_heading
-state stack now 0 6 11 20 46
-Entering state 109
-Reducing via rule 44 (line 263), proc_heading  -> int_decl_sect
-!!! Clearing local namespace!
-state stack now 0 6 11 20 46
-Entering state 108
-Reducing via rule 40 (line 256), int_decl_sect_list int_decl_sect  -> int_decl_sect_list
-state stack now 0 6 11 20
-Entering state 46
-Reading a token: token 275 (implementation)
-Next token is 275 (K_IMPLEMENTATION)
-Reducing via rule 14 (line 172), K_INTERFACE uses_clause int_decl_sect_list  -> interface_part
-state stack now 0 6
-Entering state 12
-Next token is 275 (K_IMPLEMENTATION)
-Shifting token 275 (K_IMPLEMENTATION), Entering state 21
-Reading a token: token 298 (uses)
-Next token is 298 (K_USES)
-Shifting token 298 (K_USES), Entering state 9
-Reading a token: token 316 (Crt)
-Next token is 316 (ID_NAME)
-Shifting token 316 (ID_NAME), Entering state 16
-Reducing via rule 9 (line 135), ID_NAME  -> id_name_list
-state stack now 0 6 12 21 9
-Entering state 17
-Reading a token: token 44 (,)
-Next token is 44 (',')
-Shifting token 44 (','), Entering state 25
-Reading a token: token 316 (Display)
-Next token is 316 (ID_NAME)
-Shifting token 316 (ID_NAME), Entering state 52
-Reducing via rule 10 (line 142), id_name_list ',' ID_NAME  -> id_name_list
-state stack now 0 6 12 21 9
-Entering state 17
-Reading a token: token 59 (;)
-Next token is 59 (';')
-Shifting token 59 (';'), Entering state 24
-Reducing via rule 8 (line 125), K_USES id_name_list ';'  -> uses_clause
-state stack now 0 6 12 21
-Entering state 47
-Reducing via rule 18 (line 195),  -> decl_sect_list
-state stack now 0 6 12 21 47
-Entering state 111
-Reading a token: token 285 (procedure)
-Next token is 285 (K_PROCEDURE)
-Shifting token 285 (K_PROCEDURE), Entering state 31
-Reading a token: token 309 (ShowError)
-Next token is 309 (ID_PROC)
-Shifting token 309 (ID_PROC), Entering state 88
-Reducing via rule 122 (line 549), K_PROCEDURE ID_PROC  -> proc_heading_beginning
-state stack now 0 6 12 21 47 111
-Entering state 41
-Reading a token: token 40 (()
-Next token is 40 ('(')
-Shifting token 40 ('('), Entering state 97
-Reading a token: token 316 (Msg)
-Next token is 316 (ID_NAME)
-Shifting token 316 (ID_NAME), Entering state 16
-Reducing via rule 9 (line 135), ID_NAME  -> id_name_list
-state stack now 0 6 12 21 47 111 41 97
-Entering state 155
-Reading a token: token 58 (:)
-Next token is 58 (':')
-Shifting token 58 (':'), Entering state 238
-Reading a token: token 292 (string)
-Next token is 292 (K_STRING)
-Shifting token 292 (K_STRING), Entering state 241
-Reducing via rule 138 (line 609), K_STRING  -> fptype
-state stack now 0 6 12 21 47 111 41 97 155 238
-Entering state 289
-Reducing via rule 134 (line 590), id_name_list ':' fptype  -> fp_sect
-state stack now 0 6 12 21 47 111 41 97
-Entering state 157
-Reducing via rule 132 (line 586), fp_sect  -> fp_sect_list
-state stack now 0 6 12 21 47 111 41 97
-Entering state 156
-Reading a token: token 41 ())
-Next token is 41 (')')
-Shifting token 41 (')'), Entering state 240
-Reducing via rule 131 (line 582), '(' fp_sect_list ')'  -> fp_list
-state stack now 0 6 12 21 47 111 41
-Entering state 98
-Reading a token: token 59 (;)
-Next token is 59 (';')
-Shifting token 59 (';'), Entering state 158
-Reducing via rule 125 (line 568), proc_heading_beginning fp_list ';'  -> proc_heading
-state stack now 0 6 12 21 47 111
-Entering state 43
-Reading a token: token 260 (begin)
-Next token is 260 (K_BEGIN)
-Reducing via rule 18 (line 195),  -> decl_sect_list
-state stack now 0 6 12 21 47 111 43
-Entering state 19
-Next token is 260 (K_BEGIN)
-Shifting token 260 (K_BEGIN), Entering state 27
-Reading a token: token 309 (WriteXY)
-Next token is 309 (ID_PROC)
-Shifting token 309 (ID_PROC), Entering state 60
-Reading a token: token 40 (()
-Next token is 40 ('(')
-Shifting token 40 ('('), Entering state 138
-Reading a token: token 317 (1)
-Next token is 317 (CONST_INT)
-Shifting token 317 (CONST_INT), Entering state 117
-Reducing via rule 214 (line 760), CONST_INT  -> factor
-state stack now 0 6 12 21 47 111 43 19 27 60 138
-Entering state 130
-Reducing via rule 204 (line 749), factor  -> term
-state stack now 0 6 12 21 47 111 43 19 27 60 138
-Entering state 129
-Reading a token: token 44 (,)
-Next token is 44 (',')
-Reducing via rule 197 (line 741), term  -> simple_expr
-state stack now 0 6 12 21 47 111 43 19 27 60 138
-Entering state 128
-Next token is 44 (',')
-Reducing via rule 188 (line 733), simple_expr  -> expr
-state stack now 0 6 12 21 47 111 43 19 27 60 138
-Entering state 200
-Reducing via rule 156 (line 647), expr  -> expr_list
-state stack now 0 6 12 21 47 111 43 19 27 60 138
-Entering state 199
-Next token is 44 (',')
-Shifting token 44 (','), Entering state 264
-Reading a token: token 317 (25)
-Next token is 317 (CONST_INT)
-Shifting token 317 (CONST_INT), Entering state 117
-Reducing via rule 214 (line 760), CONST_INT  -> factor
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264
-Entering state 130
-Reducing via rule 204 (line 749), factor  -> term
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264
-Entering state 129
-Reading a token: token 44 (,)
-Next token is 44 (',')
-Reducing via rule 197 (line 741), term  -> simple_expr
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264
-Entering state 128
-Next token is 44 (',')
-Reducing via rule 188 (line 733), simple_expr  -> expr
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264
-Entering state 304
-Reducing via rule 157 (line 648), expr_list ',' expr  -> expr_list
-state stack now 0 6 12 21 47 111 43 19 27 60 138
-Entering state 199
-Next token is 44 (',')
-Shifting token 44 (','), Entering state 264
-Reading a token: token 319 (Error: )
-Next token is 319 (CONST_STRING)
-Shifting token 319 (CONST_STRING), Entering state 119
-Reducing via rule 216 (line 764), CONST_STRING  -> factor
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264
-Entering state 130
-Reducing via rule 204 (line 749), factor  -> term
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264
-Entering state 129
-Reading a token: token 43 (+)
-Next token is 43 ('+')
-Reducing via rule 197 (line 741), term  -> simple_expr
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264
-Entering state 128
-Next token is 43 ('+')
-Shifting token 43 ('+'), Entering state 179
-Reducing via rule 200 (line 746), '+'  -> addop
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264 128
-Entering state 184
-Reading a token: token 310 (Msg)
-Next token is 310 (ID_VAR)
-Shifting token 310 (ID_VAR), Entering state 61
-Reducing via rule 183 (line 722), ID_VAR  -> variable
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264 128 184
-Entering state 126
-Reading a token: token 41 ())
-Next token is 41 (')')
-Reducing via rule 213 (line 759), variable  -> factor
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264 128 184
-Entering state 130
-Reducing via rule 204 (line 749), factor  -> term
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264 128 184
-Entering state 255
-Next token is 41 (')')
-Reducing via rule 199 (line 743), simple_expr addop term  -> simple_expr
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264
-Entering state 128
-Next token is 41 (')')
-Reducing via rule 188 (line 733), simple_expr  -> expr
-state stack now 0 6 12 21 47 111 43 19 27 60 138 199 264
-Entering state 304
-Reducing via rule 157 (line 648), expr_list ',' expr  -> expr_list
-state stack now 0 6 12 21 47 111 43 19 27 60 138
-Entering state 199
-Next token is 41 (')')
-Shifting token 41 (')'), Entering state 263
-Reducing via rule 155 (line 643), '(' expr_list ')'  -> param_list
-state stack now 0 6 12 21 47 111 43 19 27 60
-Entering state 139
-Reducing via rule 153 (line 637), ID_PROC param_list  -> proc_call
-state stack now 0 6 12 21 47 111 43 19 27
-Entering state 69
-Reducing via rule 143 (line 621), proc_call  -> unlabelled_stmt
-state stack now 0 6 12 21 47 111 43 19 27
-Entering state 67
-Reducing via rule 139 (line 614), unlabelled_stmt  -> stmt
-state stack now 0 6 12 21 47 111 43 19 27
-Entering state 66
-Reducing via rule 160 (line 660), stmt  -> stmt_list
-state stack now 0 6 12 21 47 111 43 19 27
-Entering state 72
-Reading a token: token 59 (;)
-Next token is 59 (';')
-Shifting token 59 (';'), Entering state 143
-Reading a token: token 267 (end)
-Next token is 267 (K_END)
-Reducing via rule 141 (line 619),  -> unlabelled_stmt
-state stack now 0 6 12 21 47 111 43 19 27 72 143
-Entering state 67
-Reducing via rule 139 (line 614), unlabelled_stmt  -> stmt
-state stack now 0 6 12 21 47 111 43 19 27 72 143
-Entering state 203
-Reducing via rule 161 (line 661), stmt_list ';' stmt  -> stmt_list
-state stack now 0 6 12 21 47 111 43 19 27
-Entering state 72
-Next token is 267 (K_END)
-Shifting token 267 (K_END), Entering state 142
-Reducing via rule 159 (line 656), K_BEGIN stmt_list K_END  -> compound_stmt
-state stack now 0 6 12 21 47 111 43 19
-Entering state 45
-Reducing via rule 11 (line 153), decl_sect_list compound_stmt  -> block
-state stack now 0 6 12 21 47 111 43
-Entering state 102
-Reducing via rule 127 (line 576), block  -> proc_block
-state stack now 0 6 12 21 47 111 43
-Entering state 103
-Reading a token: token 59 (;)
-Next token is 59 (';')
-Shifting token 59 (';'), Entering state 160
-Reducing via rule 119 (line 524), proc_heading proc_block ';'  -> proc_decl
-!!! Clearing local namespace!
-state stack now 0 6 12 21 47 111
-Entering state 39
-Reducing via rule 24 (line 204), proc_decl  -> decl_sect
-state stack now 0 6 12 21 47 111
-Entering state 34
-Reducing via rule 19 (line 196), decl_sect_list decl_sect  -> decl_sect_list
-state stack now 0 6 12 21 47
-Entering state 111
-Reading a token: token 267 (end)
-Next token is 267 (K_END)
-Reducing via rule 15 (line 178), K_IMPLEMENTATION uses_clause decl_sect_list  -> implementation_part
-state stack now 0 6 12
-Entering state 22
-Next token is 267 (K_END)
-Shifting token 267 (K_END), Entering state 48
-Reducing via rule 17 (line 187), K_END  -> initialization_part
-state stack now 0 6 12 22
-Entering state 49
-Reading a token: token 46 (.)
-Next token is 46 ('.')
-Shifting token 46 ('.'), Entering state 112
-Reducing via rule 12 (line 160), unit_heading interface_part implementation_part initialization_part '.'  -> unit
-state stack now 0
-Entering state 5
-Reducing via rule 2 (line 103), unit  -> compilation_unit
-state stack now 0
-Entering state 391
-Reading a token: token 0 ()
-Now at end of input.
-Shifting token 0 ($), Entering state 392
-Now at end of input.
--- a/error.pas	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-
-{ Copyright (c) 1985, 1989 by Borland International, Inc. }
-
-unit Error;
-{ Sample unit for CIRCULAR.PAS }
-
-interface
-
-procedure ShowError(Msg : string);
-
-implementation
-
-uses
-  Crt, Display;
-
-procedure ShowError(Msg : string);
-begin
-  WriteXY(1, 25, 'Error: ' + Msg);
-end;
-
-end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keywords.c	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,43 @@
+#include <glib.h>
+
+#include "parser.h"
+#include "pascal.tab.h"
+
+/* Wpisuje do tablicy slowa kluczowe. */
+void
+initKeywords(Parser * parser)
+{
+    int             i;
+    const static char *keywords_str[] =
+        { "AND", "ABSOLUTE", "ARRAY", "BEGIN", "CASE", "CONST", "DIV", "DOWNTO", "DO", "ELSE",
+"END", "EXTERNAL", "FILE", "FORWARD", "FOR", "FUNCTION", "GOTO", "IF", "IMPLEMENTATION", "INTERFACE", "IN", "LABEL",
+"MOD", "NIL", "NOT", "OF", "OR", "PACKED", "PROCEDURE", "PROGRAM", "RECORD", "REPEAT", "SET", "SHL", "SHR", "STRING",
+"THEN", "TO", "TYPE", "UNIT", "UNTIL", "USES", "VAR", "WHILE", "WITH", "XOR", "THEN", "ELSE", NULL };
+    const static int keywords_tok[] =
+        { K_AND, K_ABSOLUTE, K_ARRAY, K_BEGIN, K_CASE, K_CONST, K_DIV, K_DOWNTO, K_DO, K_ELSE,
+K_END, K_EXTERNAL, K_FILE, K_FORWARD, K_FOR, K_FUNCTION, K_GOTO, K_IF, K_IMPLEMENTATION, K_INTERFACE, K_IN, K_LABEL,
+K_MOD, K_NIL, K_NOT, K_OF, K_OR, K_PACKED, K_PROCEDURE, K_PROGRAM, K_RECORD, K_REPEAT, K_SET, K_SHL, K_SHR, K_STRING,
+K_THEN, K_TO, K_TYPE, K_UNIT, K_UNTIL, K_USES, K_VAR, K_WHILE, K_WITH, K_XOR, K_THEN, K_ELSE, 0 };
+
+    for (i = 0; keywords_str[i] != NULL; ++i) {
+        g_hash_table_insert(parser->keywords, (char *)(keywords_str[i]),
+                            GINT_TO_POINTER(keywords_tok[i]));
+    }
+}
+
+/* Wyszukuje slowo kluczowe. */
+int
+findKeyword(Parser * parser, const char *word)
+{
+    GString        *upper;
+    gpointer        p;
+
+    upper = g_string_new(word);
+    upper = g_string_up(upper);
+    p = g_hash_table_lookup(parser->keywords, (gpointer) (upper->str));
+    g_string_free(upper, TRUE);
+    if (p != NULL)
+        return GPOINTER_TO_INT(p);
+    else
+        return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keywords.h	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,12 @@
+#ifndef KEYWORDS_H
+#define KEYWORDS_H
+
+#include "parser.h"
+
+/* Wyszukuje slowo kluczowe. */
+int findKeyword(Parser *parser, const char *word);
+
+/* Wpisuje do tablicy slowa kluczowe. */
+void initKeywords(Parser *parser);
+
+#endif
--- a/lexer.c	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/* Funkcje wymagane przez Bisona i uzywane wewnatrz parsera. */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <glib.h>
-
-#include "symbol.h"
-#include "tokenize.h"
-#include "tp4.tab.h"
-#include "parser.h"
-#include "lexer.h"
-
-int
-get_token(Parser *parser, YYSTYPE (*lvalp))
-{
-    Symbol         *sym;
-    DictEntry      *entry;
-    int             temp;
-    
-    for (;;)
-        switch (getNextToken(parser->tok)) {
-            case TOKEN_CHAR:
-                return parser->tok->buf->str[0];
-            case TOKEN_EOF:
-                return 0;
-            case TOKEN_INT:
-            case TOKEN_HEX:
-                (*lvalp).const_int = atoi(parser->tok->buf->str);
-                return CONST_INT;
-            case TOKEN_REAL:
-            case TOKEN_ENG:
-                (*lvalp).const_real = atof(parser->tok->buf->str);
-                return CONST_REAL;
-            case TOKEN_STRING:
-                (*lvalp).string = parser->tok->buf->str;
-                return CONST_STRING;
-            case TOKEN_DEFEQ:
-                return OP_DEFEQ;
-            case TOKEN_DOTDOT:
-                return OP_DOTDOT;
-            case TOKEN_LEQ:
-                return OP_LEQ;
-            case TOKEN_GEQ:
-                return OP_GEQ;
-            case TOKEN_NEQ:
-                return OP_NEQ;
-            case TOKEN_NAME:
-                temp = findKeyword(parser, parser->tok->buf->str);
-                if (temp != 0)
-                    return temp;
-                sym = findSymbol(parser, parser->tok->buf->str);
-                if (sym != NULL) {
-                    (*lvalp).symbol = sym;
-                    return sym->token;
-                }
-                (*lvalp).string = parser->tok->buf->str;
-                return ID_NAME;
-            case TOKEN_COMMENT:
-                /* Nothing */
-                break;
-            case TOKEN_ERROR:
-                break;
-            default:
-                return 0;
-        }
-}
-
-
-int
-yylex (YYSTYPE *lvalp, Parser *parser)
-{
-    int token;
-
-    token = get_token(parser, lvalp);
-#ifdef DEBUG
-    fprintf(stderr, "token %d (%s)\n", token, parser->tok->buf->str); 
-#endif
-    return token;
-}
-
-void
-yyerror(char *msg)
-{
-    fprintf(stderr, "%s\n", msg);
-}
--- a/lexer.h	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#ifndef LEXER_H
-#define LEXER_H
-
-/* Skaner leksykalny. */
-int yylex (YYSTYPE *lvalp, Parser *parser);
-
-/* Obsluga bledow. */
-void yyerror(char *msg);
-#endif
--- a/main.c	Sat Oct 13 21:11:54 2012 +0200
+++ b/main.c	Sat Oct 13 21:14:50 2012 +0200
@@ -4,40 +4,60 @@
 #include <stdio.h>
 #include <glib.h>
 
-#include "symbol.h"
-#include "tokenize.h"
-#include "tp4.tab.h"
 #include "parser.h"
+#include "codetext.h"
+#include "codetools.h"
+#include "codenodes.h"
+#include "view.h"
+#include "write.h"
 
 /* To jest w tp4.tab.c */
 int             yyparse();
 extern int      yydebug;
 
-
+/* Głowna procedura programu. */
 int
 main(int argc, char *argv[])
 {
     Parser *parser;
-
-    if (argc<2)
-        parser = newParser("sample.pas");
-    else
-        parser = newParser(argv[1]);
-
-    /* Tymczasowo, potem to bedzie w unicie 'system'. */
-    registerType(parser, "integer");
-    registerType(parser, "real");
-    registerType(parser, "char");
-
-    registerProc(parser, "write");
-    registerProc(parser, "writexy");
-    registerProc(parser, "writeln");
-
-    registerFunc(parser, "read");
-    registerFunc(parser, "readln");
+    int     ret;
+    CodeText *text;
+    Viewer *view;
 
 #ifdef DEBUG
     yydebug = TRUE;
 #endif
-    return yyparse(parser);
+
+    if (argc < 2) {
+        printf("Pascal Analyzer, version 0.00beta\n");
+        printf("Usage:\n");
+        printf("\tpasana <filename>\n");
+        printf("Where <filename> is the name of file to parse.\n");
+        return 0;
+    }
+
+    parser = newParser(argv[1]);
+    if (parser==NULL) {
+        fprintf(stderr, "Cannot open file!\n");
+        return 1;
+    }
+    ret = yyparse(parser);
+
+    if (ret==0) {
+        printf("Program parsed.\n");
+        text = newCodeText();        
+        printSymbolNodeDef(text, parser->root);
+        //codeShow(text);
+        view = newViewer(text);
+        viewUpdate(view);
+        viewKeyPress(view);
+        destroyViewer(view);
+        writeFile(text, "output.pas");
+    } else {
+        printf("...in file `%s', at line %d, near `%s'.\n", parser->filename->str, parser->line, parser->last_token);
+    }
+    
+    destroyParser(parser);
+    
+    return ret;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/node.h	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,218 @@
+/* Wezły drzewa parsowania. */
+/* Konstruktory są w plikach node_new.* */
+
+#ifndef NODE_H
+#define NODE_H
+
+#include <glib.h>
+#include "symbols.h"
+
+/* Zeby oszczedzic sobie pisania. */
+typedef struct StmtNode StmtNode;
+typedef struct SymbolNode SymbolNode;
+typedef struct ExprNode ExprNode;
+
+enum NodeKind {
+    /* Rodzaje symboli. */
+    NODE_NONE,
+    SYM_TYPE_POINTER,
+    SYM_TYPE_STRING,
+    SYM_TYPE_ARRAY,
+    SYM_TYPE_SET,
+    SYM_TYPE_SUBRANGE,
+    SYM_TYPE_ENUM,
+    SYM_TYPE_RECORD,
+    SYM_TYPE_FILE,
+    SYM_TYPE_MAXIMUM,
+    SYM_VAR_LOCAL,
+    SYM_VAR_PARAM,
+    SYM_VAR_VARPARAM,
+    SYM_VAR_FIELD,
+    SYM_VAR_DEARR,
+    SYM_VAR_DEREF,
+    SYM_VAR_CAST,
+    SYM_VAR_MAXIMUM,
+    SYM_LABEL,
+    SYM_PROC,
+    SYM_FUNC,
+    SYM_CONST,
+    SYM_UNIT,
+    SYM_PROG,
+    SYM_TAG_FIELD,               /* pole wariantowe w zmiennej rekordowej. */
+    SYM_MAXIMUM,
+    /* Rodzaje rozkazów */
+    STMT_BLOCK,
+    STMT_IF,
+    STMT_WHILE,
+    STMT_REPEAT,
+    STMT_FOR,
+    STMT_FOR_DOWN,
+    STMT_WITH,
+    STMT_PROC,
+    STMT_ASSIGN,
+    STMT_GOTO,
+    STMT_CASE_HEAD,
+    STMT_CASE_CASE,
+    STMT_MAXIMUM,
+    /* Rodzaje wyrażeń */
+    EXPR_VAR,                                              /* wywołanie zmiennej */
+    EXPR_CONST,                                            /* wywołanie stałej */
+    EXPR_PAREN,                                            /* nawiasy */
+    EXPR_FUNC,                                             /* wywolanie funkcji */
+    EXPR_STRING,                                           /* stała tekstowa */
+    EXPR_NUMBER,                                           /* stała liczbowa */
+    EXPR_UN,                                               /* operator unarny */
+    EXPR_BIN,                                              /* operator binarny -- działanie*/
+    EXPR_EQ,                                               /* operator binarny -- porównanie*/
+    EXPR_NIL,                                              /* Stała NIL */
+    EXPR_ADDR,                                             /* Adres zmiennej @zmienna lub expr:expr*/
+    EXPR_RANGE,                                             /* Zakres z operatorem `..' */
+    EXPR_ARRAY,
+    EXPR_RECORD,
+    EXPR_CASES,                                            /* Lista przypadków */
+    EXPR_VARIANT,                                          /* Record variant */
+    EXPR_SET,
+    EXPR_MAXIMUM,
+    NODE_MAXIMUM
+};
+
+/* Rodzaje operatorów. */
+enum OperKind {
+    OPER_NONE,
+    OPER_PLUS,
+    OPER_MINUS,
+    OPER_STAR,
+    OPER_SLASH,
+    OPER_DIV,
+    OPER_MOD,
+    OPER_SHL,
+    OPER_SHR,
+    OPER_EQ,
+    OPER_NEQ,
+    OPER_GT,
+    OPER_LT,
+    OPER_GEQ,
+    OPER_LEQ,
+    OPER_IN,
+    OPER_XOR,
+    OPER_OR,
+    OPER_AND,
+    OPER_NOT
+};
+
+/* Dowolny węzeł. */
+union AnyNode {
+    SymbolNode  *symbol;
+    StmtNode    *stmt;
+    ExprNode    *expr;
+};
+typedef union AnyNode AnyNode;
+
+/* Wyrażenie. */
+struct ExprNode {
+    /* Rodzaj wyrażenia. */
+    enum NodeKind   kind;
+
+    /* Dla operatorów -- pierwszy parametr;
+     * Dla zakresów -- początek zakresu;
+     * Dla adresu -- segment pamięci;
+     */
+    struct ExprNode *expr;
+    /* Dla operatorów binarnych -- drugi parametr;
+     * Dla zakresów -- koniec zakresu;
+     * Dla adresu -- offset pamięci;
+     */
+    struct ExprNode *expr2;
+    /* Dla operatorów -- rodzaj operatora. */
+    enum OperKind   oper;
+    /* Dla wywołania zmiennej, funkcji lub stałej -- dany symbol;
+     * Dla adresu -- obiekt o tym samym adresie;
+     */
+    SymbolNode     *symbol;
+    /* Dla wywołania procedury -- lista parametrów;
+     * Dla stałej zbiorowej -- lista wyrażeń elementów;
+     * Dla stałej tablicowej -- jw.;
+     * Dla stałej rekordowej -- lista wyrażeń pÓl;
+     */
+    GList          *list;
+    /* Dla stałych -- ich wartość.
+     * Dla pola rekordu -- jego nazwa.
+     */
+    GString        *value;
+
+    /* Komentarze. */
+    GString        *bcomm;
+    GString        *ccomm;
+};
+
+/* Symbol. */
+struct SymbolNode {
+    /* Rodzaj symbolu. */
+    enum NodeKind   kind;
+    /* Numer zwracany przez tokenizer. */
+    int             token;
+    /* Oryginalna nazwa symbolu (z zachowaniem wielkości liter). */
+    GString        *name;
+
+    /* Dla programu, procedur i funckji -- tablica symboli zdefiniowanych wewnątrz;
+     * Dla typu rekordowego -- tablica pól rekordu;
+     */
+    Namespace      *symbols;
+    /* Dla programu, procedury i funkcji -- ciało (polecenie blokowe);
+     * Dla etykiety -- polecenie, którego dotyczy;
+     */
+    StmtNode       *stmt;
+    /* Dla zmiennych, stałych i funkcji -- typ;
+     * Dla typów -- typ bazowy;
+     * Dla rzutowania -- nowy typ;
+     * Dla rekordów -- typ wyróżnikowy wariantów;
+     */
+    SymbolNode     *type;
+    /* Dla programu -- lista nazw parametrów;
+     * Dla procedury i funkcji -- parametry formalne;
+     * Dla typu wyliczeniowego -- stałe zdefiniowane jako jego wartości;
+     * Dla typu rekordowego -- pola wariantowe w postaci instrukcji case;
+     * Dla typu tablicowego -- lista typów indeksów;
+     * Dla elementu tablicy -- lista wyrażeń indeksów;
+     * Dla pól rekordu -- lista etykiet wyboru;
+     */
+    GList          *list;
+    /* Dla dereferencji wskaźnika -- zmienna wskazywana;
+     * Dla rzutowania -- zmienna rzutowana;
+     * Dla elementu tablicy -- zmienna tablicowa;
+     * Dla rekordów -- pole wyróżnikowe;
+     */
+    SymbolNode     *base;
+    /* Dla stałych -- ich wartość;
+     * Dla łańcuchów -- wielkość łańcucha;
+     * Dla typów okrojonych -- ich zakres;
+     */
+    ExprNode       *expr;
+    /* Symbol do którego należy tablica symboli w której jest nasz symbol;
+     * Dla programu równa NULL;
+     */
+    SymbolNode     *parent;
+
+    /* Komentarze. */
+    GString        *bcomm;
+    GString        *ccomm;
+};
+
+/* Rozkaz. */
+struct StmtNode {
+    enum NodeKind   kind;                                  /* Rodzaj rozkazu. */
+    GList          *list;                                  /* Lista polecen dla bloku lub lista parametrow dla proc i with i
+                                                            * goto. */
+    struct StmtNode *stmt, *stmt2;                         /* Polecenia wewnętrzne (stmt2 dla else) */
+    SymbolNode     *symbol;                                /* Na jakim symbolu operuje (przypisanie, procedura) */
+    SymbolNode     *label;                                 /* Etykieta tego rozkazu. */
+    ExprNode       *expr;                                  /* Wyrażenie dla if, until, while, for */
+    ExprNode       *expr2;                                 /* drugie wyrażenie dla for */
+    StmtNode       *parent;
+
+    /* Komentarze. */
+    GString        *bcomm;
+    GString        *ccomm;
+};
+
+#endif                                                     /* not NODE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/node_new.c	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,120 @@
+/* Pojedynczy wezel drzewa parsowania. */
+
+#include "node.h"
+#include "node_new.h"
+#include "parser.h"
+#include "pascal.tab.h"
+
+
+/* Utowrzenie nowego węzła z wyrażeniem. */
+ExprNode *
+newExprNode(Parser *parser, enum NodeKind kind)
+{
+    ExprNode *node;
+
+    node = g_new(ExprNode,1);
+    node->kind = kind;
+    node->list = NULL;
+    node->expr = NULL;
+    node->expr2 = NULL;
+    node->symbol = NULL;
+    node->value = NULL;
+    
+    /* Dodajemy komentarze. */
+    node->bcomm = parser->blockcomment;
+    parser->blockcomment = NULL;
+    parser->codecomment = &(node->ccomm);
+    return node;
+}
+
+/* Utowrzenie nowego węzła z rozkazem. */
+StmtNode *
+newStmtNode(Parser *parser, enum NodeKind kind)
+{
+    StmtNode *node;
+
+    node = g_new(StmtNode,1);
+    node->kind = kind;
+    node->list = NULL;
+    node->stmt = NULL;
+    node->stmt2 = NULL;
+    node->symbol = NULL;
+    node->expr = NULL;
+    node->expr2 = NULL;
+    node->parent = NULL;
+    node->label = NULL;
+    
+    /* Dodajemy komentarze. */
+    node->bcomm = parser->blockcomment;
+    parser->blockcomment = NULL;
+    parser->codecomment = &(node->ccomm);
+    return node;
+}
+
+/* Utworzenie nowego węzła z symbolem. */
+SymbolNode *
+newSymbolNode(Parser *parser, const char *name, enum NodeKind kind)
+{
+    SymbolNode *node;
+
+    node = g_new(SymbolNode, 1);
+    node->kind = kind;
+    node->name = g_string_new(name);
+    node->symbols = NULL;
+    node->stmt = NULL;
+    node->type = NULL;
+    node->parent = NULL;
+    node->list = NULL;
+    node->base = NULL;
+    node->expr = NULL;
+
+    /* Stała, jaką ma zwrócic tokenizer. */
+    switch (kind) {
+        case SYM_TYPE_POINTER:
+        case SYM_TYPE_STRING:
+        case SYM_TYPE_ARRAY:
+        case SYM_TYPE_SET:
+        case SYM_TYPE_SUBRANGE:
+        case SYM_TYPE_ENUM:
+        case SYM_TYPE_RECORD:
+        case SYM_TYPE_FILE:
+            node->token = ID_TYPE;
+            break;
+        case SYM_VAR_LOCAL:
+        case SYM_VAR_PARAM:
+        case SYM_VAR_VARPARAM:
+        case SYM_VAR_DEARR:
+        case SYM_VAR_DEREF:
+        case SYM_VAR_CAST:
+            node->token = ID_VAR;
+            break;
+        case SYM_VAR_FIELD:
+            node->token = ID_FIELD;
+            break;
+        case SYM_LABEL:
+            node->token = ID_LABEL;
+            break;
+        case SYM_PROC:
+            node->token = ID_PROC;
+            break;
+        case SYM_FUNC:
+            node->token = ID_FUNC;
+            break;
+        case SYM_CONST:
+            node->token = ID_CONST;
+            break;
+        case SYM_UNIT:
+            node->token = ID_UNIT;
+            break;
+        default:
+            node->token = 0;
+    }
+
+    /* Dodajemy komentarze. */
+    node->bcomm = parser->blockcomment;
+    parser->blockcomment = NULL;
+    parser->codecomment = &(node->ccomm);
+    
+    return node;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/node_new.h	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,19 @@
+/* Konstruktory do wierzchołków drzewa parsowania. */
+#ifndef NODE_NEW_H
+#define NODE_NEW_H
+
+#include "parser.h"
+#include "node.h"
+
+/* Utworzenie nowych wezlow. */
+
+/* Utowrzenie nowego węzła z rozkazem. */
+StmtNode * newStmtNode(Parser *parser, enum NodeKind kind);
+
+/* Utowrzenie nowego węzła z rozkazem. */
+ExprNode * newExprNode(Parser *parser, enum NodeKind kind);
+
+/* Utworzenie nowego węzła z symbolem. */
+SymbolNode *newSymbolNode(Parser *parser, const char *name, enum NodeKind kind);
+
+#endif /* not NODE_NEW_H */
--- a/parse_misc.c	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/* Rozne procedury uzywane przez parsera. */
-
-#include <glib.h>
-#include "parser.h"
-#include "parse_misc.h"
-
-/* Wyszukuje slowo kluczowe. */
-int
-findKeyword(Parser *parser, const char *word)
-{
-    GString *upper;
-    gpointer p;
-
-    upper = g_string_new(word);
-    upper = g_string_up(upper);
-    p = g_hash_table_lookup(parser->keywords, (gpointer)(upper->str)); 
-    g_string_free(upper);
-    if (p!=NULL)
-        return GPOINTER_TO_INT(p);
-    else
-        return 0;
-}
-
-Symbol *
-findSymbol(Parser *parser, const char *name)
-{
-    Symbol *sym;
-    Namespace *nam;
-
-    nam = parser->actual;
-    while (nam!=NULL) {
-        sym = getSymbol(parser->nam, name);
-        if (sym!=NULL)
-            return sym;
-        if (nam->owner!=NULL)
-            nam = nam->owner->contained;
-        else
-            nam = NULL;
-    }
-    return nam;
-}
--- a/parse_misc.h	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#ifndef PARSE_MISC_H
-#define PARSE_MISC_H
-
-/* Wyszukuje slowo kluczowe. */
-int
-findKeyword(Parser *parser, const char *word)
-
-#endif
--- a/parser.c	Sat Oct 13 21:11:54 2012 +0200
+++ b/parser.c	Sat Oct 13 21:14:50 2012 +0200
@@ -1,35 +1,10 @@
-/* Funkcje wymagane przez Bisona i uzywane wewnatrz parsera. */
-
-#include <stdlib.h>
-#include <stdio.h>
 #include <glib.h>
-
 #include "symbols.h"
-#include "tokenize.h"
-#include "tp4.tab.h"
 #include "parser.h"
+#include "keywords.h"
 
-/* Wpisuje do tablicy slowa kluczowe. */
-void
-initKeywords(Parser * parser)
-{
-    int             i;
-    const static char *keywords_str[] =
-        { "AND", "ABSOLUTE", "ARRAY", "BEGIN", "CASE", "CONST", "DIV", "DOWNTO", "DO", "ELSE",
-"END", "EXTERNAL", "FILE", "FORWARD", "FOR", "FUNCTION", "GOTO", "IF", "IMPLEMENTATION", "INTERFACE", "IN", "LABEL",
-"MOD", "NIL", "NOT", "OF", "OR", "PACKED", "PROCEDURE", "PROGRAM", "RECORD", "REPEAT", "SET", "SHL", "SHR", "STRING",
-"THEN", "TO", "TYPE", "UNIT", "UNTIL", "USES", "VAR", "WHILE", "WITH", "XOR", "THEN", "ELSE", NULL };
-    const static int keywords_tok[] =
-        { K_AND, K_ABSOLUTE, K_ARRAY, K_BEGIN, K_CASE, K_CONST, K_DIV, K_DOWNTO, K_DO, K_ELSE,
-K_END, K_EXTERNAL, K_FILE, K_FORWARD, K_FOR, K_FUNCTION, K_GOTO, K_IF, K_IMPLEMENTATION, K_INTERFACE, K_IN, K_LABEL,
-K_MOD, K_NIL, K_NOT, K_OF, K_OR, K_PACKED, K_PROCEDURE, K_PROGRAM, K_RECORD, K_REPEAT, K_SET, K_SHL, K_SHR, K_STRING,
-K_THEN, K_TO, K_TYPE, K_UNIT, K_UNTIL, K_USES, K_VAR, K_WHILE, K_WITH, K_XOR, K_THEN, K_ELSE, 0 };
-
-    for (i = 0; keywords_str[i] != NULL; ++i) {
-        g_hash_table_insert(parser->keywords, (char *)(keywords_str[i]),
-                            GINT_TO_POINTER(keywords_tok[i]));
-    }
-}
+/* Funkcja ustawiająca źródło dla flex-a. */
+extern void yyrestart(FILE *);
 
 /* Tworzy nowy parser. */
 Parser         *
@@ -38,13 +13,22 @@
     Parser         *parser;
 
     parser = g_new(Parser, 1);
+    parser->source = fopen(filename, "r");
+    if (parser->source==NULL) {
+        g_free(parser);
+        return NULL;
+    }
     parser->filename = g_string_new(filename);
-    parser->global = newNamespace(NULL);
-    parser->actual = parser->global;
-
-    parser->tok = newTokenizer(filename);
+    parser->namespaces = NULL;
+    parser->scopes = NULL;
     parser->keywords = g_hash_table_new(g_str_hash, g_str_equal);
+    parser->levelup = TRUE;
+    parser->line = 1;
+    parser->root = NULL;
+    parser->codecomment = NULL;
+    parser->blockcomment = NULL;
     initKeywords(parser);
+    yyrestart(parser->source);  /* Każemy flexowi czytać z tego pliku. */
     return parser;
 }
 
@@ -53,10 +37,8 @@
 destroyParser(Parser * parser)
 {
     g_string_free(parser->filename, TRUE);
-    destroyNamespace(parser->global);
-
-    destroyTokenizer(parser->tok);
     g_hash_table_destroy(parser->keywords);
+    fclose(parser->source);
     g_free(parser);
     parser = NULL;
 }
--- a/parser.h	Sat Oct 13 21:11:54 2012 +0200
+++ b/parser.h	Sat Oct 13 21:14:50 2012 +0200
@@ -3,12 +3,24 @@
 #ifndef PARSER_H
 #define PARSER_H
 
+#include <glib.h>
+#include <stdio.h>
+#include "node.h"
+#include "symbols.h"
+
 struct Parser {
     GString        *filename;                              /* Nazwa pliku zrodlowego. */
+    FILE           *source;                                /* Plik źródłowy. */
     GHashTable     *keywords;                              /* Tablica slow kluczowych. */
     Namespace      *global;                                /* Globalna przestrzen nazw. */
-    Namespace      *actual;                                /* Aktualna przestrzen nazw. */
-    Tokenizer      *tok;                                   /* Tokenizer. */
+    int             levelup;                               /* Czy ma sprawdzac inne tablice symboli niz aktualna */
+    GList          *namespaces;                            /* Stos przestrzeni nazw. */
+    int             line;                                  /* Aktualna linia. */
+    SymbolNode     *root;                                  /* Pierwszy węzeł drzewa parsowania. */
+    GString       **codecomment;                           /* miejsce, gdzie ma byc wpisany kolejny komentarz do kodu. */
+    GString        *blockcomment;                          /* ostatni komentarz blokowy. */
+    GList          *scopes;                                /* Stos zasięgów -- zawiera symbole w których zasięgu aktualnie                                                                      * szukane są symbole. */
+    const char *    last_token;                            /* Tekst ostatnio wczytanego tokena. */
 };
 typedef struct Parser Parser;
 
--- a/pascal.l	Sat Oct 13 21:11:54 2012 +0200
+++ b/pascal.l	Sat Oct 13 21:14:50 2012 +0200
@@ -1,10 +1,20 @@
 /* Tokenizer dla jezyka Turbo Pascal */
 
 %{ 
+	#include <glib.h>
+        #include "parser.h"
+        #include "keywords.h"
+	#include "node.h"
 	#include "pascal.tab.h"
+        #include "utils.h"
+        #define YY_DECL int yylex(YYSTYPE *lvalp, Parser *parser)
+
+/* %option debug */
 %}
 
-%option noyywrap case-insensitive never-interactive 8bit verbose debug batch nointeractive
+
+%option noyywrap case-insensitive never-interactive 8bit verbose batch nointeractive nounput
+
 
 SPC	[ \t\v\r]
 DIG	[0-9]
@@ -20,82 +30,105 @@
 
 %%
 
-{ID1ST}{IDNTH}*		{
-				/* Identyfikator lub slowo kluczowe */
+{ID1ST}{IDNTH}*		{ /* Identyfikator lub slowo kluczowe */
+				SymbolNode *sym;
+                                int id;
+
+                                parser->last_token = yytext;
+                                id = findKeyword(parser, yytext);
+                                if (id!=0)
+                                    return id;
+				sym = findSymbol(parser, yytext);
+				if (sym!=NULL) {
+					(*lvalp).symb = sym;
+					return sym->token;
+				}
+                                (*lvalp).string = g_strdup(yytext);
 				return ID_NAME;
 			}
-{NUM}			{
-				/* Stala calkowita */
-				printf("INT_CONST <%s>\n", yytext);
+{NUM}			{ /* Stala calkowita */
+                                parser->last_token = yytext;
+                                (*lvalp).string = g_strdup(yytext);
+				return CONST_INT;
 			}
-({NUM}"."{NUM})|({NUM}("."{NUM})?"e"{SIGN}?{NUM}) {
-				/* Stala zmiennoprzecinkowa */
-				printf("REAL_CONST <%s>\n", yytext);
+({NUM}"."{NUM})|({NUM}("."{NUM})?"e"{SIGN}?{NUM}) { /* Stala zmiennoprzecinkowa */
+                                parser->last_token = yytext;
+                                (*lvalp).string = g_strdup(yytext);
+				return CONST_REAL;
 			}
-"$"{HEX}+		{
-				/* Stala szesnastkowa */
-				printf("HEX_CONST <%s>\n", yytext);
+"$"{HEX}+		{ /* Stala szesnastkowa */
+                                parser->last_token = yytext;
+                                (*lvalp).string = g_strdup(yytext);
+				return CONST_INT;
 			}
-("'"{QTEXT}"'")|{CTRL}|{CHASH} {
-				/* Stala znakowa (pojedynczy znak) */
-				printf("CHAR_CONST <%s>\n", yytext);
-			}
-(("'"{QTEXT}*"'")|{CTRL}|{CHASH})+ {
-				/* Stala lancuchowa */
-				printf("STR_CONST <%s>\n", yytext);
+("'"{QTEXT}"'")|{CTRL}|{CHASH} { /* Stala znakowa (pojedynczy znak) */
+                                parser->last_token = yytext;
+                                (*lvalp).string = g_strdup(yytext);
+				return CONST_CHAR;
 			}
-^{SPC}*{COMMENT}(({SPC}|\n)*{COMMENT})* {
-				/* Komentarz blokowy XXX trzeba policzyc konce linii! */
-				printf("BLOCK_COMMENT <%s>\n", yytext);
+(("'"{QTEXT}*"'")|{CTRL}|{CHASH})+ { /* Stala lancuchowa */
+                                parser->last_token = yytext;
+                                (*lvalp).string = g_strdup(yytext);
+				return CONST_STRING;
 			}
-{COMMENT}({SPC}*{COMMENT})* {
-				/* Komentarz zwykly  typu {...} lub (*...*) */
-				printf("COMMENT <%s>\n", yytext);
+^{SPC}*{COMMENT}(({SPC}|\n)*{COMMENT})* { /* Komentarz blokowy  (w oddzielnej linii)*/
+                            /* Liczymy linijki w srodku. */
+                            int i;
+                            for (i=0; yytext[i]!='\0'; ++i) {
+                                if (yytext[i]=='\n')
+                                    ++(parser->line);
+                            }
+                            parser->blockcomment = g_string_new(yytext);
 			}
-":="			{
-				/* Symbole dwuznakowe */
-				printf("TWOCHAR <%s>\n", yytext);
-			}
-"<>"			{
-				/* Symbole dwuznakowe */
-				printf("TWOCHAR <%s>\n", yytext);
+{COMMENT}({SPC}*{COMMENT})* { /* Komentarz zwykly  typu {...} lub (*...*) */
+                            /* Liczymy linijki w srodku. */
+                            int i;
+                            for (i=0; yytext[i]!='\0'; ++i) {
+                                if (yytext[i]=='\n')
+                                    ++(parser->line);
+                            }
+                            if (parser->codecomment!=NULL) {
+                                *(parser->codecomment) = g_string_new(yytext);
+                                parser->codecomment = NULL;
+                            }
 			}
-"<="			{
-				/* Symbole dwuznakowe */
-				printf("TWOCHAR <%s>\n", yytext);
+":="			{ /* Symbole dwuznakowe */
+                                parser->last_token = yytext;
+				return OP_DEFEQ;
 			}
-
-">="			{
-				/* Symbole dwuznakowe */
-				printf("TWOCHAR <%s>\n", yytext);
+"<>"			{ /* Symbole dwuznakowe */
+                                parser->last_token = yytext;
+				return OP_NEQ;
 			}
-
-".."			{
-				/* Symbole dwuznakowe */
-				printf("TWOCHAR <%s>\n", yytext);
+"<="			{ /* Symbole dwuznakowe */
+                                parser->last_token = yytext;
+				return OP_LEQ;
 			}
-
+">="			{ /* Symbole dwuznakowe */
+                                parser->last_token = yytext;
+				return OP_GEQ;
+			}
+".."			{ /* Symbole dwuznakowe */
+                                parser->last_token = yytext;
+				return OP_DOTDOT;
+			}
 "(."|"["		{
-				printf("CHARACTER <[>\n");
+                                parser->last_token = yytext;
+				return '[';
 			}
-
 ".)"|"]"		{
-				printf("CHARACTER <]>\n");
+                                parser->last_token = yytext;
+				return ']';
 			}
-[-+*/=^<>().,:;'@]	{
-				/* Pojedyncze dozwolone symbole */
-				printf("CHARACTER <%s>\n", yytext);
+[-+*/=^<>().,:;'@]	{ /* Pojedyncze dozwolone symbole */
+                                parser->last_token = yytext;
+				return yytext[0];
 			}
 {SPC}+			{ /* Pomijanie odstepow */ }
-\n			{ /* Liczenie linii */ }
-.			{
-				/* Bledy: znaki takie, jak &%~`{}\"?! */
-				printf("ILLEGAL <%s>\n", yytext);
-			}
-%%
-/*
-<<EOF>>			{
-				printf("EOF <%s>\n", yytext);
-				return;
-			}
-*/
+\n			{ /* Liczenie linii */ 
+                            ++(parser->line);
+                        }
+.			{ /* Bledy: znaki takie, jak &%~`{}\"?! 
+<<EOF>>			{  Koniec pliku 
+				return 0;
+			*/}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pascal.y	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,1719 @@
+%{
+#include <stdio.h>
+#include <glib.h>
+#include "symbols.h"
+#include "node.h"
+#include "node_new.h"
+#include "parser.h"
+#include "keywords.h"
+#include "utils.h"
+#ifdef DEBUG
+    #define YYDEBUG 1
+#endif /* DEBUG */
+#define YYERROR_VERBOSE
+#define YYLEX_PARAM parser
+#define YYPARSE_PARAM parser
+
+#define UP_YES ((Parser*)parser)->levelup = TRUE;
+#define UP_NO ((Parser*)parser)->levelup = FALSE;
+%}
+
+%pure_parser 				/* Nie chcemy globalnych zmiennych! Precz z globalnymi zmiennymi! */
+
+/* Typ danych dla tokenów. */
+%union {
+	char	       *string;		/* Dla stałych i ID_NAME */
+	StmtNode	*stmt;		/* Dla symboli */
+	SymbolNode      *symb;		/* Dla poleceń */
+	ExprNode	*expr;		/* Dla wyrażeń. */
+	GList	       *list;		/* Dla list. */
+}
+
+%{
+/* To musi byc wlaczone po zdefiniowaniu typu %union. */
+    void yyerror(const char *msg);
+    int yylex(YYSTYPE *lvalp, Parser *parser);
+%}
+
+/* Typy symboli nieterminalnych. */
+
+/* Listy */
+%type <list> id_name_list		/* Lista identyfikatorow. */
+%type <list> id_name_list_noup		/* Lista identyfikatorow bez zmiany przestrzeni nazw. */
+%type <list> stmt_list			/* Lista rozkazow */
+%type <list> with_stmt_head		/* Naglowek polecenia with, zwraca liste zmiennych */
+%type <list> variable_list		/* Lista zmiennych. */
+%type <list> expr_list			/* Lista wyrażeń. */
+%type <list> param_list			/* Lista parametrów formalnych procedury lub funkcji. */
+%type <list> enum_list			/* Lista stałych w typoe wyliczeniowym. */
+%type <list> simple_type_list		/* Lista typów prostych (w definicji tablicy). */
+%type <list> const_elem_list		/* Lista stłych elemtów zbioru, wliczając zbiór pusty. */
+%type <list> const_elem_list1		/* Niepusta lista stałych elementów zbioru. */
+%type <list> case_list
+%type <list> case_label_list
+%type <list> record_section
+%type <list> fixed_part
+%type <list> variant_list
+%type <list> typed_const_list
+%type <list> elem_list
+%type <list> elem_list1
+
+/* Stałe i identyfikatory */
+%type <string> id_name_noup	        /* Identyfikator bez zmiany przestrzeni nazw. */
+%type <string> unsigned_number		/* Stala numeryczna w wyrażeniach stałych. */
+%type <string> string			/* Stala lancuchowa */
+%type <string> expr_number		/* Stała numeryczna w wyrażeniach.
+
+/* Pomocnicze */
+%type <symb> record_variable_beginning   /* Naglowek odwolania do pola rekordu */
+%type <symb> record_type_head		 /* Początek definicji rekordu. */
+%type <symb> proc_heading_beginning	 /* początek nagłówka definicji procedury. */
+%type <symb> proc_heading		 /* Nagłówek definicji procedury. */
+%type <symb> func_heading_beginning	 /* Początek nagłówka definicji funkcji. */
+%type <symb> func_heading		 /* Nagłówek definicji funkci. */
+%type <symb> label			 /* Etykieta. */
+%type <symb> enum_const			 /* Stała w definicji typu wyliczeniowego. */
+%type <symb> tag_field
+%type <symb> variant_part
+
+/* Wyrażenia */
+%type <expr> case_label
+%type <expr> expr			/* Wyrażenie */
+%type <expr> const_expr			/* Wyrażenie stałe*/
+%type <expr> set_const                  /* Stała zbiorowa. */
+%type <expr> const_elem                 /* I jej elemnt. t*/
+%type <expr> array_const                /* Stała tablicowa. */
+%type <expr> record_const               /* Stała rekordowa. */
+%type <expr> typed_const                /* Stała złożona. */
+%type <expr> elem                       /* Element zbioru. */
+%type <expr> case_tag_list
+%type <expr> variant
+
+/* Poleceneia */
+%type <stmt> stmt			/* Pojedyncze polecenie */
+%type <stmt> unlabelled_stmt		/* Pojedyńcze polecenie bez etykiety. */
+%type <stmt> compound_stmt		/* Polecenie BEGIN...END */
+%type <stmt> block			/* Ciało procedury, funkcji lub programu. */
+%type <stmt> proc_block			/* Ciało procedury. */
+%type <stmt> if_stmt			/* Polecenie warunkowe. */
+%type <stmt> with_stmt			/* Polecenie WITH */
+%type <stmt> for_stmt			/* ... i tak dalej */
+%type <stmt> repeat_stmt
+%type <stmt> while_stmt
+%type <stmt> goto_stmt
+%type <stmt> assignment
+%type <stmt> proc_call
+%type <stmt> case_stmt
+%type <stmt> case
+%type <stmt> else_case
+
+/* Typy */
+%type <symb> type 
+%type <symb> fptype 			/* Typ parametru formalnego */
+%type <symb> pointer_type
+%type <symb> simple_type
+%type <symb> string_type
+%type <symb> structured_type 
+%type <symb> unpacked_structured_type 
+%type <symb> record_type 
+%type <symb> array_type 
+%type <symb> set_type 
+%type <symb> file_type
+
+/* Zmienne */
+%type <symb> variable
+
+/* Slowa kluczowe, poprzedzone 'K_' dla odroznienia od innych identyfikatorow (na przyklad FILE).  */
+
+%token
+K_AND		K_ABSOLUTE	K_ARRAY			K_BEGIN
+K_CASE		K_CONST		K_DIV			K_DOWNTO
+K_DO		K_ELSE		K_END			K_EXTERNAL
+K_FILE		K_FORWARD	K_FOR			K_FUNCTION
+K_GOTO		K_IF		K_IMPLEMENTATION 	K_INTERFACE
+K_IN		K_LABEL		K_MOD			K_NIL
+K_NOT		K_OF		K_OR			K_PACKED
+K_PROCEDURE	K_PROGRAM	K_RECORD		K_REPEAT
+K_SET		K_SHL		K_SHR			K_STRING
+K_THEN		K_TO		K_TYPE			K_UNIT
+K_UNTIL		K_USES		K_VAR			K_WHILE
+K_WITH		K_XOR
+
+%right K_THEN 
+%right K_ELSE            /* resolve dangling else */
+
+
+/* Wieloznakowe operatory. */
+%token
+OP_DOTDOT	/* .. */
+OP_DEFEQ	/* := */
+OP_LEQ		/* <= */
+OP_NEQ		/* <> */
+OP_GEQ		/* >= */
+
+/* Identyfikatory i stale.  */
+
+%token <symb> ID_FUNC		/* Identyfikator funkcji */
+%token <symb> ID_PROC		/* Identyfikator procedury */
+%token <symb> ID_VAR		/* Identyfikator zmiennej */
+%token <symb> ID_TYPE		/* Identyfikator typu */
+%token <symb> ID_LABEL		/* Identyfikator etykiety */
+%token <symb> ID_UNIT		/* Identyfikator jednostki */
+%token <symb> ID_CONST		/* Identyfikator stalej */
+%token <symb> ID_FIELD		/* Identyfikator pola rekordu */
+%token <string> ID_NAME 	/* Inny identyfikator, przed nadaniem mu znaczenia (przy deklaracji). */
+
+%token <string> CONST_INT 	/* Stala calkowita */
+%token <string> CONST_HEX 	/* Stala calkowita szesnastkowa*/
+%token <string> CONST_REAL 	/* Stala zmiennoprzecinkowa */
+%token <string> CONST_STRING 	/* Stala lancuchowa */
+%token <string> CONST_CHAR 	/* Stala lancuchowa jednoznakowa */
+
+/* Priorytety */
+
+/* Specjalne tokeny do rozwiazywania konfliktow */
+/*
+%nonassoc PREC_LOWER
+%nonassoc PREC_HIGHER
+*/
+
+/* Operatory relacji */
+%left '=' OP_NEQ '<' '>' OP_LEQ OP_GEQ K_IN
+%left OP_DOTDOT
+/* Operatory addytywne */
+%left '+' '-' K_OR K_XOR
+/* Operatory multiplikatywne */
+%left '*' '/' K_DIV K_MOD K_SHL K_SHR K_AND
+/* Operatory jednoargumentowe */
+%right OP_SIGN K_NOT '^'
+%left '@'
+
+/* Symbol startowy */
+%start compilation_unit
+
+%%
+
+compilation_unit
+	: program	
+	{
+	}
+	| unit		
+	{
+	}
+	;
+
+/* Programs: */
+program	: program_heading uses_clause block '.'
+	{
+		((Parser *)parser)->root->stmt = $3;
+	}
+	;
+
+program_heading
+	: /* empty */
+	{
+		/* ((Parser *)parser)->root = newProgNode(""); */
+		((Parser *)parser)->root = newSymbolNode(parser, "", SYM_PROG);
+		((Parser *)parser)->root->symbols = newNamespace();
+		//pushNamespace(parser, ((Parser *)parser)->root->symbols);
+		pushScope(parser, ((Parser *)parser)->root);
+	}
+	| K_PROGRAM ID_NAME ';'
+	{
+		/* ((Parser *)parser)->root = newProgNode($2); */
+		((Parser *)parser)->root = newSymbolNode(parser, $2, SYM_PROG);
+		((Parser *)parser)->root->symbols = newNamespace();
+		//pushNamespace(parser, ((Parser *)parser)->root->symbols);
+		pushScope(parser, ((Parser *)parser)->root);
+		g_free($2);
+	}
+	| K_PROGRAM ID_NAME '(' id_name_list ')' ';'
+	{
+		/* ((Parser *)parser)->root = newProgNode($2);
+		pushNamespace(parser, ((Parser *)parser)->root->globals); */
+		((Parser *)parser)->root = newSymbolNode(parser, $2, SYM_PROG);
+		((Parser *)parser)->root->symbols = newNamespace();
+		((Parser *)parser)->root->list = $4;
+		//pushNamespace(parser, ((Parser *)parser)->root->symbols);
+		pushScope(parser, ((Parser *)parser)->root);
+		g_free($2);
+	}
+	;
+
+uses_clause
+	: /* empty */
+	| K_USES id_name_list ';'
+	{
+		/* XXX Trzeba bedzie tez te unity sparsowac. */
+		GList *iter;
+		SymbolNode *node;
+
+                    for (iter=$2; iter!=NULL; iter=iter->next) {
+		    node = newSymbolNode(parser, iter->data, SYM_UNIT);
+		    registerSymbolNode(parser, node);
+		}
+		/* registerSymbolList(parser, $2, ID_UNIT); */
+		freeNameList($2);
+	}
+	;
+
+
+/* Listy identyfikatorow roznych rodzajow */
+id_name_list	: ID_NAME		/* Pierwszy element. */	
+	     {
+			/* Tworzymy pusta liste. */
+			/* I dodajemy do niej identyfikator. */
+			$$ = g_list_append(NULL, $1);
+		}
+		| id_name_list ',' ID_NAME	/* Kolejne elementy. */
+		{
+			/* Dodajemy kolejny identyfikator. */
+			$$ = g_list_append($1, $3);
+		}
+		;
+
+/* Specjalnie, jesli nie chcemy szukac takze w poprzednich tablicach symboli. */
+/* Przydatne przy deklaracjach */
+id_name_list_noup
+	: {UP_NO} id_name_list {UP_YES}
+	{
+		$$ = $2;
+	}
+	;
+
+id_name_noup
+	: {UP_NO} ID_NAME {UP_YES}
+	{
+		$$ = $2;
+	}
+	;
+
+/* Blok programu */
+block	: decl_sect_list compound_stmt
+      {
+		$$ = $2;
+	}
+	;
+
+/* Units: */
+unit	: unit_heading interface_part implementation_part initialization_part '.'
+     {
+	}
+	;
+
+unit_heading
+	: K_UNIT ID_NAME ';'
+	{
+                SymbolNode *node;
+
+                node = newSymbolNode(parser, $2, SYM_UNIT);
+                node->symbols = newNamespace();
+		pushScope(parser, ((Parser *)parser)->root);
+		g_free($2);
+	}
+	;
+
+interface_part
+	: K_INTERFACE uses_clause int_decl_sect_list
+	{
+	}
+	;
+
+implementation_part
+	: K_IMPLEMENTATION uses_clause decl_sect_list
+	{
+	}
+	;
+
+initialization_part
+	: compound_stmt
+	{
+	}
+	| K_END
+	{
+	}
+	;
+
+/* Declaration sections: */
+
+decl_sect_list
+	: /* empty */
+	| decl_sect_list decl_sect
+	;
+
+decl_sect
+	: label_decl_sect
+	| const_decl_sect
+	| type_decl_sect
+	| var_decl_sect
+	| proc_decl
+	| func_decl
+	;
+
+label_decl_sect
+	: K_LABEL label_list ';'
+	{ }
+	;
+
+label_list
+	: label_decl
+	| label_list ',' label_decl
+	;
+
+label	: CONST_INT
+	{
+	    $$ = findSymbol(parser, $1);
+	}
+		/* must be decimal integer in the range 0..9999 */
+	| ID_LABEL
+	;
+
+/* Uzywany przy deklarowaniu etykiet, kiedy jeszcze nie wiemy, ze ID to etykieta */
+label_decl
+	: CONST_INT
+	{
+		SymbolNode *node;
+
+node = newSymbolNode(parser, $1, SYM_LABEL);
+		registerSymbolNode(parser, node);
+		g_free($1);
+	}
+	| id_name_noup
+	{
+		SymbolNode *node;
+
+node = newSymbolNode(parser, $1, SYM_LABEL);
+		registerSymbolNode(parser, node);
+		g_free($1);
+	}
+	;
+
+const_decl_sect
+	: K_CONST const_decl
+	| const_decl_sect const_decl
+	;
+
+type_decl_sect
+	: K_TYPE type_decl
+	| type_decl_sect type_decl
+	;
+
+var_decl_sect
+	: K_VAR var_decl
+	| var_decl_sect var_decl
+	;
+
+/* Interface declaration sections: */
+
+/* These appear instead of normal declaration sections in the interface
+   part of a unit. The difference is that there are no label declarations
+   and for procedures and functions only the headings are given. */
+
+int_decl_sect_list
+	: /* empty */
+	| int_decl_sect_list int_decl_sect
+	;
+
+int_decl_sect
+	: const_decl_sect
+	| type_decl_sect
+	| var_decl_sect
+	| proc_heading
+	{
+	}
+	| func_heading
+	{
+	}
+	;
+
+/* Constant declarations: */
+
+const_decl
+	: id_name_noup '=' const_expr ';'
+	{
+		SymbolNode *node;
+
+                node = newSymbolNode(parser, $1, SYM_CONST);
+		registerSymbolNode(parser, node);
+                node->expr = $3;
+		g_free($1);
+	}
+	| id_name_noup ':' type '=' typed_const ';'
+	{
+		SymbolNode *node;
+
+                node = newSymbolNode(parser, $1, SYM_CONST);
+		registerSymbolNode(parser, node);
+		node->type = $3;
+                node->expr = $5;
+		g_free($1);
+	}
+	;
+
+/*
+
+Stara wersja wyrazenia stalego (tylko stala ze znakiem)
+const	: unsigned_number
+      {}
+	| sign unsigned_number
+	{}
+	| ID_CONST
+	{}
+	| sign ID_CONST
+	{}
+	| CONST_STRING
+	{}
+	;
+*/
+
+const_expr
+	: ID_CONST
+	{
+            $$ = newExprNode(parser, EXPR_CONST);
+            $$->symbol = $1;
+        }
+	| unsigned_number
+	{   
+            $$ = newExprNode(parser, EXPR_NUMBER);
+            $$->value = g_string_new($1);
+        }
+	| string
+	{   
+            $$ = newExprNode(parser, EXPR_STRING);
+            $$->value = g_string_new($1);
+        }
+	| K_NIL
+	{   
+            $$ = newExprNode(parser, EXPR_NIL);
+        }
+/* XXX Ta produkcja niestety konfliktuje ze stałymi tablicowymi i rekordowymi. Nie będzie nawiasów w stałych. */
+/*	| '(' const_expr ')'
+	{   
+            $$ = newExprNode(parser, EXPR_PAREN);
+        }
+*/
+	| const_expr '+' const_expr
+	{   
+            $$ = newExprNode(parser, EXPR_BIN);
+            $$->expr = $1;
+            $$->expr2 = $3;
+            $$->oper = OPER_PLUS;
+        }
+	| const_expr '-' const_expr
+	{   
+            $$ = newExprNode(parser, EXPR_BIN);
+            $$->expr = $1;
+            $$->expr2 = $3;
+            $$->oper = OPER_MINUS;
+        }
+	| const_expr '*' const_expr
+	{   
+            $$ = newExprNode(parser, EXPR_BIN);
+            $$->expr = $1;
+            $$->expr2 = $3;
+            $$->oper = OPER_STAR;
+        }
+	| const_expr '/' const_expr
+	{   
+            $$ = newExprNode(parser, EXPR_BIN);
+            $$->expr = $1;
+            $$->expr2 = $3;
+            $$->oper = OPER_SLASH;
+        }
+	| const_expr K_DIV const_expr
+	{   
+            $$ = newExprNode(parser, EXPR_BIN);
+            $$->expr = $1;
+            $$->expr2 = $3;
+            $$->oper = OPER_DIV;
+        }
+	| const_expr K_MOD const_expr
+	{   
+            $$ = newExprNode(parser, EXPR_BIN);
+            $$->expr = $1;
+            $$->expr2 = $3;
+            $$->oper = OPER_MOD;
+        }
+	| const_expr K_SHL const_expr
+	{   
+            $$ = newExprNode(parser, EXPR_BIN);
+            $$->expr = $1;
+            $$->expr2 = $3;
+            $$->oper = OPER_SHL;
+        }
+	| const_expr K_SHR const_expr
+	{   
+            $$ = newExprNode(parser, EXPR_BIN);
+            $$->expr = $1;
+            $$->expr2 = $3;
+            $$->oper = OPER_SHR;
+        }
+	| '+' const_expr %prec OP_SIGN
+	{   
+            $$ = newExprNode(parser, EXPR_UN);
+            $$->expr = $2;
+            $$->oper = OPER_PLUS;
+        }
+	| '-' const_expr %prec OP_SIGN
+	{   
+            $$ = newExprNode(parser, EXPR_UN);
+            $$->expr = $2;
+            $$->oper = OPER_MINUS;
+        }
+	;
+
+unsigned_number
+	: CONST_INT
+	{
+		/* Traktujemy wszystkie numery jak zmiennoprzecinkowe. */
+		$$ = $1;
+	}
+	| CONST_REAL
+	;
+
+/*
+sign	: '+' | '-'
+     ;
+*/
+
+typed_const
+	: const_expr
+	| array_const
+	| record_const
+	| set_const
+	;
+
+array_const
+	: '(' typed_const_list ')'
+        {
+            $$ = newExprNode(parser, EXPR_ARRAY);
+            $$->list = $2;
+        }
+	;
+
+typed_const_list
+	: typed_const
+        {
+            $$ = g_list_append(NULL, $1);
+        }
+	| typed_const_list ',' typed_const
+        {
+            $$ = g_list_append($1, $3);
+        }
+	;
+
+record_const
+	: '(' const_field_list ')'
+        {
+        }
+	;
+
+const_field_list
+	: const_field
+	| const_field_list ',' const_field
+	;
+
+const_field
+	: ID_FIELD ':' typed_const
+	{}
+	;
+
+set_const
+	: '[' const_elem_list ']'
+	{
+            $$ = newExprNode(parser, EXPR_SET);
+            $$->list = $2;
+	}
+	;
+
+const_elem_list
+	: /* empty */
+        {
+            $$ = NULL;  /* Zbiór pusty. */
+        }
+	| const_elem_list1
+	;
+
+const_elem_list1
+	: const_elem
+        {
+            $$ = g_list_append(NULL, $1);
+        }
+	| const_elem_list1 ',' const_elem
+        {
+            $$ = g_list_append($1, $3);
+        }
+	;
+
+const_elem
+	: const_expr
+	| const_expr OP_DOTDOT const_expr
+	{
+            $$ = newExprNode(parser, EXPR_RANGE);
+            $$->expr = $1;
+            $$->expr2 = $3;
+        }
+	;
+
+/* Type declarations: */
+
+type_decl
+	: id_name_noup '=' type ';'
+	{
+		/* Zmieniamy nazwe typu. */
+		g_string_free($3->name, TRUE);
+		$3->name = g_string_new($1);
+		/* Wpisujemy do tablicy nazw. */
+		registerSymbolNode(parser, $3);
+		g_free($1);
+	}
+	;
+
+type	: simple_type
+        | pointer_type
+	| structured_type
+	| string_type
+	;
+
+simple_type
+	: ID_TYPE
+	| const_expr OP_DOTDOT const_expr	/* subrange */
+	{
+		$$ = newSymbolNode(parser, "<subrange>", SYM_TYPE_SUBRANGE);
+		$$->expr = newExprNode(parser, EXPR_RANGE);
+		$$->expr->expr = $1;
+		$$->expr->expr2 = $3;
+	}
+	| '(' enum_list ')'	/* enumeration */
+	{
+		$$ = newSymbolNode(parser, "<enumeration>", SYM_TYPE_ENUM);
+                $$->list = $2;
+		freeNameList($2);
+	}
+	;
+
+
+enum_list
+        : enum_const
+        {
+            $$ = g_list_append(NULL, $1);
+        }
+        | enum_list ',' enum_const
+        {
+            $$ = g_list_append($1, $3);
+        }
+        ;
+
+enum_const
+        : ID_CONST	/* Używamy istniejących stałych lub: */
+        | ID_NAME
+        {
+		/* Tworzymy nowe stałe. */
+                $$ = newSymbolNode(parser, $1, SYM_CONST);
+                registerSymbolNode(parser, $$);
+        }
+        ;
+
+
+/* XXX uwaga! Turbo Pascal pozwala na definiowanie wskaźników do nieznanych typów! */
+pointer_type
+	: '^' ID_TYPE
+	{
+		$$ = newSymbolNode(parser,"<pointer>", SYM_TYPE_POINTER);
+                $$->type = $2;
+	}
+        | '^' ID_NAME
+        {
+		$$ = newSymbolNode(parser,"<pointer>", SYM_TYPE_POINTER);
+                /* XXX Trzeba coś wymyślić, żeby potem połączyć to z właściwym typem! */
+        }
+	;
+
+structured_type
+	: unpacked_structured_type
+	{
+		$$ = $1;
+	}
+	| K_PACKED unpacked_structured_type
+	{
+		$$ = $2;
+	}
+	;
+
+unpacked_structured_type
+	: array_type
+	| record_type
+	| set_type
+	| file_type
+	;
+
+array_type
+	: K_ARRAY '[' simple_type_list ']' K_OF type
+	{
+	/*
+		$$ = newTypeNode("<array>");
+		$$->base = $6;
+		$$->mod = TYPEMOD_ARRAY; */
+		$$ = newSymbolNode(parser,"<array>", SYM_TYPE_ARRAY);
+                $$->list = $3;
+		$$->type = $6;
+	}
+	;
+
+simple_type_list
+	: simple_type
+	{
+            $$ = g_list_append(NULL, $1);
+        }
+	| simple_type_list ',' simple_type
+	{
+            $$ = g_list_append($1, $3);
+        }
+	;
+
+record_type_head
+	: K_RECORD
+	{
+	    $$ = newSymbolNode(parser,"<record>", SYM_TYPE_RECORD);
+	    $$->symbols = newNamespace();
+	    pushScope(parser, $$);
+	}
+	;
+
+record_type
+	: record_type_head fixed_part K_END
+	{
+	    $$ = $1;
+            $$->list = $2;
+	    popScope(parser);
+	}
+	| record_type_head variant_part K_END
+	{
+	    $$ = $1;
+            $$->base = $2;
+	    popScope(parser);
+	}
+	| record_type_head fixed_part ';' variant_part K_END
+	{
+	    $$ = $1;
+            $$->list = $2;
+            $$->base = $4;
+	    popScope(parser);
+	}
+	;
+
+
+fixed_part
+	: record_section
+	| fixed_part ';' record_section
+	{
+		$$ = g_list_append($1, $3);
+	}
+	;
+
+record_section
+	: /* empty */
+	{
+	    $$ = NULL; 
+	}
+	| id_name_list_noup ':' type
+	{
+		GList *iter;
+		SymbolNode *node;
+
+		$$ = NULL;
+		for(iter=$1; iter!=NULL; iter=iter->next) {
+		    node = newSymbolNode(parser,iter->data, SYM_VAR_FIELD);
+		    registerSymbolNode(parser, node);
+		    node->type = $3;
+		    $$ = g_list_append($$, node);
+		}
+		freeNameList($1);
+	}
+	;
+
+variant_part
+	: K_CASE tag_field K_OF variant_list
+        {
+            $2->list = $4;
+            $$ = $2;
+        }
+	;
+
+tag_field
+	: ID_NAME
+	{
+	    $$ = newSymbolNode(parser, $1, SYM_TAG_FIELD);
+	    g_free($1);
+	}
+	| ID_NAME ':' ID_TYPE
+	{
+	    $$ = newSymbolNode(parser, $1, SYM_TAG_FIELD);
+	    $$->type = $3;
+	    g_free($1);
+	}
+	;
+
+variant_list
+	: variant
+        {
+            $$ = g_list_append(NULL, $1);
+        }
+	| variant_list ';' variant
+        {
+            $$ = g_list_append($1, $3);
+        }
+	;
+
+variant	: /* empty */
+        {
+            $$ = NULL;
+        }
+	| case_tag_list ':' '(' fixed_part ')'
+	{
+            $$ = newExprNode(parser, EXPR_VARIANT);
+            $$->expr = $1;
+            $$->list = $4;
+	}
+	| case_tag_list ':' '(' variant_part ')'
+	{
+            $$ = newExprNode(parser, EXPR_VARIANT);
+            $$->expr = $1;
+            $$->symbol = $4;
+	}
+	| case_tag_list ':' '(' fixed_part ';' variant_part ')'
+	{
+            $$ = newExprNode(parser, EXPR_VARIANT);
+            $$->expr = $1;
+            $$->list = $4;
+            $$->symbol = $6;
+	}
+	;
+
+case_tag_list
+	: const_expr
+	{
+            $$ = newExprNode(parser, EXPR_CASES);
+	    $$->list = g_list_append(NULL, $1);
+	}
+	| case_tag_list ',' const_expr
+	{
+            $$ = $1;
+	    $$->list = g_list_append($1->list, $3);
+	}
+	;
+
+set_type
+	: K_SET K_OF simple_type
+	{
+	    $$ = newSymbolNode(parser,"<set>", SYM_TYPE_SET);
+	    $$->type = $3;
+	}
+	;
+
+file_type
+	: K_FILE K_OF type
+	{
+	    $$ = newSymbolNode(parser,"<file>", SYM_TYPE_FILE);
+	    $$->type = $3;
+	}
+	| K_FILE
+	{
+	    $$ = newSymbolNode(parser,"<file>", SYM_TYPE_FILE);
+	}
+	;
+
+string_type
+	: K_STRING
+	{
+	    $$ = newSymbolNode(parser,"<string>", SYM_TYPE_STRING);
+	}
+	| K_STRING '[' const_expr ']'
+	{
+	    $$ = newSymbolNode(parser,"<string>", SYM_TYPE_STRING);
+	    $$->expr = $3;
+	}
+	;
+
+/* Variable declarations: */
+
+/* XXX hack -- nie szukamy nazw zmiennych w poprzednich tablicach! */
+var_decl
+	: id_name_list_noup ':' type absolute_clause ';'
+	{
+		/* Rejestrujemy po kolei kazda zmienna. */
+		GList *iter;
+		SymbolNode *node;
+
+		for(iter = $1; iter != NULL; iter = iter->next) {
+		    node = newSymbolNode(parser,iter->data, SYM_VAR_LOCAL);
+		    registerSymbolNode(parser, node);
+		    node->type = $3;
+		}
+		/*registerVarList(parser, $1, VARMOD_LOCAL,$3);*/
+		/* Usuwamy sama liste. */
+		freeNameList($1);
+	}
+	;
+
+absolute_clause
+	: /* empty */
+	{}
+	| K_ABSOLUTE CONST_INT ':' CONST_INT
+	{}
+	| K_ABSOLUTE ID_VAR
+	{}
+	;
+
+/* Procedure and function declarations: */
+
+proc_decl
+	: proc_heading proc_block ';'
+	{
+		$1->stmt = $2;
+                popScope(parser);
+	}
+	;
+
+func_decl
+	: func_heading proc_block ';'
+	{
+		$1->stmt = $2;
+                popScope(parser);
+	}
+	;
+
+/* XXX Hack -- nazwa funkcji/procedury musi istniec zanim wczytamy parametry. */
+/* XXX Funkcja/procedura mogla byc juz zadeklarowana. */
+proc_heading_beginning
+	: K_PROCEDURE id_name_noup 
+	{
+	    $$ = newSymbolNode(parser,$2, SYM_PROC);
+	    registerSymbolNode(parser, $$);
+	    $$->symbols = newNamespace();
+	    pushScope(parser, $$);
+	    g_free($2);
+	}
+	| K_PROCEDURE {UP_NO} ID_PROC {UP_YES} 
+	{
+		pushScope(parser, $3);
+		$$ = $3;
+	}
+	;
+
+func_heading_beginning
+	: K_FUNCTION id_name_noup
+	{
+	    $$ = newSymbolNode(parser,$2, SYM_FUNC);
+	    registerSymbolNode(parser, $$);
+	    $$->symbols = newNamespace();
+	    pushScope(parser, $$);
+	    g_free($2);
+	}
+	| K_FUNCTION {UP_NO} ID_FUNC {UP_YES}
+	{
+		pushScope(parser, $3);
+		$$ = $3;
+	}
+	;
+
+proc_heading
+	: proc_heading_beginning fp_list ';'
+	;
+
+func_heading
+	: func_heading_beginning fp_list ':' fptype ';'
+        {
+            $$ = $1;
+            $$->type = $4;
+        }
+	;
+
+proc_block         	/* omitted inline and interrupt */
+	: block
+	| K_EXTERNAL
+	{
+		$$ = NULL;
+	}
+	| K_FORWARD
+	{
+		$$ = NULL;
+	}
+	;
+
+fp_list : /* empty */
+	| '(' fp_sect_list ')'
+	;
+
+fp_sect_list
+	: fp_sect
+	| fp_sect_list ';' fp_sect
+	;
+
+fp_sect	: id_name_list_noup ':' fptype
+	{
+		/* Rejestrujemy po kolei kazda zmienna. */
+		GList *iter;
+		SymbolNode *node;
+//                SymbolNode *parent;
+
+                for(iter=$1; iter!=NULL; iter=iter->next) {
+			node = newSymbolNode(parser, iter->data, SYM_VAR_PARAM);
+			node->type = $3;
+			registerSymbolNode(parser, node);
+                        //parent = ((SymbolNode *)((Parser *)parser)->scopes->data);
+                        node->parent->list = g_list_append(node->parent->list, node);
+		}
+		/* Usuwamy sama liste. */
+		freeNameList($1);
+	}
+	| K_VAR id_name_list_noup ':' fptype
+	{
+                GList *iter;
+		SymbolNode *node;
+ //               SymbolNode *parent;
+
+                for(iter=$2; iter!=NULL; iter=iter->next) {
+			node = newSymbolNode(parser, iter->data, SYM_VAR_VARPARAM);
+			node->type = $4;
+			registerSymbolNode(parser, node);
+   //                     parent = ((SymbolNode *)((Parser *)parser)->scopes->data);
+                        node->parent->list = g_list_append(node->parent->list, node);
+		}
+		freeNameList($2);
+	}
+	| K_VAR id_name_list_noup
+	{
+		/* parametr bez typu? */
+		/* registerVarList(parser, $2, VARMOD_VARPARAM, NULL);*/
+		GList *iter;
+		SymbolNode *node;
+//                SymbolNode *parent;
+
+                for(iter=$2; iter!=NULL; iter=iter->next) {
+			node = newSymbolNode(parser, iter->data, SYM_VAR_VARPARAM);
+			registerSymbolNode(parser, node);
+  //                      parent = ((SymbolNode *)((Parser *)parser)->scopes->data);
+                        node->parent->list = g_list_append(node->parent->list, node);
+		}
+		freeNameList($2);
+	}
+	;
+
+fptype	: ID_TYPE
+       {
+		$$ = $1;
+	}
+	| K_STRING
+	{
+		$$ = NULL;
+	}
+	;
+
+/* Statements: */
+
+stmt	: unlabelled_stmt
+     	{
+		$$ = $1;
+	}
+	| label ':' unlabelled_stmt
+	{
+		$$ = $3;
+		$$->label = $1;
+	}
+	;
+
+unlabelled_stmt
+	: /* empty */
+	{
+		$$ = NULL;
+	}
+	| assignment
+	| proc_call
+	| goto_stmt
+	| compound_stmt
+	| if_stmt
+	| case_stmt
+	| repeat_stmt
+	| while_stmt
+	| for_stmt
+	| with_stmt
+	;
+
+assignment
+	: variable OP_DEFEQ expr
+	{
+	    $$ = newStmtNode(parser, STMT_ASSIGN);
+	    $$->symbol = $1;
+	    $$->expr = $3;
+	}
+	;
+
+proc_call
+	: ID_PROC param_list
+	{
+	    $$ = newStmtNode(parser, STMT_PROC);
+	    $$->symbol = $1;
+	    $$->list = $2;
+	}
+	;
+
+param_list
+	: /* empty */
+	{
+	    $$ = NULL;
+	}
+	| '(' expr_list ')'
+	{
+	    $$ = $2;
+	}
+	;
+
+expr_list
+	: expr
+	{
+		$$ = NULL;
+		$$ = g_list_append($$, (gpointer)$1);
+	}
+	| expr_list ',' expr
+	{
+		$$ = g_list_append($1, (gpointer)$3);
+	}
+	;
+
+goto_stmt
+	: K_GOTO label
+	{
+	    $$ = newStmtNode(parser, STMT_GOTO);
+	    $$->symbol = $2;
+	}
+	;
+
+compound_stmt
+	: K_BEGIN stmt_list K_END
+	{
+		$$ = newStmtNode(parser, STMT_BLOCK);
+		$$->list = $2;
+	}
+	;
+
+stmt_list
+	: stmt
+	{
+		$$ = NULL;
+		$$ = g_list_append($$, (gpointer)$1);
+	}
+	| stmt_list ';' stmt
+	{
+		$$ = g_list_append($1, (gpointer)$3);
+	}
+	;
+
+if_stmt	: K_IF expr K_THEN stmt
+	{
+	    $$ = newStmtNode(parser, STMT_IF);
+	    $$->expr = $2;
+	    $$->stmt = $4;
+	}
+	| K_IF expr K_THEN stmt K_ELSE stmt
+	{
+	    $$ = newStmtNode(parser, STMT_IF);
+	    $$->expr = $2;
+	    $$->stmt = $4;
+	    $$->stmt2 = $6;
+	}
+	;
+
+case_stmt
+	: K_CASE expr K_OF case_list else_case K_END
+	{
+		$$ = newStmtNode(parser, STMT_CASE_HEAD);
+		$$->expr = $2;
+		$$->list = $4;
+		$$->stmt = $5;
+	}
+	;
+
+case_list
+	: case
+	{
+		$$ = g_list_append(NULL, $1);
+	}
+	| case_list ';' case
+	{
+		$$ = g_list_append($1, $3);
+	}
+	;
+
+case	
+        : /* empty */
+	{
+		$$ = NULL;
+	}
+        | case_label_list ':' stmt
+	{
+		$$ = newStmtNode(parser, STMT_CASE_CASE);
+		$$->list = $1;
+		$$->stmt = $3;
+	}
+	;
+
+case_label_list
+	: case_label
+	{
+		$$ = g_list_append(NULL, $1);
+	}
+	| case_label_list ',' case_label
+	{
+		$$ = g_list_append($1, $3);
+	}
+	;
+
+case_label
+	: const_expr
+	| const_expr OP_DOTDOT const_expr
+	{
+		$$ = newExprNode(parser, EXPR_RANGE);
+		$$->expr = $1;
+		$$->expr2 = $3;
+	}
+	;
+
+else_case
+	: /* empty */
+	{
+		$$ = NULL;
+	}
+	| K_ELSE stmt
+	{
+		$$ = $2;
+	}
+	| K_ELSE stmt ';'
+	{
+		$$ = $2;
+	}
+	;
+
+repeat_stmt
+	: K_REPEAT stmt_list K_UNTIL expr
+	{
+	    $$ = newStmtNode(parser, STMT_REPEAT);
+	    $$->list = $2;
+	    $$->expr = $4;
+	}
+	;
+
+while_stmt
+	: K_WHILE expr K_DO stmt
+	{
+	    $$ = newStmtNode(parser, STMT_WHILE);
+	    $$->stmt = $4;
+	    $$->expr = $2;
+	}
+	;
+
+for_stmt
+	: K_FOR variable OP_DEFEQ expr K_TO expr K_DO stmt
+	{
+		$$ = newStmtNode(parser, STMT_FOR);
+		$$->symbol = $2;
+		$$->expr = $4;
+		$$->expr2 = $6;
+		$$->stmt = $8;
+	}
+	| K_FOR variable OP_DEFEQ expr K_DOWNTO expr K_DO stmt
+	{
+		$$ = newStmtNode(parser, STMT_FOR_DOWN);
+		$$->symbol = $2;
+		$$->expr = $4;
+		$$->expr2 = $6;
+		$$->stmt = $8;
+	}
+	;
+
+with_stmt_head
+	: K_WITH variable_list 
+	{
+	    GList *iter;
+	    SymbolNode *node;
+
+	    for (iter = $2; iter!=NULL; iter=iter->next) {
+		node = (SymbolNode *)iter->data;
+		if (node->type->symbols!=NULL) {
+		    pushScope(parser, node->type);
+		} else {
+		    yyerror("Record variable expected!");
+		    return 1;
+		}
+	    }
+	    $$ = $2;
+	}
+	;
+
+with_stmt
+	: with_stmt_head K_DO stmt
+	{
+	    GList *iter;
+
+	    $$ = newStmtNode(parser, STMT_WITH);
+	    $$->list = $1;
+	    $$->stmt = $3;
+
+	    for (iter = $1; iter!=NULL; iter=iter->next) {
+		popScope(parser);
+	    }
+	}
+	;
+
+variable_list
+	: variable
+	{
+	    $$ = NULL;
+	    $$ = g_list_append($$, $1);
+	}
+	| variable_list ',' variable
+	{
+	    $1 = g_list_append($1, $3);
+	    $$ = $1;
+	}
+	;
+
+/* Variables: */
+
+record_variable_beginning
+	: variable '.'
+	{
+		/* Zmienic tablice symboli na ta od odpowiedniego rekordu. */
+		/* W zaleznosci od typu zmiennej variable. */
+		$$ = $1;
+		pushScope(parser, $1->type);
+		UP_NO;
+	}
+	;
+
+variable
+	: ID_VAR
+	{
+		$$ = $1;
+	}
+	| variable '[' expr_list ']'		/* array component */
+	{
+		$$ = newSymbolNode(parser, $1->name->str, SYM_VAR_DEARR);
+		$$->base = $1;
+		$$->list = $3;
+	}
+	| record_variable_beginning ID_FIELD 		/* record field */
+	{
+		$$ = newSymbolNode(parser, $2->name->str, SYM_VAR_FIELD);
+		$$->type=$2->type;
+		/* przepisać wszystko */
+		$$->base = $1;
+		UP_YES;
+		popScope(parser);
+	}
+	| ID_FIELD				/* record field inside with statement */
+	| variable '^'				/* pointer value */
+	{
+		$$ = newSymbolNode(parser, $1->name->str, SYM_VAR_DEREF);
+		$$->base = $1;
+	}
+	| ID_TYPE '(' variable ')'		/* type cast */
+	{
+		$$ = newSymbolNode(parser, $3->name->str, SYM_VAR_CAST);
+		$$->base = $3;
+		$$->type = $1;
+	}
+	;
+
+
+expr_number
+	: CONST_INT
+	| CONST_REAL
+	| CONST_HEX
+	;
+
+/* Expressions: */
+
+expr	: variable
+     	{
+	    $$ = newExprNode(parser, EXPR_VAR);
+	    $$->symbol = $1;
+	}
+	| ID_CONST
+	{
+	    $$ = newExprNode(parser, EXPR_CONST);
+	    $$->symbol = $1;
+	}
+	| expr_number
+	{
+	    $$ = newExprNode(parser, EXPR_NUMBER);
+	    $$->value = g_string_new($1);
+	}
+	| string
+	{
+	    $$ = newExprNode(parser, EXPR_STRING);
+	    $$->value = g_string_new($1);
+	}
+	| K_NIL
+	{
+	    $$ = newExprNode(parser, EXPR_NIL);
+	}
+	| '@' variable
+	{
+	    $$ = newExprNode(parser, EXPR_ADDR);
+	    $$->symbol = $2;
+	}
+	| '(' expr ')'
+	{
+	    $$ = newExprNode(parser, EXPR_PAREN);
+	    $$->expr = $2;
+	}
+	| ID_FUNC '(' expr_list ')'
+	{
+	    $$ = newExprNode(parser, EXPR_FUNC);
+	    $$->symbol = $1;
+	    $$->list = $3;
+	}
+	| '[' elem_list ']'
+	{
+	    $$ = newExprNode(parser, EXPR_SET);
+	    $$->list = $2;
+	}
+	| expr '+' expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_PLUS;
+	}
+	| expr '-' expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_MINUS;
+	}
+	| expr '*' expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_STAR;
+	}
+	| expr '/' expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_SLASH;
+	}
+	| expr K_DIV expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_DIV;
+	}
+	| expr K_MOD expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_MOD;
+	}
+	| expr K_SHL expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_SHL;
+	}
+	| expr K_SHR expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_SHR;
+	}
+	| '+' expr %prec OP_SIGN
+	{
+	    $$ = newExprNode(parser, EXPR_UN);
+	    $$->expr = $2;
+            $$->oper = OPER_PLUS;
+	}
+	| '-' expr %prec OP_SIGN
+	{
+	    $$ = newExprNode(parser, EXPR_UN);
+	    $$->expr = $2;
+            $$->oper = OPER_MINUS;
+	}
+	| K_NOT expr
+	{
+	    $$ = newExprNode(parser, EXPR_UN);
+	    $$->expr = $2;
+            $$->oper = OPER_NOT;
+	}
+	| expr K_OR expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_OR;
+	}
+	| expr K_XOR expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_XOR;
+	}
+	| expr K_AND expr
+	{
+	    $$ = newExprNode(parser, EXPR_BIN);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_AND;
+	}
+	| expr '=' expr
+	{
+	    $$ = newExprNode(parser, EXPR_EQ);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_EQ;
+	}
+	| expr '>' expr
+	{
+	    $$ = newExprNode(parser, EXPR_EQ);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_GT;
+	}
+	| expr '<' expr
+	{
+	    $$ = newExprNode(parser, EXPR_EQ);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_LT;
+	}
+	| expr OP_NEQ expr
+	{
+	    $$ = newExprNode(parser, EXPR_EQ);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_NEQ;
+	}
+	| expr OP_LEQ expr
+	{
+	    $$ = newExprNode(parser, EXPR_EQ);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_LEQ;
+	}
+	| expr OP_GEQ expr
+	{
+	    $$ = newExprNode(parser, EXPR_EQ);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_GEQ;
+	}
+	| expr K_IN expr
+	{
+	    $$ = newExprNode(parser, EXPR_EQ);
+	    $$->expr = $1;
+	    $$->expr2 = $3;
+            $$->oper = OPER_IN;
+	}
+	;
+
+/*
+	Stara wersja wyrazenia
+
+expr	: simple_expr
+     | simple_expr relop simple_expr
+	;
+
+relop	: '=' | OP_NEQ | '<' | '>' | OP_LEQ | OP_GEQ | K_IN
+      ;
+
+simple_expr
+	: term
+	| sign term
+	| simple_expr addop term
+	;
+
+addop	: '+' | '-' | K_OR | K_XOR
+      ;
+
+term	: factor
+     | term mulop factor
+	;
+
+mulop	: '*' | '/' | K_DIV | K_MOD | K_SHL | K_SHR | K_AND
+      ;
+
+factor	: variable
+       | ID_CONST
+	{}
+	| CONST_INT
+	{}
+	| CONST_REAL
+	{}
+	| CONST_STRING
+	{}
+	| '[' elem_list ']'
+	| K_NIL
+	| '@' variable
+	| '(' expr ')'
+	| ID_FUNC '(' expr_list ')'
+	{}
+	| K_NOT factor
+	;
+
+*/
+
+elem_list
+	: /* empty */
+        {
+            $$ = NULL;
+        }
+	| elem_list1
+	;
+
+elem_list1
+	: elem
+        {
+            $$ = g_list_append(NULL, $1);
+        }
+	| elem_list1 ',' elem
+        {
+            $$ = g_list_append($1, $3);
+        }
+	;
+
+elem	: expr
+	| expr OP_DOTDOT expr
+	{
+            $$ = newExprNode(parser, EXPR_RANGE);
+            $$->expr = $1;
+            $$->expr2 = $3;
+        }
+	;
+
+string	: CONST_STRING
+       {
+		$$ = $1;
+	}
+	| CONST_CHAR
+	{
+		$$ = $1;
+	}
+	;
+
+%%
+
+void
+yyerror(const char *msg)
+{
+    fprintf(stderr, "%s\n", msg);
+}
+
--- a/sample.pas	Sat Oct 13 21:11:54 2012 +0200
+++ b/sample.pas	Sat Oct 13 21:14:50 2012 +0200
@@ -1,16 +1,70 @@
-PROGRAM Sample;
+PROGRAM Sample(param1, param2);
+    USES crt;
+
+    TYPE	int = 1..254;
+                r =  RECORD
+                    x,y: int;
+                    CASE s: int OF
+                        1: ( z: 1..2;);
+                        2: ( 
+                            f: STRING[3];
+                            CASE sigma: int OF
+                                1: (alpha: STRING );
+                           );
+                END;
 
-{ Comment 1 *) }
-(* Comment 2 } *)
+    VAR 	v: int;
+            rr: r;
+
+    CONST   z:SET OF int = [1, 3..5, 8, 2..8];
+    CONST   q: ARRAY [0..10,3..5] OF int = ((1,2,3,4,5),(1,2,3,4,5),(1,2,3,4,5),(1,2,3,4,5));
+
+    { (* Comment 1 *) }
+    (* ( Comment 2 } *)
+
+
+
+    { To jest komentarz blokowy
+      Przed procedura Smpl_1
+      To jest ostatnia linia }
 
-PROCEDURE Smpl_1;
-VAR	v: integer;
-BEgIN
-	v := (1+2)*2;
-END;
+    PROCEDURE Smpl_1(a,b: int; var c: int);
+        VAR	v: 1..3;
+        BEgIN
+                v := -(1+2)*2; { Bardzo prosta procedura. }
+        END;
+
+    FUNCTION Smpl_2: int;   { Moze jeszcze funkcja? }
+        BEGIN
+        END;
+
+    VAR     c: SET OF int;
+    LABEL   et1;
 
-BEGIN
-	IF (1 >= $02) THEN BEGIN
-	END;
-	WriteLn('Hello world!'^I''''#64 + 'Hi!');
-END.
+    BEGIN
+            rr.x := 0;	{ To jest komentarz w kodzie. }
+            rr.y := rr.x + 1;
+            IF (1 >= +$02) THEN BEGIN
+                Smpl_1('Hello world!'^I''''#64 + 'Hi!');
+            END;
+et1:        with rr do {dziwne miejsce} begin
+                    x := y;
+                    c := [] + z;
+            end;
+            CASE v OF
+                1: GOTO et1;
+                2..10: BEGIN
+                        Smpl_1('Hello world!');
+                        c := [657, 54, 1..3];
+                       END;
+                1,3,6: ;
+                ELSE rr.x := 3;
+            END;
+            FOR rr.x := rr.y TO (rr.x + 44) * 2 DO BEGIN
+                v:=v+1;
+	    END;
+	    REPEAT
+	    	Smpl_1(1);
+	    UNTIL [] in z;
+	    WHILE 3+1>0 DO v:=[];
+    END.
--- a/symbols.c	Sat Oct 13 21:11:54 2012 +0200
+++ b/symbols.c	Sat Oct 13 21:14:50 2012 +0200
@@ -2,112 +2,28 @@
 
 #include <glib.h>
 #include "symbols.h"
+#include "node.h"
 
-/* Tworzy nowa przestrzen nazw o podanym wlascicielu. */
+/* Tworzy nowa przestrzen nazw */
 Namespace      *
-newNamespace(Symbol * owner)
+newNamespace()
 {
     Namespace      *nam;
 
     nam = g_new(Namespace, 1);
-    nam->owner = owner;
     nam->table = g_hash_table_new(g_str_hash, g_str_equal);
+    nam->list = NULL;
     return nam;
 }
 
-/* niszczy poszczegolne elementy tablicy w przestrzeni nazw. */
-void
-foreachDestroyNamespace(gpointer name, gpointer symbol, gpointer user_data)
-{
-    destroySymbol(symbol);
-    g_free(name);
-}
-
 /* Niszczy przestrzen nazw. */
 void
 destroyNamespace(Namespace * nam)
 {
     if (nam == NULL)
         return;
-    g_hash_table_foreach(nam->table, foreachDestroyNamespace, NULL);
     g_hash_table_destroy(nam->table);
+    g_list_free(nam->list);
     g_free(nam);
-    nam = NULL;
-}
-
-/* Tworzy nowy symbol. */
-Symbol         *
-newSymbol(const char *name, int token, Type * type)
-{
-    Symbol         *sym;
-
-    sym = g_new(Symbol, 1);
-    sym->name = g_string_new(name);
-    sym->contained = NULL;
-    sym->namespace = NULL;
-    sym->token = token;
-    sym->type = type;
-    return sym;
-}
-
-/* Niszczy symbol (nie usuwa go z przestrzeni nazw!) */
-void
-destroySymbol(Symbol * sym)
-{
-    if (sym == NULL)
-        return;
-    g_string_free(sym->name, TRUE);
-    destroyNamespace(sym->namespace);
-    destroyType(sym->type);
-    g_free(sym);
-    sym = NULL;
 }
 
-/* Tworzy nowy opis typu. */
-Type           *
-newType(Symbol * base)
-{
-    Type           *type;
-
-    type = g_new(Type, 1);
-    type->base = base;
-    type->mods = g_string_new("");
-    return type;
-}
-
-/* Niszczy opis typu. */
-void
-destroyType(Type * type)
-{
-    if (type == NULL)
-        return;
-    g_string_free(type->mods, TRUE);
-    g_free(type);
-}
-
-/* Dodaje symbol do przestrzeni nazw. */
-void
-addSymbol(Namespace * nam, Symbol * sym)
-{
-    GString        *key;
-
-    key = g_string_new(sym->name->str);
-    key = g_string_up(key);
-    g_hash_table_insert(nam->table, (gpointer) (key->str), (gpointer) sym);
-    g_string_free(key, FALSE);
-    sym->contained = nam;
-}
-
-/* Wyszukuje symbol w przestrzeni nazw. */
-Symbol*
-getSymbol(Namespace * nam, char *name)
-{
-    Symbol         *sym;
-    GString        *key;
-
-    key = g_string_new(name);
-    key = g_string_up(key);
-    sym = g_hash_table_lookup(nam->table, (gpointer) (key->str));
-    g_string_free(key, TRUE);
-    return sym;
-}
--- a/symbols.h	Sat Oct 13 21:11:54 2012 +0200
+++ b/symbols.h	Sat Oct 13 21:14:50 2012 +0200
@@ -1,51 +1,19 @@
 #ifndef SYMBOLS_H
 #define SYMBOLS_H
 
-/* Opis typu symbolu. */
-struct Type {
-    Symbol         *base;                                  /* Typ bazowy. */
-    GString        *mods;                                  /* Informacje o wskaznikach, tablicach, plikach itp. */
-};
-typedef struct Type Type;
-
-/* Opis symbolu. */
-struct Symbol {
-    GString        *name;                                  /* Oryginalna nazwa symbolu (z zachowana wielkoscia liter). */
-    Namespace      *contained;                             /* Do jakiej przestrzeni nalezy ten symbol. */
-    Namespace      *namespace;                             /* Wlasna przestrzen nazw. */
-    int             token;                                 /* Jakiego jest typu (jaki zwraca token). */
-    Type           *type;                                  /* Jakiego jest typu. */
-};
-typedef struct Symbol Symbol;
+#include <glib.h>
 
 /* Przestrzen nazw. */
 struct Namespace {
-    Symbol         *owner;                                 /* Do jakiego symbolu nalezy ta przestrzen. */
     GHashTable     *table;                                 /* Tablica symboli. */
+    GList          *list;                                  /* Lista symboli (potrzebujemy kolejność!). */
 };
 typedef struct Namespace Namespace;
 
-/* Tworzy nowa przestrzen nazw o podanym wlascicielu. */
-Namespace      *newNamespace(Symbol * owner);
+/* Tworzy nowa przestrzen nazw */
+Namespace      *newNamespace();
 
 /* Niszczy przestrzen nazw. */
 void            destroyNamespace(Namespace * nam);
 
-/* Tworzy nowy symbol. */
-Symbol         *newSymbol(const char *name, int token, Type * type);
-
-/* Niszczy symbol (nie usuwa go z przestrzeni nazw!) */
-void            destroySymbol(Symbol * sym);
-
-/* Tworzy nowy opis typu. */
-Type           *newType(Symbol * base);
-
-/* Niszczy opis typu. */
-void            destroyType(Type * type);
-
-/* Dodaje symbol do przestrzeni nazw. */
-void            addSymbol(Namespace * nam, Symbol * sym);
-
-/* Wyszukuje symbol w przestrzeni nazw. */
-Symbol         *getSymbol(Namespace * nam, char *name);
 #endif
--- a/token_test.c	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <glib.h>
-#include "tokenize.h"
-
-/* Prosty programik testujacy tokenizera. */
-int
-main(int argc, char *argv[])
-{
-    Tokenizer      *tok;
-
-    tok = newTokenizer("sample.pas");
-    while (getNextToken(tok) != TOKEN_EOF) {
-        printf("type: %d, string: (%s)\n", tok->type, tok->buf->str);
-    }
-    destroyTokenizer(tok);
-    return 0;
-}
--- a/tokenize.c	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <glib.h>
-#include <ctype.h>
-
-#include "tokenize.h"
-
-/* Tworzy nowego tokenizera. */
-Tokenizer      *
-newTokenizer(const char *filename)
-{
-    FILE           *f;
-    Tokenizer      *tok;
-
-    f = fopen(filename, "r");
-    if (f == NULL)
-        return NULL;
-    tok = g_new(Tokenizer, 1);
-    tok->source = f;
-    tok->bufpos = 0;
-    tok->filename = g_strdup(filename);
-    tok->line = 1;
-    tok->position = 0;
-    tok->c = '\0';
-    tok->putback = '\0';
-    tok->buf = g_string_sized_new(32);
-    return tok;
-}
-
-/* Niszczy tokenizera. */
-void
-destroyTokenizer(Tokenizer * tok)
-{
-    g_string_free(tok->buf, TRUE);
-    fclose(tok->source);
-    g_free(tok->filename);
-    g_free(tok);
-    return;
-}
-
-/* Czyta pojedynczy znak. Ustawia position i line. */
-unsigned int
-getTokenizerChar(Tokenizer * tok)
-{
-    if (tok->putback == '\0') {
-        tok->c = fgetc(tok->source);
-        if (tok->c == '\n')
-            ++(tok->line);
-        ++(tok->position);
-    } else {
-        tok->c = tok->putback;
-        tok->putback = '\0';
-    }
-    return tok->c;
-}
-
-/* Dodaje znaczek do bufora. */
-void
-putTokenizerChar(Tokenizer * tok, char c)
-{
-#if 0
-    tok->buffer[tok->bufpos] = c;
-    if (tok->bufpos < TOKEN_SIZE - 1)
-        ++(tok->bufpos);
-#endif
-    tok->buf = g_string_append_c(tok->buf, c);
-    return;
-}
-
-/* Parsuje wyrazenia typu 'kflhgla''ajgkl' do stringa */
-void
-TokenizeQuotes(Tokenizer * tok)
-{
-    for (;;) {
-        if (getTokenizerChar(tok) == '\'') {
-            if (getTokenizerChar(tok) != '\'')
-                return;
-        }
-        putTokenizerChar(tok, tok->c);
-    }
-}
-
-/* Parsuje wyrazenia typu #123 do stringa */
-void
-TokenizeHash(Tokenizer * tok)
-{
-    int             code;
-    GString         *buf;
-
-    buf = g_string_sized_new(16);
-    if (tok->c != '#')
-        return;
-    while (isdigit(getTokenizerChar(tok))) {
-        buf = g_string_append_c(buf, tok->c);
-    }
-    code = atoi(buf->str);
-    putTokenizerChar(tok, code);
-    g_string_free(buf, TRUE);
-    return;
-}
-
-/* Parsuje wyrazenia typu ^C do stringa */
-void
-TokenizeCtrl(Tokenizer * tok)
-{
-    int             code;
-
-    tok->c = toupper(tok->c);
-    code = (tok->c - 'A') + 1;
-    putTokenizerChar(tok, code);
-    getTokenizerChar(tok);
-    return;
-}
-
-/* Wczytuje do tokenizera nastepny token. */
-enum TOKEN_TYPE
-getNextToken(Tokenizer * tok)
-{
-
-    /* Nie czytamy z pustego tokenizera. */
-    if (tok == NULL)
-        return TOKEN_EOF;
-    /* Oprozniamy bufor. */
-    tok->buf = g_string_truncate(tok->buf, 0);
-    tok->bufpos = 0;
-    /* Wczytujemy pierwszy znak z pliku. */
-    if (tok->c == '\0')
-        getTokenizerChar(tok);
-
-    /* Pomijamy odstepy. */
-    while (isspace(tok->c))
-        getTokenizerChar(tok);
-
-    /* Maszyna stanow (automaton) */
-    if (isdigit(tok->c)) {
-        /* Jesli zaczyna sie od cyfry... */
-        putTokenizerChar(tok, tok->c);
-        while (isdigit(getTokenizerChar(tok))) {
-            putTokenizerChar(tok, tok->c);
-        }
-        /* Koniec cyfr. */
-        if (tok->c == '.') {
-            /* Jeszcze czesc ulamkowa. */
-            /* Uwaga! Ta kropka moze byc od '..'! */
-            getTokenizerChar(tok);
-            if (isdigit(tok->c)) {
-                putTokenizerChar(tok, '.');
-                putTokenizerChar(tok, tok->c);
-                while (isdigit(getTokenizerChar(tok))) {
-                    putTokenizerChar(tok, tok->c);
-                }
-                putTokenizerChar(tok, '\0');
-                tok->type = TOKEN_REAL;
-                return tok->type;
-            } else {
-                /* To nie byla jednak kropka od ulamka. */
-                tok->putback = tok->c;
-                tok->c = '.';
-                putTokenizerChar(tok, '\0');
-                tok->type = TOKEN_INT;
-                return tok->type;
-            }
-        } else if (toupper(tok->c) == 'E') {
-            /* Jeszcze znak i potega po 'e'. */
-            putTokenizerChar(tok, 'e');
-            getTokenizerChar(tok);
-            if ((tok->c == '+') || (tok->c == '-') || (isdigit(tok->c))) {
-                putTokenizerChar(tok, tok->c);
-            } else {
-                putTokenizerChar(tok, '\0');
-                tok->type = TOKEN_ERROR;
-                return tok->type;
-            }
-            while (isdigit(getTokenizerChar(tok))) {
-                putTokenizerChar(tok, tok->c);
-            }
-            putTokenizerChar(tok, '\0');
-            tok->type = TOKEN_ENG;
-            return tok->type;
-        }
-        /* Ewentualnie moze to byc tylko liczba calkowita. */
-        putTokenizerChar(tok, '\0');
-        tok->type = TOKEN_INT;
-        return tok->type;
-    } else if (isalpha(tok->c) || (tok->c == '_')) {
-        /* Mamy identyfikator. */
-        putTokenizerChar(tok, tok->c);
-        while (isalnum(getTokenizerChar(tok)) || (tok->c == '_')) {
-            putTokenizerChar(tok, tok->c);
-        }
-        putTokenizerChar(tok, '\0');
-        tok->type = TOKEN_NAME;
-        return tok->type;
-    } else {
-        switch (tok->c) {
-            case EOF:
-                tok->type = TOKEN_EOF;
-                return tok->type;
-            case ':':
-                getTokenizerChar(tok);
-                if (tok->c == '=') {
-                    tok->type = TOKEN_DEFEQ;
-                    putTokenizerChar(tok, ':');
-                    putTokenizerChar(tok, '=');
-                    putTokenizerChar(tok, '\0');
-                    getTokenizerChar(tok);
-                    return tok->type;
-                } else {
-                    tok->type = TOKEN_CHAR;
-                    putTokenizerChar(tok, ':');
-                    putTokenizerChar(tok, '\0');
-                    getTokenizerChar(tok);
-                    return tok->type;
-                }
-            case '.':
-                getTokenizerChar(tok);
-                if (tok->c == '.') {
-                    tok->type = TOKEN_DOTDOT;
-                    putTokenizerChar(tok, '.');
-                    putTokenizerChar(tok, '.');
-                    putTokenizerChar(tok, '\0');
-                    getTokenizerChar(tok);
-                } else {
-                    tok->type = TOKEN_CHAR;
-                    putTokenizerChar(tok, '.');
-                    putTokenizerChar(tok, '\0');
-                }
-                return tok->type;
-            case '>':
-                getTokenizerChar(tok);
-                if (tok->c == '=') {
-                    tok->type = TOKEN_GEQ;
-                    putTokenizerChar(tok, '>');
-                    putTokenizerChar(tok, '=');
-                    putTokenizerChar(tok, '\0');
-                    getTokenizerChar(tok);
-                    return tok->type;
-                } else {
-                    tok->type = TOKEN_CHAR;
-                    putTokenizerChar(tok, '>');
-                    putTokenizerChar(tok, '\0');
-                    return tok->type;
-                }
-            case '<':
-                getTokenizerChar(tok);
-                if (tok->c == '=') {
-                    tok->type = TOKEN_LEQ;
-                    putTokenizerChar(tok, '<');
-                    putTokenizerChar(tok, '=');
-                    putTokenizerChar(tok, '\0');
-                    getTokenizerChar(tok);
-                    return tok->type;
-                } else if (tok->c == '>') {
-                    tok->type = TOKEN_NEQ;
-                    putTokenizerChar(tok, '<');
-                    putTokenizerChar(tok, '>');
-                    putTokenizerChar(tok, '\0');
-                    getTokenizerChar(tok);
-                    return tok->type;
-                } else {
-                    tok->type = TOKEN_CHAR;
-                    putTokenizerChar(tok, '<');
-                    putTokenizerChar(tok, '\0');
-                    return tok->type;
-                }
-            case '^':
-                if (!isalpha(getTokenizerChar(tok))) {
-                    tok->type = TOKEN_CHAR;
-                    putTokenizerChar(tok, tok->c);
-                    putTokenizerChar(tok, '\0');
-                    getTokenizerChar(tok);
-                    return tok->type;
-                }
-                TokenizeCtrl(tok);
-                /*@falltrough@*/
-            case '\'':
-            case '#':
-                for (;;) {
-                    if (tok->c == '\'') {
-                        TokenizeQuotes(tok);
-                    } else if (tok->c == '^') {
-                        getTokenizerChar(tok);
-                        TokenizeCtrl(tok);
-                    } else if (tok->c == '#') {
-                        TokenizeHash(tok);
-                    } else {
-                        putTokenizerChar(tok, '\0');
-                        tok->type = TOKEN_STRING;
-                        return tok->type;
-                    }
-                }
-            case '{':
-                while (getTokenizerChar(tok) != '}')
-                    putTokenizerChar(tok, tok->c);
-                putTokenizerChar(tok, '\0');
-                tok->type = TOKEN_COMMENT;
-                getTokenizerChar(tok);
-                return tok->type;
-            case '(':
-                getTokenizerChar(tok);
-                if (tok->c  == '*') {
-                    for (;;) {
-                        if (getTokenizerChar(tok) == '*') {
-                            if (getTokenizerChar(tok) == ')') {
-                                putTokenizerChar(tok, '\0');
-                                tok->type = TOKEN_COMMENT;
-                                getTokenizerChar(tok);
-                                return tok->type;
-                            } else {
-                                putTokenizerChar(tok, '*');
-                            }
-                        }
-                        putTokenizerChar(tok, tok->c);
-                    }
-                } else {
-                    tok->type = TOKEN_CHAR;
-                    putTokenizerChar(tok, '(');
-                    putTokenizerChar(tok, '\0');
-                    return tok->type;
-                }
-            case '$':
-                putTokenizerChar(tok, '0');
-                putTokenizerChar(tok, 'x');
-                while (isxdigit(getTokenizerChar(tok))) {
-                    putTokenizerChar(tok, tok->c);
-                }
-                tok->type = TOKEN_HEX;
-                putTokenizerChar(tok, '\0');
-                return tok->type;
-            default:
-                tok->type = TOKEN_CHAR;
-                putTokenizerChar(tok, tok->c);
-                putTokenizerChar(tok, '\0');
-                getTokenizerChar(tok);
-                return tok->type;
-        }
-    }
-}
--- a/tokenize.h	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#ifndef TOKENIZE_H
-#define TOKENIZE_H
-
-#if 0
-#define TOKEN_SIZE 255
-#endif
-
-enum TOKEN_TYPE {
-    TOKEN_EOF,
-    TOKEN_CHAR,
-    TOKEN_NAME,
-    TOKEN_INT,
-    TOKEN_HEX,
-    TOKEN_REAL,
-    TOKEN_ENG,
-    TOKEN_STRING,
-    TOKEN_COMMENT,
-    TOKEN_DEFEQ,
-    TOKEN_DOTDOT,
-    TOKEN_LEQ,
-    TOKEN_GEQ,
-    TOKEN_NEQ,
-    TOKEN_ERROR,
-    MAX_TOKEN
-};
-
-struct Tokenizer {
-    char           *filename;                              /* Nazwa tokenizowanego pliku. */
-    FILE           *source;                                /* Stad beda czytane tokeny. */
-    unsigned int    c;                                     /* Ostatnio wczytany znak. */
-    enum TOKEN_TYPE type;                                  /* Rodzaj tokena. */
-#if 0
-    char            buffer[TOKEN_SIZE];                    /* Bufor na tekst tokena. */
-#endif
-    int             bufpos;                                /* Pozycja w buforze. */
-    int             line;                                  /* Aktualny numer linii. */
-    int             position;                              /* Numer kolumny. */
-    unsigned int    putback;                               /* Znak do zwrotu. */
-    GString         *buf;                                  /* String tokena. */ 
-};
-
-typedef struct Tokenizer Tokenizer;
-
-Tokenizer *newTokenizer(const char *filename);
-void destroyTokenizer(Tokenizer *tok);
-enum TOKEN_TYPE getNextToken(Tokenizer *tok);
-
-#endif /*not TOKENIZE_H*/
--- a/tp4.output	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5365 +0,0 @@
-Conflict in state 260 between rule 162 and token K_ELSE resolved as shift.
-
-
-Terminals which are not used:
-
-   ID_UNIT
-
-
-Grammar
-
-  Number, Line, Rule
-    1  83 compilation_unit -> program
-    2  87 compilation_unit -> unit
-    3  94 program -> program_heading uses_clause block '.'
-    4  98 program_heading -> /* empty */
-    5  99 program_heading -> K_PROGRAM ID_NAME ';'
-    6 100 program_heading -> K_PROGRAM ID_NAME '(' id_name_list ')' ';'
-    7 108 uses_clause -> /* empty */
-    8 109 uses_clause -> K_USES id_name_list ';'
-    9 119 id_name_list -> ID_NAME
-   10 126 id_name_list -> id_name_list ',' ID_NAME
-   11 136 block -> decl_sect_list compound_stmt
-   12 142 unit -> unit_heading interface_part implementation_part initialization_part '.'
-   13 148 unit_heading -> K_UNIT ID_NAME ';'
-   14 154 interface_part -> K_INTERFACE uses_clause int_decl_sect_list
-   15 160 implementation_part -> K_IMPLEMENTATION uses_clause decl_sect_list
-   16 166 initialization_part -> compound_stmt
-   17 169 initialization_part -> K_END
-   18 177 decl_sect_list -> /* empty */
-   19 178 decl_sect_list -> decl_sect_list decl_sect
-   20 182 decl_sect -> label_decl_sect
-   21 183 decl_sect -> const_decl_sect
-   22 184 decl_sect -> type_decl_sect
-   23 185 decl_sect -> var_decl_sect
-   24 186 decl_sect -> proc_decl
-   25 187 decl_sect -> func_decl
-   26 191 label_decl_sect -> K_LABEL label_list ';'
-   27 195 label_list -> label_decl
-   28 196 label_list -> label_list ',' label_decl
-   29 199 label -> CONST_INT
-   30 202 label -> ID_LABEL
-   31 207 label_decl -> CONST_INT
-   32 215 label_decl -> ID_NAME
-   33 222 const_decl_sect -> K_CONST const_decl
-   34 223 const_decl_sect -> const_decl_sect const_decl
-   35 227 type_decl_sect -> K_TYPE type_decl
-   36 228 type_decl_sect -> type_decl_sect type_decl
-   37 232 var_decl_sect -> K_VAR var_decl
-   38 233 var_decl_sect -> var_decl_sect var_decl
-   39 243 int_decl_sect_list -> /* empty */
-   40 244 int_decl_sect_list -> int_decl_sect_list int_decl_sect
-   41 248 int_decl_sect -> const_decl_sect
-   42 249 int_decl_sect -> type_decl_sect
-   43 250 int_decl_sect -> var_decl_sect
-   44 251 int_decl_sect -> proc_heading
-   45 255 int_decl_sect -> func_heading
-   46 264 const_decl -> ID_NAME '=' const ';'
-   47 268 const_decl -> ID_NAME ':' type '=' typed_const ';'
-   48 274 const -> unsigned_number
-   49 276 const -> sign unsigned_number
-   50 278 const -> ID_CONST
-   51 280 const -> sign ID_CONST
-   52 282 const -> CONST_STRING
-   53 287 unsigned_number -> CONST_INT
-   54 292 unsigned_number -> CONST_REAL
-   55 295 sign -> '+'
-   56 295 sign -> '-'
-   57 299 typed_const -> const
-   58 300 typed_const -> array_const
-   59 301 typed_const -> record_const
-   60 302 typed_const -> set_const
-   61 306 array_const -> '(' typed_const_list ')'
-   62 310 typed_const_list -> typed_const
-   63 311 typed_const_list -> typed_const_list ',' typed_const
-   64 315 record_const -> '(' const_field_list ')'
-   65 319 const_field_list -> const_field
-   66 320 const_field_list -> const_field_list ',' const_field
-   67 324 const_field -> ID_FIELD ':' typed_const
-   68 329 set_const -> '[' const_elem_list ']'
-   69 333 const_elem_list -> /* empty */
-   70 334 const_elem_list -> const_elem_list1
-   71 338 const_elem_list1 -> const_elem
-   72 339 const_elem_list1 -> const_elem_list1 ',' const_elem
-   73 343 const_elem -> const
-   74 344 const_elem -> const OP_DOTDOT const
-   75 350 type_decl -> ID_NAME '=' type ';'
-   76 356 type -> simple_type
-   77 357 type -> pointer_type
-   78 358 type -> structured_type
-   79 359 type -> string_type
-   80 363 simple_type -> ID_TYPE
-   81 365 simple_type -> const OP_DOTDOT const
-   82 367 simple_type -> '(' id_name_list ')'
-   83 374 pointer_type -> '^' ID_TYPE
-   84 378 structured_type -> unpacked_structured_type
-   85 379 structured_type -> K_PACKED unpacked_structured_type
-   86 383 unpacked_structured_type -> array_type
-   87 384 unpacked_structured_type -> record_type
-   88 385 unpacked_structured_type -> set_type
-   89 386 unpacked_structured_type -> file_type
-   90 390 array_type -> K_ARRAY '[' simple_type_list ']' K_OF type
-   91 394 simple_type_list -> simple_type
-   92 395 simple_type_list -> simple_type_list ',' simple_type
-   93 399 record_type -> K_RECORD field_list K_END
-   94 403 field_list -> fixed_part
-   95 404 field_list -> variant_part
-   96 405 field_list -> fixed_part ';' variant_part
-   97 409 fixed_part -> record_section
-   98 410 fixed_part -> fixed_part ';' record_section
-   99 414 record_section -> /* empty */
-  100 415 record_section -> id_name_list ':' type
-  101 422 variant_part -> K_CASE tag_field K_OF variant_list
-  102 426 tag_field -> ID_NAME
-  103 428 tag_field -> ID_NAME ':' ID_TYPE
-  104 433 variant_list -> variant
-  105 434 variant_list -> variant_list ';' variant
-  106 437 variant -> /* empty */
-  107 438 variant -> case_tag_list ':' '(' field_list ')'
-  108 442 case_tag_list -> const
-  109 443 case_tag_list -> case_tag_list ',' const
-  110 447 set_type -> K_SET K_OF simple_type
-  111 451 file_type -> K_FILE K_OF type
-  112 452 file_type -> K_FILE
-  113 456 string_type -> K_STRING
-  114 457 string_type -> K_STRING '[' const ']'
-  115 463 var_decl -> id_name_list ':' type absolute_clause ';'
-  116 473 absolute_clause -> /* empty */
-  117 474 absolute_clause -> K_ABSOLUTE CONST_INT ':' CONST_INT
-  118 475 absolute_clause -> K_ABSOLUTE ID_VAR
-  119 481 proc_decl -> proc_heading proc_block ';'
-  120 490 func_decl -> func_heading proc_block ';'
-  121 501 proc_heading_beginning -> K_PROCEDURE ID_NAME
-  122 506 proc_heading_beginning -> K_PROCEDURE ID_PROC
-  123 513 func_heading_beginning -> K_FUNCTION ID_NAME
-  124 518 func_heading_beginning -> K_FUNCTION ID_FUNC
-  125 525 proc_heading -> proc_heading_beginning fp_list ';'
-  126 529 func_heading -> func_heading_beginning fp_list ':' fptype ';'
-  127 533 proc_block -> block
-  128 534 proc_block -> K_EXTERNAL
-  129 535 proc_block -> K_FORWARD
-  130 538 fp_list -> /* empty */
-  131 539 fp_list -> '(' fp_sect_list ')'
-  132 543 fp_sect_list -> fp_sect
-  133 544 fp_sect_list -> fp_sect_list ';' fp_sect
-  134 547 fp_sect -> id_name_list ':' fptype
-  135 552 fp_sect -> K_VAR id_name_list ':' fptype
-  136 557 fp_sect -> K_VAR id_name_list
-  137 564 fptype -> ID_TYPE
-  138 566 fptype -> K_STRING
-  139 571 stmt -> unlabelled_stmt
-  140 572 stmt -> label ':' unlabelled_stmt
-  141 576 unlabelled_stmt -> /* empty */
-  142 577 unlabelled_stmt -> assignment
-  143 578 unlabelled_stmt -> proc_call
-  144 579 unlabelled_stmt -> goto_stmt
-  145 580 unlabelled_stmt -> compound_stmt
-  146 581 unlabelled_stmt -> if_stmt
-  147 582 unlabelled_stmt -> case_stmt
-  148 583 unlabelled_stmt -> repeat_stmt
-  149 584 unlabelled_stmt -> while_stmt
-  150 585 unlabelled_stmt -> for_stmt
-  151 586 unlabelled_stmt -> with_stmt
-  152 590 assignment -> variable OP_DEFEQ expr
-  153 594 proc_call -> ID_PROC param_list
-  154 599 param_list -> /* empty */
-  155 600 param_list -> '(' expr_list ')'
-  156 604 expr_list -> expr
-  157 605 expr_list -> expr_list ',' expr
-  158 609 goto_stmt -> K_GOTO label
-  159 613 compound_stmt -> K_BEGIN stmt_list K_END
-  160 617 stmt_list -> stmt
-  161 618 stmt_list -> stmt_list ';' stmt
-  162 621 if_stmt -> K_IF expr K_THEN stmt
-  163 622 if_stmt -> K_IF expr K_THEN stmt K_ELSE stmt
-  164 626 case_stmt -> K_CASE expr K_OF case_list else_case K_END
-  165 630 case_list -> case
-  166 631 case_list -> case_list ';' case
-  167 634 case -> /* empty */
-  168 635 case -> case_label_list ':' stmt
-  169 639 case_label_list -> case_label
-  170 640 case_label_list -> case_label_list ',' case_label
-  171 644 case_label -> const
-  172 645 case_label -> const OP_DOTDOT const
-  173 649 else_case -> /* empty */
-  174 650 else_case -> K_ELSE stmt
-  175 651 else_case -> K_ELSE stmt ';'
-  176 655 repeat_stmt -> K_REPEAT stmt_list K_UNTIL expr
-  177 659 while_stmt -> K_WHILE expr K_DO stmt
-  178 663 for_stmt -> K_FOR ID_VAR OP_DEFEQ expr K_TO expr K_DO stmt
-  179 664 for_stmt -> K_FOR ID_VAR OP_DEFEQ expr K_DOWNTO expr K_DO stmt
-  180 668 with_stmt -> K_WITH variable_list K_DO stmt
-  181 672 variable_list -> variable
-  182 673 variable_list -> variable_list ',' variable
-  183 679 record_variable -> variable '.'
-  184 683 variable -> ID_VAR
-  185 685 variable -> variable '[' expr_list ']'
-  186 686 variable -> record_variable ID_FIELD
-  187 687 variable -> variable '^'
-  188 688 variable -> ID_TYPE '(' variable ')'
-  189 694 expr -> simple_expr
-  190 695 expr -> simple_expr relop simple_expr
-  191 698 relop -> '='
-  192 698 relop -> OP_NEQ
-  193 698 relop -> '<'
-  194 698 relop -> '>'
-  195 698 relop -> OP_LEQ
-  196 698 relop -> OP_GEQ
-  197 698 relop -> K_IN
-  198 702 simple_expr -> term
-  199 703 simple_expr -> sign term
-  200 704 simple_expr -> simple_expr addop term
-  201 707 addop -> '+'
-  202 707 addop -> '-'
-  203 707 addop -> K_OR
-  204 707 addop -> K_XOR
-  205 710 term -> factor
-  206 711 term -> term mulop factor
-  207 714 mulop -> '*'
-  208 714 mulop -> '/'
-  209 714 mulop -> K_DIV
-  210 714 mulop -> K_MOD
-  211 714 mulop -> K_SHL
-  212 714 mulop -> K_SHR
-  213 714 mulop -> K_AND
-  214 720 factor -> variable
-  215 721 factor -> ID_CONST
-  216 723 factor -> CONST_INT
-  217 725 factor -> CONST_REAL
-  218 727 factor -> CONST_STRING
-  219 729 factor -> '[' elem_list ']'
-  220 730 factor -> K_NIL
-  221 731 factor -> '@' variable
-  222 732 factor -> '(' expr ')'
-  223 733 factor -> ID_FUNC '(' expr_list ')'
-  224 735 factor -> K_NOT factor
-  225 739 elem_list -> /* empty */
-  226 740 elem_list -> elem_list1
-  227 744 elem_list1 -> elem
-  228 745 elem_list1 -> elem_list1 ',' elem
-  229 748 elem -> expr
-  230 749 elem -> expr OP_DOTDOT expr
-
-
-Terminals, with rules where they appear
-
-$ (-1)
-'(' (40) 6 61 64 82 107 131 155 188 222 223
-')' (41) 6 61 64 82 107 131 155 188 222 223
-'*' (42) 207
-'+' (43) 55 201
-',' (44) 10 28 63 66 72 92 109 157 170 182 228
-'-' (45) 56 202
-'.' (46) 3 12 183
-'/' (47) 208
-':' (58) 47 67 100 103 107 115 117 126 134 135 140 168
-';' (59) 5 6 8 13 26 46 47 75 96 98 105 115 119 120 125 126 133 161
-    166 175
-'<' (60) 193
-'=' (61) 46 47 75 191
-'>' (62) 194
-'@' (64) 221
-'[' (91) 68 90 114 185 219
-']' (93) 68 90 114 185 219
-'^' (94) 83 187
-error (256)
-K_AND (257) 213
-K_ABSOLUTE (258) 117 118
-K_ARRAY (259) 90
-K_BEGIN (260) 159
-K_CASE (261) 101 164
-K_CONST (262) 33
-K_DIV (263) 209
-K_DOWNTO (264) 179
-K_DO (265) 177 178 179 180
-K_ELSE (266) 163 174 175
-K_END (267) 17 93 159 164
-K_EXTERNAL (268) 128
-K_FILE (269) 111 112
-K_FORWARD (270) 129
-K_FOR (271) 178 179
-K_FUNCTION (272) 123 124
-K_GOTO (273) 158
-K_IF (274) 162 163
-K_IMPLEMENTATION (275) 15
-K_INTERFACE (276) 14
-K_IN (277) 197
-K_LABEL (278) 26
-K_MOD (279) 210
-K_NIL (280) 220
-K_NOT (281) 224
-K_OF (282) 90 101 110 111 164
-K_OR (283) 203
-K_PACKED (284) 85
-K_PROCEDURE (285) 121 122
-K_PROGRAM (286) 5 6
-K_RECORD (287) 93
-K_REPEAT (288) 176
-K_SET (289) 110
-K_SHL (290) 211
-K_SHR (291) 212
-K_STRING (292) 113 114 138
-K_THEN (293) 162 163
-K_TO (294) 178
-K_TYPE (295) 35
-K_UNIT (296) 13
-K_UNTIL (297) 176
-K_USES (298) 8
-K_VAR (299) 37 135 136
-K_WHILE (300) 177
-K_WITH (301) 180
-K_XOR (302) 204
-OP_DOTDOT (303) 74 81 172 230
-OP_DEFEQ (304) 152 178 179
-OP_LEQ (305) 195
-OP_NEQ (306) 192
-OP_GEQ (307) 196
-ID_FUNC (308) 124 223
-ID_PROC (309) 122 153
-ID_VAR (310) 118 178 179 184
-ID_TYPE (311) 80 83 103 137 188
-ID_LABEL (312) 30
-ID_UNIT (313)
-ID_CONST (314) 50 51 215
-ID_FIELD (315) 67 186
-ID_NAME (316) 5 6 9 10 13 32 46 47 75 102 103 121 123
-CONST_INT (317) 29 31 53 117 216
-CONST_REAL (318) 54 217
-CONST_STRING (319) 52 218
-
-
-Nonterminals, with rules where they appear
-
-compilation_unit (83)
-    on left: 1 2
-program (84)
-    on left: 3, on right: 1
-program_heading (85)
-    on left: 4 5 6, on right: 3
-uses_clause (86)
-    on left: 7 8, on right: 3 14 15
-id_name_list (87)
-    on left: 9 10, on right: 6 8 10 82 100 115 134 135 136
-block (88)
-    on left: 11, on right: 3 127
-unit (89)
-    on left: 12, on right: 2
-unit_heading (90)
-    on left: 13, on right: 12
-interface_part (91)
-    on left: 14, on right: 12
-implementation_part (92)
-    on left: 15, on right: 12
-initialization_part (93)
-    on left: 16 17, on right: 12
-decl_sect_list (94)
-    on left: 18 19, on right: 11 15 19
-decl_sect (95)
-    on left: 20 21 22 23 24 25, on right: 19
-label_decl_sect (96)
-    on left: 26, on right: 20
-label_list (97)
-    on left: 27 28, on right: 26 28
-label (98)
-    on left: 29 30, on right: 140 158
-label_decl (99)
-    on left: 31 32, on right: 27 28
-const_decl_sect (100)
-    on left: 33 34, on right: 21 34 41
-type_decl_sect (101)
-    on left: 35 36, on right: 22 36 42
-var_decl_sect (102)
-    on left: 37 38, on right: 23 38 43
-int_decl_sect_list (103)
-    on left: 39 40, on right: 14 40
-int_decl_sect (104)
-    on left: 41 42 43 44 45, on right: 40
-const_decl (105)
-    on left: 46 47, on right: 33 34
-const (106)
-    on left: 48 49 50 51 52, on right: 46 57 73 74 81 108 109 114 171
-    172
-unsigned_number (107)
-    on left: 53 54, on right: 48 49
-sign (108)
-    on left: 55 56, on right: 49 51 199
-typed_const (109)
-    on left: 57 58 59 60, on right: 47 62 63 67
-array_const (110)
-    on left: 61, on right: 58
-typed_const_list (111)
-    on left: 62 63, on right: 61 63
-record_const (112)
-    on left: 64, on right: 59
-const_field_list (113)
-    on left: 65 66, on right: 64 66
-const_field (114)
-    on left: 67, on right: 65 66
-set_const (115)
-    on left: 68, on right: 60
-const_elem_list (116)
-    on left: 69 70, on right: 68
-const_elem_list1 (117)
-    on left: 71 72, on right: 70 72
-const_elem (118)
-    on left: 73 74, on right: 71 72
-type_decl (119)
-    on left: 75, on right: 35 36
-type (120)
-    on left: 76 77 78 79, on right: 47 75 90 100 111 115
-simple_type (121)
-    on left: 80 81 82, on right: 76 91 92 110
-pointer_type (122)
-    on left: 83, on right: 77
-structured_type (123)
-    on left: 84 85, on right: 78
-unpacked_structured_type (124)
-    on left: 86 87 88 89, on right: 84 85
-array_type (125)
-    on left: 90, on right: 86
-simple_type_list (126)
-    on left: 91 92, on right: 90 92
-record_type (127)
-    on left: 93, on right: 87
-field_list (128)
-    on left: 94 95 96, on right: 93 107
-fixed_part (129)
-    on left: 97 98, on right: 94 96 98
-record_section (130)
-    on left: 99 100, on right: 97 98
-variant_part (131)
-    on left: 101, on right: 95 96
-tag_field (132)
-    on left: 102 103, on right: 101
-variant_list (133)
-    on left: 104 105, on right: 101 105
-variant (134)
-    on left: 106 107, on right: 104 105
-case_tag_list (135)
-    on left: 108 109, on right: 107 109
-set_type (136)
-    on left: 110, on right: 88
-file_type (137)
-    on left: 111 112, on right: 89
-string_type (138)
-    on left: 113 114, on right: 79
-var_decl (139)
-    on left: 115, on right: 37 38
-absolute_clause (140)
-    on left: 116 117 118, on right: 115
-proc_decl (141)
-    on left: 119, on right: 24
-func_decl (142)
-    on left: 120, on right: 25
-proc_heading_beginning (143)
-    on left: 121 122, on right: 125
-func_heading_beginning (144)
-    on left: 123 124, on right: 126
-proc_heading (145)
-    on left: 125, on right: 44 119
-func_heading (146)
-    on left: 126, on right: 45 120
-proc_block (147)
-    on left: 127 128 129, on right: 119 120
-fp_list (148)
-    on left: 130 131, on right: 125 126
-fp_sect_list (149)
-    on left: 132 133, on right: 131 133
-fp_sect (150)
-    on left: 134 135 136, on right: 132 133
-fptype (151)
-    on left: 137 138, on right: 126 134 135
-stmt (152)
-    on left: 139 140, on right: 160 161 162 163 168 174 175 177 178
-    179 180
-unlabelled_stmt (153)
-    on left: 141 142 143 144 145 146 147 148 149 150 151,
-    on right: 139 140
-assignment (154)
-    on left: 152, on right: 142
-proc_call (155)
-    on left: 153, on right: 143
-param_list (156)
-    on left: 154 155, on right: 153
-expr_list (157)
-    on left: 156 157, on right: 155 157 185 223
-goto_stmt (158)
-    on left: 158, on right: 144
-compound_stmt (159)
-    on left: 159, on right: 11 16 145
-stmt_list (160)
-    on left: 160 161, on right: 159 161 176
-if_stmt (161)
-    on left: 162 163, on right: 146
-case_stmt (162)
-    on left: 164, on right: 147
-case_list (163)
-    on left: 165 166, on right: 164 166
-case (164)
-    on left: 167 168, on right: 165 166
-case_label_list (165)
-    on left: 169 170, on right: 168 170
-case_label (166)
-    on left: 171 172, on right: 169 170
-else_case (167)
-    on left: 173 174 175, on right: 164
-repeat_stmt (168)
-    on left: 176, on right: 148
-while_stmt (169)
-    on left: 177, on right: 149
-for_stmt (170)
-    on left: 178 179, on right: 150
-with_stmt (171)
-    on left: 180, on right: 151
-variable_list (172)
-    on left: 181 182, on right: 180 182
-record_variable (173)
-    on left: 183, on right: 186
-variable (174)
-    on left: 184 185 186 187 188, on right: 152 181 182 183 185 187
-    188 214 221
-expr (175)
-    on left: 189 190, on right: 152 156 157 162 163 164 176 177 178
-    179 222 229 230
-relop (176)
-    on left: 191 192 193 194 195 196 197, on right: 190
-simple_expr (177)
-    on left: 198 199 200, on right: 189 190 200
-addop (178)
-    on left: 201 202 203 204, on right: 200
-term (179)
-    on left: 205 206, on right: 198 199 200 206
-mulop (180)
-    on left: 207 208 209 210 211 212 213, on right: 206
-factor (181)
-    on left: 214 215 216 217 218 219 220 221 222 223 224,
-    on right: 205 206 224
-elem_list (182)
-    on left: 225 226, on right: 219
-elem_list1 (183)
-    on left: 227 228, on right: 226 228
-elem (184)
-    on left: 229 230, on right: 227 228
-
-
-state 0
-
-    K_PROGRAM	shift, and go to state 1
-    K_UNIT	shift, and go to state 2
-
-    $default	reduce using rule 4 (program_heading)
-
-    compilation_unit	go to state 393
-    program	go to state 3
-    program_heading	go to state 4
-    unit	go to state 5
-    unit_heading	go to state 6
-
-
-
-state 1
-
-    program_heading  ->  K_PROGRAM . ID_NAME ';'   (rule 5)
-    program_heading  ->  K_PROGRAM . ID_NAME '(' id_name_list ')' ';'   (rule 6)
-
-    ID_NAME	shift, and go to state 7
-
-
-
-state 2
-
-    unit_heading  ->  K_UNIT . ID_NAME ';'   (rule 13)
-
-    ID_NAME	shift, and go to state 8
-
-
-
-state 3
-
-    compilation_unit  ->  program .   (rule 1)
-
-    $default	reduce using rule 1 (compilation_unit)
-
-
-
-state 4
-
-    program  ->  program_heading . uses_clause block '.'   (rule 3)
-
-    K_USES	shift, and go to state 9
-
-    $default	reduce using rule 7 (uses_clause)
-
-    uses_clause	go to state 10
-
-
-
-state 5
-
-    compilation_unit  ->  unit .   (rule 2)
-
-    $default	reduce using rule 2 (compilation_unit)
-
-
-
-state 6
-
-    unit  ->  unit_heading . interface_part implementation_part initialization_part '.'   (rule 12)
-
-    K_INTERFACE	shift, and go to state 11
-
-    interface_part	go to state 12
-
-
-
-state 7
-
-    program_heading  ->  K_PROGRAM ID_NAME . ';'   (rule 5)
-    program_heading  ->  K_PROGRAM ID_NAME . '(' id_name_list ')' ';'   (rule 6)
-
-    ';' 	shift, and go to state 13
-    '(' 	shift, and go to state 14
-
-
-
-state 8
-
-    unit_heading  ->  K_UNIT ID_NAME . ';'   (rule 13)
-
-    ';' 	shift, and go to state 15
-
-
-
-state 9
-
-    uses_clause  ->  K_USES . id_name_list ';'   (rule 8)
-
-    ID_NAME	shift, and go to state 16
-
-    id_name_list	go to state 17
-
-
-
-state 10
-
-    program  ->  program_heading uses_clause . block '.'   (rule 3)
-
-    $default	reduce using rule 18 (decl_sect_list)
-
-    block	go to state 18
-    decl_sect_list	go to state 19
-
-
-
-state 11
-
-    interface_part  ->  K_INTERFACE . uses_clause int_decl_sect_list   (rule 14)
-
-    K_USES	shift, and go to state 9
-
-    $default	reduce using rule 7 (uses_clause)
-
-    uses_clause	go to state 20
-
-
-
-state 12
-
-    unit  ->  unit_heading interface_part . implementation_part initialization_part '.'   (rule 12)
-
-    K_IMPLEMENTATION	shift, and go to state 21
-
-    implementation_part	go to state 22
-
-
-
-state 13
-
-    program_heading  ->  K_PROGRAM ID_NAME ';' .   (rule 5)
-
-    $default	reduce using rule 5 (program_heading)
-
-
-
-state 14
-
-    program_heading  ->  K_PROGRAM ID_NAME '(' . id_name_list ')' ';'   (rule 6)
-
-    ID_NAME	shift, and go to state 16
-
-    id_name_list	go to state 23
-
-
-
-state 15
-
-    unit_heading  ->  K_UNIT ID_NAME ';' .   (rule 13)
-
-    $default	reduce using rule 13 (unit_heading)
-
-
-
-state 16
-
-    id_name_list  ->  ID_NAME .   (rule 9)
-
-    $default	reduce using rule 9 (id_name_list)
-
-
-
-state 17
-
-    uses_clause  ->  K_USES id_name_list . ';'   (rule 8)
-    id_name_list  ->  id_name_list . ',' ID_NAME   (rule 10)
-
-    ';' 	shift, and go to state 24
-    ',' 	shift, and go to state 25
-
-
-
-state 18
-
-    program  ->  program_heading uses_clause block . '.'   (rule 3)
-
-    '.' 	shift, and go to state 26
-
-
-
-state 19
-
-    block  ->  decl_sect_list . compound_stmt   (rule 11)
-    decl_sect_list  ->  decl_sect_list . decl_sect   (rule 19)
-
-    K_BEGIN	shift, and go to state 27
-    K_CONST	shift, and go to state 28
-    K_FUNCTION	shift, and go to state 29
-    K_LABEL	shift, and go to state 30
-    K_PROCEDURE	shift, and go to state 31
-    K_TYPE	shift, and go to state 32
-    K_VAR	shift, and go to state 33
-
-    decl_sect	go to state 34
-    label_decl_sect	go to state 35
-    const_decl_sect	go to state 36
-    type_decl_sect	go to state 37
-    var_decl_sect	go to state 38
-    proc_decl	go to state 39
-    func_decl	go to state 40
-    proc_heading_beginning	go to state 41
-    func_heading_beginning	go to state 42
-    proc_heading	go to state 43
-    func_heading	go to state 44
-    compound_stmt	go to state 45
-
-
-
-state 20
-
-    interface_part  ->  K_INTERFACE uses_clause . int_decl_sect_list   (rule 14)
-
-    $default	reduce using rule 39 (int_decl_sect_list)
-
-    int_decl_sect_list	go to state 46
-
-
-
-state 21
-
-    implementation_part  ->  K_IMPLEMENTATION . uses_clause decl_sect_list   (rule 15)
-
-    K_USES	shift, and go to state 9
-
-    $default	reduce using rule 7 (uses_clause)
-
-    uses_clause	go to state 47
-
-
-
-state 22
-
-    unit  ->  unit_heading interface_part implementation_part . initialization_part '.'   (rule 12)
-
-    K_BEGIN	shift, and go to state 27
-    K_END	shift, and go to state 48
-
-    initialization_part	go to state 49
-    compound_stmt	go to state 50
-
-
-
-state 23
-
-    program_heading  ->  K_PROGRAM ID_NAME '(' id_name_list . ')' ';'   (rule 6)
-    id_name_list  ->  id_name_list . ',' ID_NAME   (rule 10)
-
-    ')' 	shift, and go to state 51
-    ',' 	shift, and go to state 25
-
-
-
-state 24
-
-    uses_clause  ->  K_USES id_name_list ';' .   (rule 8)
-
-    $default	reduce using rule 8 (uses_clause)
-
-
-
-state 25
-
-    id_name_list  ->  id_name_list ',' . ID_NAME   (rule 10)
-
-    ID_NAME	shift, and go to state 52
-
-
-
-state 26
-
-    program  ->  program_heading uses_clause block '.' .   (rule 3)
-
-    $default	reduce using rule 3 (program)
-
-
-
-state 27
-
-    compound_stmt  ->  K_BEGIN . stmt_list K_END   (rule 159)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 66
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    stmt_list	go to state 72
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 28
-
-    const_decl_sect  ->  K_CONST . const_decl   (rule 33)
-
-    ID_NAME	shift, and go to state 81
-
-    const_decl	go to state 82
-
-
-
-state 29
-
-    func_heading_beginning  ->  K_FUNCTION . ID_NAME   (rule 123)
-    func_heading_beginning  ->  K_FUNCTION . ID_FUNC   (rule 124)
-
-    ID_FUNC	shift, and go to state 83
-    ID_NAME	shift, and go to state 84
-
-
-
-state 30
-
-    label_decl_sect  ->  K_LABEL . label_list ';'   (rule 26)
-
-    ID_NAME	shift, and go to state 85
-    CONST_INT	shift, and go to state 86
-
-    label_list	go to state 87
-    label_decl	go to state 88
-
-
-
-state 31
-
-    proc_heading_beginning  ->  K_PROCEDURE . ID_NAME   (rule 121)
-    proc_heading_beginning  ->  K_PROCEDURE . ID_PROC   (rule 122)
-
-    ID_PROC	shift, and go to state 89
-    ID_NAME	shift, and go to state 90
-
-
-
-state 32
-
-    type_decl_sect  ->  K_TYPE . type_decl   (rule 35)
-
-    ID_NAME	shift, and go to state 91
-
-    type_decl	go to state 92
-
-
-
-state 33
-
-    var_decl_sect  ->  K_VAR . var_decl   (rule 37)
-
-    ID_NAME	shift, and go to state 16
-
-    id_name_list	go to state 93
-    var_decl	go to state 94
-
-
-
-state 34
-
-    decl_sect_list  ->  decl_sect_list decl_sect .   (rule 19)
-
-    $default	reduce using rule 19 (decl_sect_list)
-
-
-
-state 35
-
-    decl_sect  ->  label_decl_sect .   (rule 20)
-
-    $default	reduce using rule 20 (decl_sect)
-
-
-
-state 36
-
-    decl_sect  ->  const_decl_sect .   (rule 21)
-    const_decl_sect  ->  const_decl_sect . const_decl   (rule 34)
-
-    ID_NAME	shift, and go to state 81
-
-    $default	reduce using rule 21 (decl_sect)
-
-    const_decl	go to state 95
-
-
-
-state 37
-
-    decl_sect  ->  type_decl_sect .   (rule 22)
-    type_decl_sect  ->  type_decl_sect . type_decl   (rule 36)
-
-    ID_NAME	shift, and go to state 91
-
-    $default	reduce using rule 22 (decl_sect)
-
-    type_decl	go to state 96
-
-
-
-state 38
-
-    decl_sect  ->  var_decl_sect .   (rule 23)
-    var_decl_sect  ->  var_decl_sect . var_decl   (rule 38)
-
-    ID_NAME	shift, and go to state 16
-
-    $default	reduce using rule 23 (decl_sect)
-
-    id_name_list	go to state 93
-    var_decl	go to state 97
-
-
-
-state 39
-
-    decl_sect  ->  proc_decl .   (rule 24)
-
-    $default	reduce using rule 24 (decl_sect)
-
-
-
-state 40
-
-    decl_sect  ->  func_decl .   (rule 25)
-
-    $default	reduce using rule 25 (decl_sect)
-
-
-
-state 41
-
-    proc_heading  ->  proc_heading_beginning . fp_list ';'   (rule 125)
-
-    '(' 	shift, and go to state 98
-
-    $default	reduce using rule 130 (fp_list)
-
-    fp_list	go to state 99
-
-
-
-state 42
-
-    func_heading  ->  func_heading_beginning . fp_list ':' fptype ';'   (rule 126)
-
-    '(' 	shift, and go to state 98
-
-    $default	reduce using rule 130 (fp_list)
-
-    fp_list	go to state 100
-
-
-
-state 43
-
-    proc_decl  ->  proc_heading . proc_block ';'   (rule 119)
-
-    K_EXTERNAL	shift, and go to state 101
-    K_FORWARD	shift, and go to state 102
-
-    $default	reduce using rule 18 (decl_sect_list)
-
-    block	go to state 103
-    decl_sect_list	go to state 19
-    proc_block	go to state 104
-
-
-
-state 44
-
-    func_decl  ->  func_heading . proc_block ';'   (rule 120)
-
-    K_EXTERNAL	shift, and go to state 101
-    K_FORWARD	shift, and go to state 102
-
-    $default	reduce using rule 18 (decl_sect_list)
-
-    block	go to state 103
-    decl_sect_list	go to state 19
-    proc_block	go to state 105
-
-
-
-state 45
-
-    block  ->  decl_sect_list compound_stmt .   (rule 11)
-
-    $default	reduce using rule 11 (block)
-
-
-
-state 46
-
-    interface_part  ->  K_INTERFACE uses_clause int_decl_sect_list .   (rule 14)
-    int_decl_sect_list  ->  int_decl_sect_list . int_decl_sect   (rule 40)
-
-    K_CONST	shift, and go to state 28
-    K_FUNCTION	shift, and go to state 29
-    K_PROCEDURE	shift, and go to state 31
-    K_TYPE	shift, and go to state 32
-    K_VAR	shift, and go to state 33
-
-    $default	reduce using rule 14 (interface_part)
-
-    const_decl_sect	go to state 106
-    type_decl_sect	go to state 107
-    var_decl_sect	go to state 108
-    int_decl_sect	go to state 109
-    proc_heading_beginning	go to state 41
-    func_heading_beginning	go to state 42
-    proc_heading	go to state 110
-    func_heading	go to state 111
-
-
-
-state 47
-
-    implementation_part  ->  K_IMPLEMENTATION uses_clause . decl_sect_list   (rule 15)
-
-    $default	reduce using rule 18 (decl_sect_list)
-
-    decl_sect_list	go to state 112
-
-
-
-state 48
-
-    initialization_part  ->  K_END .   (rule 17)
-
-    $default	reduce using rule 17 (initialization_part)
-
-
-
-state 49
-
-    unit  ->  unit_heading interface_part implementation_part initialization_part . '.'   (rule 12)
-
-    '.' 	shift, and go to state 113
-
-
-
-state 50
-
-    initialization_part  ->  compound_stmt .   (rule 16)
-
-    $default	reduce using rule 16 (initialization_part)
-
-
-
-state 51
-
-    program_heading  ->  K_PROGRAM ID_NAME '(' id_name_list ')' . ';'   (rule 6)
-
-    ';' 	shift, and go to state 114
-
-
-
-state 52
-
-    id_name_list  ->  id_name_list ',' ID_NAME .   (rule 10)
-
-    $default	reduce using rule 10 (id_name_list)
-
-
-
-state 53
-
-    case_stmt  ->  K_CASE . expr K_OF case_list else_case K_END   (rule 164)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 129
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 54
-
-    for_stmt  ->  K_FOR . ID_VAR OP_DEFEQ expr K_TO expr K_DO stmt   (rule 178)
-    for_stmt  ->  K_FOR . ID_VAR OP_DEFEQ expr K_DOWNTO expr K_DO stmt   (rule 179)
-
-    ID_VAR	shift, and go to state 133
-
-
-
-state 55
-
-    goto_stmt  ->  K_GOTO . label   (rule 158)
-
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    label	go to state 134
-
-
-
-state 56
-
-    if_stmt  ->  K_IF . expr K_THEN stmt   (rule 162)
-    if_stmt  ->  K_IF . expr K_THEN stmt K_ELSE stmt   (rule 163)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 135
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 57
-
-    repeat_stmt  ->  K_REPEAT . stmt_list K_UNTIL expr   (rule 176)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 66
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    stmt_list	go to state 136
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 58
-
-    while_stmt  ->  K_WHILE . expr K_DO stmt   (rule 177)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 137
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 59
-
-    with_stmt  ->  K_WITH . variable_list K_DO stmt   (rule 180)
-
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-
-    variable_list	go to state 138
-    record_variable	go to state 79
-    variable	go to state 139
-
-
-
-state 60
-
-    proc_call  ->  ID_PROC . param_list   (rule 153)
-
-    '(' 	shift, and go to state 140
-
-    $default	reduce using rule 154 (param_list)
-
-    param_list	go to state 141
-
-
-
-state 61
-
-    variable  ->  ID_VAR .   (rule 184)
-
-    $default	reduce using rule 184 (variable)
-
-
-
-state 62
-
-    variable  ->  ID_TYPE . '(' variable ')'   (rule 188)
-
-    '(' 	shift, and go to state 142
-
-
-
-state 63
-
-    label  ->  ID_LABEL .   (rule 30)
-
-    $default	reduce using rule 30 (label)
-
-
-
-state 64
-
-    label  ->  CONST_INT .   (rule 29)
-
-    $default	reduce using rule 29 (label)
-
-
-
-state 65
-
-    stmt  ->  label . ':' unlabelled_stmt   (rule 140)
-
-    ':' 	shift, and go to state 143
-
-
-
-state 66
-
-    stmt_list  ->  stmt .   (rule 160)
-
-    $default	reduce using rule 160 (stmt_list)
-
-
-
-state 67
-
-    stmt  ->  unlabelled_stmt .   (rule 139)
-
-    $default	reduce using rule 139 (stmt)
-
-
-
-state 68
-
-    unlabelled_stmt  ->  assignment .   (rule 142)
-
-    $default	reduce using rule 142 (unlabelled_stmt)
-
-
-
-state 69
-
-    unlabelled_stmt  ->  proc_call .   (rule 143)
-
-    $default	reduce using rule 143 (unlabelled_stmt)
-
-
-
-state 70
-
-    unlabelled_stmt  ->  goto_stmt .   (rule 144)
-
-    $default	reduce using rule 144 (unlabelled_stmt)
-
-
-
-state 71
-
-    unlabelled_stmt  ->  compound_stmt .   (rule 145)
-
-    $default	reduce using rule 145 (unlabelled_stmt)
-
-
-
-state 72
-
-    compound_stmt  ->  K_BEGIN stmt_list . K_END   (rule 159)
-    stmt_list  ->  stmt_list . ';' stmt   (rule 161)
-
-    K_END	shift, and go to state 144
-    ';' 	shift, and go to state 145
-
-
-
-state 73
-
-    unlabelled_stmt  ->  if_stmt .   (rule 146)
-
-    $default	reduce using rule 146 (unlabelled_stmt)
-
-
-
-state 74
-
-    unlabelled_stmt  ->  case_stmt .   (rule 147)
-
-    $default	reduce using rule 147 (unlabelled_stmt)
-
-
-
-state 75
-
-    unlabelled_stmt  ->  repeat_stmt .   (rule 148)
-
-    $default	reduce using rule 148 (unlabelled_stmt)
-
-
-
-state 76
-
-    unlabelled_stmt  ->  while_stmt .   (rule 149)
-
-    $default	reduce using rule 149 (unlabelled_stmt)
-
-
-
-state 77
-
-    unlabelled_stmt  ->  for_stmt .   (rule 150)
-
-    $default	reduce using rule 150 (unlabelled_stmt)
-
-
-
-state 78
-
-    unlabelled_stmt  ->  with_stmt .   (rule 151)
-
-    $default	reduce using rule 151 (unlabelled_stmt)
-
-
-
-state 79
-
-    variable  ->  record_variable . ID_FIELD   (rule 186)
-
-    ID_FIELD	shift, and go to state 146
-
-
-
-state 80
-
-    assignment  ->  variable . OP_DEFEQ expr   (rule 152)
-    record_variable  ->  variable . '.'   (rule 183)
-    variable  ->  variable . '[' expr_list ']'   (rule 185)
-    variable  ->  variable . '^'   (rule 187)
-
-    OP_DEFEQ	shift, and go to state 147
-    '.' 	shift, and go to state 148
-    '[' 	shift, and go to state 149
-    '^' 	shift, and go to state 150
-
-
-
-state 81
-
-    const_decl  ->  ID_NAME . '=' const ';'   (rule 46)
-    const_decl  ->  ID_NAME . ':' type '=' typed_const ';'   (rule 47)
-
-    '=' 	shift, and go to state 151
-    ':' 	shift, and go to state 152
-
-
-
-state 82
-
-    const_decl_sect  ->  K_CONST const_decl .   (rule 33)
-
-    $default	reduce using rule 33 (const_decl_sect)
-
-
-
-state 83
-
-    func_heading_beginning  ->  K_FUNCTION ID_FUNC .   (rule 124)
-
-    $default	reduce using rule 124 (func_heading_beginning)
-
-
-
-state 84
-
-    func_heading_beginning  ->  K_FUNCTION ID_NAME .   (rule 123)
-
-    $default	reduce using rule 123 (func_heading_beginning)
-
-
-
-state 85
-
-    label_decl  ->  ID_NAME .   (rule 32)
-
-    $default	reduce using rule 32 (label_decl)
-
-
-
-state 86
-
-    label_decl  ->  CONST_INT .   (rule 31)
-
-    $default	reduce using rule 31 (label_decl)
-
-
-
-state 87
-
-    label_decl_sect  ->  K_LABEL label_list . ';'   (rule 26)
-    label_list  ->  label_list . ',' label_decl   (rule 28)
-
-    ';' 	shift, and go to state 153
-    ',' 	shift, and go to state 154
-
-
-
-state 88
-
-    label_list  ->  label_decl .   (rule 27)
-
-    $default	reduce using rule 27 (label_list)
-
-
-
-state 89
-
-    proc_heading_beginning  ->  K_PROCEDURE ID_PROC .   (rule 122)
-
-    $default	reduce using rule 122 (proc_heading_beginning)
-
-
-
-state 90
-
-    proc_heading_beginning  ->  K_PROCEDURE ID_NAME .   (rule 121)
-
-    $default	reduce using rule 121 (proc_heading_beginning)
-
-
-
-state 91
-
-    type_decl  ->  ID_NAME . '=' type ';'   (rule 75)
-
-    '=' 	shift, and go to state 155
-
-
-
-state 92
-
-    type_decl_sect  ->  K_TYPE type_decl .   (rule 35)
-
-    $default	reduce using rule 35 (type_decl_sect)
-
-
-
-state 93
-
-    id_name_list  ->  id_name_list . ',' ID_NAME   (rule 10)
-    var_decl  ->  id_name_list . ':' type absolute_clause ';'   (rule 115)
-
-    ',' 	shift, and go to state 25
-    ':' 	shift, and go to state 156
-
-
-
-state 94
-
-    var_decl_sect  ->  K_VAR var_decl .   (rule 37)
-
-    $default	reduce using rule 37 (var_decl_sect)
-
-
-
-state 95
-
-    const_decl_sect  ->  const_decl_sect const_decl .   (rule 34)
-
-    $default	reduce using rule 34 (const_decl_sect)
-
-
-
-state 96
-
-    type_decl_sect  ->  type_decl_sect type_decl .   (rule 36)
-
-    $default	reduce using rule 36 (type_decl_sect)
-
-
-
-state 97
-
-    var_decl_sect  ->  var_decl_sect var_decl .   (rule 38)
-
-    $default	reduce using rule 38 (var_decl_sect)
-
-
-
-state 98
-
-    fp_list  ->  '(' . fp_sect_list ')'   (rule 131)
-
-    K_VAR	shift, and go to state 157
-    ID_NAME	shift, and go to state 16
-
-    id_name_list	go to state 158
-    fp_sect_list	go to state 159
-    fp_sect	go to state 160
-
-
-
-state 99
-
-    proc_heading  ->  proc_heading_beginning fp_list . ';'   (rule 125)
-
-    ';' 	shift, and go to state 161
-
-
-
-state 100
-
-    func_heading  ->  func_heading_beginning fp_list . ':' fptype ';'   (rule 126)
-
-    ':' 	shift, and go to state 162
-
-
-
-state 101
-
-    proc_block  ->  K_EXTERNAL .   (rule 128)
-
-    $default	reduce using rule 128 (proc_block)
-
-
-
-state 102
-
-    proc_block  ->  K_FORWARD .   (rule 129)
-
-    $default	reduce using rule 129 (proc_block)
-
-
-
-state 103
-
-    proc_block  ->  block .   (rule 127)
-
-    $default	reduce using rule 127 (proc_block)
-
-
-
-state 104
-
-    proc_decl  ->  proc_heading proc_block . ';'   (rule 119)
-
-    ';' 	shift, and go to state 163
-
-
-
-state 105
-
-    func_decl  ->  func_heading proc_block . ';'   (rule 120)
-
-    ';' 	shift, and go to state 164
-
-
-
-state 106
-
-    const_decl_sect  ->  const_decl_sect . const_decl   (rule 34)
-    int_decl_sect  ->  const_decl_sect .   (rule 41)
-
-    ID_NAME	shift, and go to state 81
-
-    $default	reduce using rule 41 (int_decl_sect)
-
-    const_decl	go to state 95
-
-
-
-state 107
-
-    type_decl_sect  ->  type_decl_sect . type_decl   (rule 36)
-    int_decl_sect  ->  type_decl_sect .   (rule 42)
-
-    ID_NAME	shift, and go to state 91
-
-    $default	reduce using rule 42 (int_decl_sect)
-
-    type_decl	go to state 96
-
-
-
-state 108
-
-    var_decl_sect  ->  var_decl_sect . var_decl   (rule 38)
-    int_decl_sect  ->  var_decl_sect .   (rule 43)
-
-    ID_NAME	shift, and go to state 16
-
-    $default	reduce using rule 43 (int_decl_sect)
-
-    id_name_list	go to state 93
-    var_decl	go to state 97
-
-
-
-state 109
-
-    int_decl_sect_list  ->  int_decl_sect_list int_decl_sect .   (rule 40)
-
-    $default	reduce using rule 40 (int_decl_sect_list)
-
-
-
-state 110
-
-    int_decl_sect  ->  proc_heading .   (rule 44)
-
-    $default	reduce using rule 44 (int_decl_sect)
-
-
-
-state 111
-
-    int_decl_sect  ->  func_heading .   (rule 45)
-
-    $default	reduce using rule 45 (int_decl_sect)
-
-
-
-state 112
-
-    implementation_part  ->  K_IMPLEMENTATION uses_clause decl_sect_list .   (rule 15)
-    decl_sect_list  ->  decl_sect_list . decl_sect   (rule 19)
-
-    K_CONST	shift, and go to state 28
-    K_FUNCTION	shift, and go to state 29
-    K_LABEL	shift, and go to state 30
-    K_PROCEDURE	shift, and go to state 31
-    K_TYPE	shift, and go to state 32
-    K_VAR	shift, and go to state 33
-
-    $default	reduce using rule 15 (implementation_part)
-
-    decl_sect	go to state 34
-    label_decl_sect	go to state 35
-    const_decl_sect	go to state 36
-    type_decl_sect	go to state 37
-    var_decl_sect	go to state 38
-    proc_decl	go to state 39
-    func_decl	go to state 40
-    proc_heading_beginning	go to state 41
-    func_heading_beginning	go to state 42
-    proc_heading	go to state 43
-    func_heading	go to state 44
-
-
-
-state 113
-
-    unit  ->  unit_heading interface_part implementation_part initialization_part '.' .   (rule 12)
-
-    $default	reduce using rule 12 (unit)
-
-
-
-state 114
-
-    program_heading  ->  K_PROGRAM ID_NAME '(' id_name_list ')' ';' .   (rule 6)
-
-    $default	reduce using rule 6 (program_heading)
-
-
-
-state 115
-
-    factor  ->  K_NIL .   (rule 220)
-
-    $default	reduce using rule 220 (factor)
-
-
-
-state 116
-
-    factor  ->  K_NOT . factor   (rule 224)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    record_variable	go to state 79
-    variable	go to state 128
-    factor	go to state 165
-
-
-
-state 117
-
-    factor  ->  ID_FUNC . '(' expr_list ')'   (rule 223)
-
-    '(' 	shift, and go to state 166
-
-
-
-state 118
-
-    factor  ->  ID_CONST .   (rule 215)
-
-    $default	reduce using rule 215 (factor)
-
-
-
-state 119
-
-    factor  ->  CONST_INT .   (rule 216)
-
-    $default	reduce using rule 216 (factor)
-
-
-
-state 120
-
-    factor  ->  CONST_REAL .   (rule 217)
-
-    $default	reduce using rule 217 (factor)
-
-
-
-state 121
-
-    factor  ->  CONST_STRING .   (rule 218)
-
-    $default	reduce using rule 218 (factor)
-
-
-
-state 122
-
-    factor  ->  '(' . expr ')'   (rule 222)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 167
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 123
-
-    sign  ->  '+' .   (rule 55)
-
-    $default	reduce using rule 55 (sign)
-
-
-
-state 124
-
-    sign  ->  '-' .   (rule 56)
-
-    $default	reduce using rule 56 (sign)
-
-
-
-state 125
-
-    factor  ->  '[' . elem_list ']'   (rule 219)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    $default	reduce using rule 225 (elem_list)
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 168
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-    elem_list	go to state 169
-    elem_list1	go to state 170
-    elem	go to state 171
-
-
-
-state 126
-
-    factor  ->  '@' . variable   (rule 221)
-
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-
-    record_variable	go to state 79
-    variable	go to state 172
-
-
-
-state 127
-
-    simple_expr  ->  sign . term   (rule 199)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    record_variable	go to state 79
-    variable	go to state 128
-    term	go to state 173
-    factor	go to state 132
-
-
-
-state 128
-
-    record_variable  ->  variable . '.'   (rule 183)
-    variable  ->  variable . '[' expr_list ']'   (rule 185)
-    variable  ->  variable . '^'   (rule 187)
-    factor  ->  variable .   (rule 214)
-
-    '.' 	shift, and go to state 148
-    '[' 	shift, and go to state 149
-    '^' 	shift, and go to state 150
-
-    $default	reduce using rule 214 (factor)
-
-
-
-state 129
-
-    case_stmt  ->  K_CASE expr . K_OF case_list else_case K_END   (rule 164)
-
-    K_OF	shift, and go to state 174
-
-
-
-state 130
-
-    expr  ->  simple_expr .   (rule 189)
-    expr  ->  simple_expr . relop simple_expr   (rule 190)
-    simple_expr  ->  simple_expr . addop term   (rule 200)
-
-    K_IN	shift, and go to state 175
-    K_OR	shift, and go to state 176
-    K_XOR	shift, and go to state 177
-    OP_LEQ	shift, and go to state 178
-    OP_NEQ	shift, and go to state 179
-    OP_GEQ	shift, and go to state 180
-    '=' 	shift, and go to state 181
-    '+' 	shift, and go to state 182
-    '-' 	shift, and go to state 183
-    '<' 	shift, and go to state 184
-    '>' 	shift, and go to state 185
-
-    $default	reduce using rule 189 (expr)
-
-    relop	go to state 186
-    addop	go to state 187
-
-
-
-state 131
-
-    simple_expr  ->  term .   (rule 198)
-    term  ->  term . mulop factor   (rule 206)
-
-    K_AND	shift, and go to state 188
-    K_DIV	shift, and go to state 189
-    K_MOD	shift, and go to state 190
-    K_SHL	shift, and go to state 191
-    K_SHR	shift, and go to state 192
-    '*' 	shift, and go to state 193
-    '/' 	shift, and go to state 194
-
-    $default	reduce using rule 198 (simple_expr)
-
-    mulop	go to state 195
-
-
-
-state 132
-
-    term  ->  factor .   (rule 205)
-
-    $default	reduce using rule 205 (term)
-
-
-
-state 133
-
-    for_stmt  ->  K_FOR ID_VAR . OP_DEFEQ expr K_TO expr K_DO stmt   (rule 178)
-    for_stmt  ->  K_FOR ID_VAR . OP_DEFEQ expr K_DOWNTO expr K_DO stmt   (rule 179)
-
-    OP_DEFEQ	shift, and go to state 196
-
-
-
-state 134
-
-    goto_stmt  ->  K_GOTO label .   (rule 158)
-
-    $default	reduce using rule 158 (goto_stmt)
-
-
-
-state 135
-
-    if_stmt  ->  K_IF expr . K_THEN stmt   (rule 162)
-    if_stmt  ->  K_IF expr . K_THEN stmt K_ELSE stmt   (rule 163)
-
-    K_THEN	shift, and go to state 197
-
-
-
-state 136
-
-    stmt_list  ->  stmt_list . ';' stmt   (rule 161)
-    repeat_stmt  ->  K_REPEAT stmt_list . K_UNTIL expr   (rule 176)
-
-    K_UNTIL	shift, and go to state 198
-    ';' 	shift, and go to state 145
-
-
-
-state 137
-
-    while_stmt  ->  K_WHILE expr . K_DO stmt   (rule 177)
-
-    K_DO	shift, and go to state 199
-
-
-
-state 138
-
-    with_stmt  ->  K_WITH variable_list . K_DO stmt   (rule 180)
-    variable_list  ->  variable_list . ',' variable   (rule 182)
-
-    K_DO	shift, and go to state 200
-    ',' 	shift, and go to state 201
-
-
-
-state 139
-
-    variable_list  ->  variable .   (rule 181)
-    record_variable  ->  variable . '.'   (rule 183)
-    variable  ->  variable . '[' expr_list ']'   (rule 185)
-    variable  ->  variable . '^'   (rule 187)
-
-    '.' 	shift, and go to state 148
-    '[' 	shift, and go to state 149
-    '^' 	shift, and go to state 150
-
-    $default	reduce using rule 181 (variable_list)
-
-
-
-state 140
-
-    param_list  ->  '(' . expr_list ')'   (rule 155)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    expr_list	go to state 202
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 203
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 141
-
-    proc_call  ->  ID_PROC param_list .   (rule 153)
-
-    $default	reduce using rule 153 (proc_call)
-
-
-
-state 142
-
-    variable  ->  ID_TYPE '(' . variable ')'   (rule 188)
-
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-
-    record_variable	go to state 79
-    variable	go to state 204
-
-
-
-state 143
-
-    stmt  ->  label ':' . unlabelled_stmt   (rule 140)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    unlabelled_stmt	go to state 205
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 144
-
-    compound_stmt  ->  K_BEGIN stmt_list K_END .   (rule 159)
-
-    $default	reduce using rule 159 (compound_stmt)
-
-
-
-state 145
-
-    stmt_list  ->  stmt_list ';' . stmt   (rule 161)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 206
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 146
-
-    variable  ->  record_variable ID_FIELD .   (rule 186)
-
-    $default	reduce using rule 186 (variable)
-
-
-
-state 147
-
-    assignment  ->  variable OP_DEFEQ . expr   (rule 152)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 207
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 148
-
-    record_variable  ->  variable '.' .   (rule 183)
-
-    $default	reduce using rule 183 (record_variable)
-
-
-
-state 149
-
-    variable  ->  variable '[' . expr_list ']'   (rule 185)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    expr_list	go to state 208
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 203
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 150
-
-    variable  ->  variable '^' .   (rule 187)
-
-    $default	reduce using rule 187 (variable)
-
-
-
-state 151
-
-    const_decl  ->  ID_NAME '=' . const ';'   (rule 46)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 213
-    unsigned_number	go to state 214
-    sign	go to state 215
-
-
-
-state 152
-
-    const_decl  ->  ID_NAME ':' . type '=' typed_const ';'   (rule 47)
-
-    K_ARRAY	shift, and go to state 216
-    K_FILE	shift, and go to state 217
-    K_PACKED	shift, and go to state 218
-    K_RECORD	shift, and go to state 219
-    K_SET	shift, and go to state 220
-    K_STRING	shift, and go to state 221
-    ID_TYPE	shift, and go to state 222
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 223
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '^' 	shift, and go to state 224
-
-    const	go to state 225
-    unsigned_number	go to state 214
-    sign	go to state 215
-    type	go to state 226
-    simple_type	go to state 227
-    pointer_type	go to state 228
-    structured_type	go to state 229
-    unpacked_structured_type	go to state 230
-    array_type	go to state 231
-    record_type	go to state 232
-    set_type	go to state 233
-    file_type	go to state 234
-    string_type	go to state 235
-
-
-
-state 153
-
-    label_decl_sect  ->  K_LABEL label_list ';' .   (rule 26)
-
-    $default	reduce using rule 26 (label_decl_sect)
-
-
-
-state 154
-
-    label_list  ->  label_list ',' . label_decl   (rule 28)
-
-    ID_NAME	shift, and go to state 85
-    CONST_INT	shift, and go to state 86
-
-    label_decl	go to state 236
-
-
-
-state 155
-
-    type_decl  ->  ID_NAME '=' . type ';'   (rule 75)
-
-    K_ARRAY	shift, and go to state 216
-    K_FILE	shift, and go to state 217
-    K_PACKED	shift, and go to state 218
-    K_RECORD	shift, and go to state 219
-    K_SET	shift, and go to state 220
-    K_STRING	shift, and go to state 221
-    ID_TYPE	shift, and go to state 222
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 223
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '^' 	shift, and go to state 224
-
-    const	go to state 225
-    unsigned_number	go to state 214
-    sign	go to state 215
-    type	go to state 237
-    simple_type	go to state 227
-    pointer_type	go to state 228
-    structured_type	go to state 229
-    unpacked_structured_type	go to state 230
-    array_type	go to state 231
-    record_type	go to state 232
-    set_type	go to state 233
-    file_type	go to state 234
-    string_type	go to state 235
-
-
-
-state 156
-
-    var_decl  ->  id_name_list ':' . type absolute_clause ';'   (rule 115)
-
-    K_ARRAY	shift, and go to state 216
-    K_FILE	shift, and go to state 217
-    K_PACKED	shift, and go to state 218
-    K_RECORD	shift, and go to state 219
-    K_SET	shift, and go to state 220
-    K_STRING	shift, and go to state 221
-    ID_TYPE	shift, and go to state 222
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 223
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '^' 	shift, and go to state 224
-
-    const	go to state 225
-    unsigned_number	go to state 214
-    sign	go to state 215
-    type	go to state 238
-    simple_type	go to state 227
-    pointer_type	go to state 228
-    structured_type	go to state 229
-    unpacked_structured_type	go to state 230
-    array_type	go to state 231
-    record_type	go to state 232
-    set_type	go to state 233
-    file_type	go to state 234
-    string_type	go to state 235
-
-
-
-state 157
-
-    fp_sect  ->  K_VAR . id_name_list ':' fptype   (rule 135)
-    fp_sect  ->  K_VAR . id_name_list   (rule 136)
-
-    ID_NAME	shift, and go to state 16
-
-    id_name_list	go to state 239
-
-
-
-state 158
-
-    id_name_list  ->  id_name_list . ',' ID_NAME   (rule 10)
-    fp_sect  ->  id_name_list . ':' fptype   (rule 134)
-
-    ',' 	shift, and go to state 25
-    ':' 	shift, and go to state 240
-
-
-
-state 159
-
-    fp_list  ->  '(' fp_sect_list . ')'   (rule 131)
-    fp_sect_list  ->  fp_sect_list . ';' fp_sect   (rule 133)
-
-    ';' 	shift, and go to state 241
-    ')' 	shift, and go to state 242
-
-
-
-state 160
-
-    fp_sect_list  ->  fp_sect .   (rule 132)
-
-    $default	reduce using rule 132 (fp_sect_list)
-
-
-
-state 161
-
-    proc_heading  ->  proc_heading_beginning fp_list ';' .   (rule 125)
-
-    $default	reduce using rule 125 (proc_heading)
-
-
-
-state 162
-
-    func_heading  ->  func_heading_beginning fp_list ':' . fptype ';'   (rule 126)
-
-    K_STRING	shift, and go to state 243
-    ID_TYPE	shift, and go to state 244
-
-    fptype	go to state 245
-
-
-
-state 163
-
-    proc_decl  ->  proc_heading proc_block ';' .   (rule 119)
-
-    $default	reduce using rule 119 (proc_decl)
-
-
-
-state 164
-
-    func_decl  ->  func_heading proc_block ';' .   (rule 120)
-
-    $default	reduce using rule 120 (func_decl)
-
-
-
-state 165
-
-    factor  ->  K_NOT factor .   (rule 224)
-
-    $default	reduce using rule 224 (factor)
-
-
-
-state 166
-
-    factor  ->  ID_FUNC '(' . expr_list ')'   (rule 223)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    expr_list	go to state 246
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 203
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 167
-
-    factor  ->  '(' expr . ')'   (rule 222)
-
-    ')' 	shift, and go to state 247
-
-
-
-state 168
-
-    elem  ->  expr .   (rule 229)
-    elem  ->  expr . OP_DOTDOT expr   (rule 230)
-
-    OP_DOTDOT	shift, and go to state 248
-
-    $default	reduce using rule 229 (elem)
-
-
-
-state 169
-
-    factor  ->  '[' elem_list . ']'   (rule 219)
-
-    ']' 	shift, and go to state 249
-
-
-
-state 170
-
-    elem_list  ->  elem_list1 .   (rule 226)
-    elem_list1  ->  elem_list1 . ',' elem   (rule 228)
-
-    ',' 	shift, and go to state 250
-
-    $default	reduce using rule 226 (elem_list)
-
-
-
-state 171
-
-    elem_list1  ->  elem .   (rule 227)
-
-    $default	reduce using rule 227 (elem_list1)
-
-
-
-state 172
-
-    record_variable  ->  variable . '.'   (rule 183)
-    variable  ->  variable . '[' expr_list ']'   (rule 185)
-    variable  ->  variable . '^'   (rule 187)
-    factor  ->  '@' variable .   (rule 221)
-
-    '.' 	shift, and go to state 148
-    '[' 	shift, and go to state 149
-    '^' 	shift, and go to state 150
-
-    $default	reduce using rule 221 (factor)
-
-
-
-state 173
-
-    simple_expr  ->  sign term .   (rule 199)
-    term  ->  term . mulop factor   (rule 206)
-
-    K_AND	shift, and go to state 188
-    K_DIV	shift, and go to state 189
-    K_MOD	shift, and go to state 190
-    K_SHL	shift, and go to state 191
-    K_SHR	shift, and go to state 192
-    '*' 	shift, and go to state 193
-    '/' 	shift, and go to state 194
-
-    $default	reduce using rule 199 (simple_expr)
-
-    mulop	go to state 195
-
-
-
-state 174
-
-    case_stmt  ->  K_CASE expr K_OF . case_list else_case K_END   (rule 164)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    $default	reduce using rule 167 (case)
-
-    const	go to state 251
-    unsigned_number	go to state 214
-    sign	go to state 215
-    case_list	go to state 252
-    case	go to state 253
-    case_label_list	go to state 254
-    case_label	go to state 255
-
-
-
-state 175
-
-    relop  ->  K_IN .   (rule 197)
-
-    $default	reduce using rule 197 (relop)
-
-
-
-state 176
-
-    addop  ->  K_OR .   (rule 203)
-
-    $default	reduce using rule 203 (addop)
-
-
-
-state 177
-
-    addop  ->  K_XOR .   (rule 204)
-
-    $default	reduce using rule 204 (addop)
-
-
-
-state 178
-
-    relop  ->  OP_LEQ .   (rule 195)
-
-    $default	reduce using rule 195 (relop)
-
-
-
-state 179
-
-    relop  ->  OP_NEQ .   (rule 192)
-
-    $default	reduce using rule 192 (relop)
-
-
-
-state 180
-
-    relop  ->  OP_GEQ .   (rule 196)
-
-    $default	reduce using rule 196 (relop)
-
-
-
-state 181
-
-    relop  ->  '=' .   (rule 191)
-
-    $default	reduce using rule 191 (relop)
-
-
-
-state 182
-
-    addop  ->  '+' .   (rule 201)
-
-    $default	reduce using rule 201 (addop)
-
-
-
-state 183
-
-    addop  ->  '-' .   (rule 202)
-
-    $default	reduce using rule 202 (addop)
-
-
-
-state 184
-
-    relop  ->  '<' .   (rule 193)
-
-    $default	reduce using rule 193 (relop)
-
-
-
-state 185
-
-    relop  ->  '>' .   (rule 194)
-
-    $default	reduce using rule 194 (relop)
-
-
-
-state 186
-
-    expr  ->  simple_expr relop . simple_expr   (rule 190)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    simple_expr	go to state 256
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 187
-
-    simple_expr  ->  simple_expr addop . term   (rule 200)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    record_variable	go to state 79
-    variable	go to state 128
-    term	go to state 257
-    factor	go to state 132
-
-
-
-state 188
-
-    mulop  ->  K_AND .   (rule 213)
-
-    $default	reduce using rule 213 (mulop)
-
-
-
-state 189
-
-    mulop  ->  K_DIV .   (rule 209)
-
-    $default	reduce using rule 209 (mulop)
-
-
-
-state 190
-
-    mulop  ->  K_MOD .   (rule 210)
-
-    $default	reduce using rule 210 (mulop)
-
-
-
-state 191
-
-    mulop  ->  K_SHL .   (rule 211)
-
-    $default	reduce using rule 211 (mulop)
-
-
-
-state 192
-
-    mulop  ->  K_SHR .   (rule 212)
-
-    $default	reduce using rule 212 (mulop)
-
-
-
-state 193
-
-    mulop  ->  '*' .   (rule 207)
-
-    $default	reduce using rule 207 (mulop)
-
-
-
-state 194
-
-    mulop  ->  '/' .   (rule 208)
-
-    $default	reduce using rule 208 (mulop)
-
-
-
-state 195
-
-    term  ->  term mulop . factor   (rule 206)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    record_variable	go to state 79
-    variable	go to state 128
-    factor	go to state 258
-
-
-
-state 196
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ . expr K_TO expr K_DO stmt   (rule 178)
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ . expr K_DOWNTO expr K_DO stmt   (rule 179)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 259
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 197
-
-    if_stmt  ->  K_IF expr K_THEN . stmt   (rule 162)
-    if_stmt  ->  K_IF expr K_THEN . stmt K_ELSE stmt   (rule 163)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 260
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 198
-
-    repeat_stmt  ->  K_REPEAT stmt_list K_UNTIL . expr   (rule 176)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 261
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 199
-
-    while_stmt  ->  K_WHILE expr K_DO . stmt   (rule 177)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 262
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 200
-
-    with_stmt  ->  K_WITH variable_list K_DO . stmt   (rule 180)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 263
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 201
-
-    variable_list  ->  variable_list ',' . variable   (rule 182)
-
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-
-    record_variable	go to state 79
-    variable	go to state 264
-
-
-
-state 202
-
-    param_list  ->  '(' expr_list . ')'   (rule 155)
-    expr_list  ->  expr_list . ',' expr   (rule 157)
-
-    ')' 	shift, and go to state 265
-    ',' 	shift, and go to state 266
-
-
-
-state 203
-
-    expr_list  ->  expr .   (rule 156)
-
-    $default	reduce using rule 156 (expr_list)
-
-
-
-state 204
-
-    record_variable  ->  variable . '.'   (rule 183)
-    variable  ->  variable . '[' expr_list ']'   (rule 185)
-    variable  ->  variable . '^'   (rule 187)
-    variable  ->  ID_TYPE '(' variable . ')'   (rule 188)
-
-    '.' 	shift, and go to state 148
-    ')' 	shift, and go to state 267
-    '[' 	shift, and go to state 149
-    '^' 	shift, and go to state 150
-
-
-
-state 205
-
-    stmt  ->  label ':' unlabelled_stmt .   (rule 140)
-
-    $default	reduce using rule 140 (stmt)
-
-
-
-state 206
-
-    stmt_list  ->  stmt_list ';' stmt .   (rule 161)
-
-    $default	reduce using rule 161 (stmt_list)
-
-
-
-state 207
-
-    assignment  ->  variable OP_DEFEQ expr .   (rule 152)
-
-    $default	reduce using rule 152 (assignment)
-
-
-
-state 208
-
-    expr_list  ->  expr_list . ',' expr   (rule 157)
-    variable  ->  variable '[' expr_list . ']'   (rule 185)
-
-    ',' 	shift, and go to state 266
-    ']' 	shift, and go to state 268
-
-
-
-state 209
-
-    const  ->  ID_CONST .   (rule 50)
-
-    $default	reduce using rule 50 (const)
-
-
-
-state 210
-
-    unsigned_number  ->  CONST_INT .   (rule 53)
-
-    $default	reduce using rule 53 (unsigned_number)
-
-
-
-state 211
-
-    unsigned_number  ->  CONST_REAL .   (rule 54)
-
-    $default	reduce using rule 54 (unsigned_number)
-
-
-
-state 212
-
-    const  ->  CONST_STRING .   (rule 52)
-
-    $default	reduce using rule 52 (const)
-
-
-
-state 213
-
-    const_decl  ->  ID_NAME '=' const . ';'   (rule 46)
-
-    ';' 	shift, and go to state 269
-
-
-
-state 214
-
-    const  ->  unsigned_number .   (rule 48)
-
-    $default	reduce using rule 48 (const)
-
-
-
-state 215
-
-    const  ->  sign . unsigned_number   (rule 49)
-    const  ->  sign . ID_CONST   (rule 51)
-
-    ID_CONST	shift, and go to state 270
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-
-    unsigned_number	go to state 271
-
-
-
-state 216
-
-    array_type  ->  K_ARRAY . '[' simple_type_list ']' K_OF type   (rule 90)
-
-    '[' 	shift, and go to state 272
-
-
-
-state 217
-
-    file_type  ->  K_FILE . K_OF type   (rule 111)
-    file_type  ->  K_FILE .   (rule 112)
-
-    K_OF	shift, and go to state 273
-
-    $default	reduce using rule 112 (file_type)
-
-
-
-state 218
-
-    structured_type  ->  K_PACKED . unpacked_structured_type   (rule 85)
-
-    K_ARRAY	shift, and go to state 216
-    K_FILE	shift, and go to state 217
-    K_RECORD	shift, and go to state 219
-    K_SET	shift, and go to state 220
-
-    unpacked_structured_type	go to state 274
-    array_type	go to state 231
-    record_type	go to state 232
-    set_type	go to state 233
-    file_type	go to state 234
-
-
-
-state 219
-
-    record_type  ->  K_RECORD . field_list K_END   (rule 93)
-
-    K_CASE	shift, and go to state 275
-    ID_NAME	shift, and go to state 16
-
-    $default	reduce using rule 99 (record_section)
-
-    id_name_list	go to state 276
-    field_list	go to state 277
-    fixed_part	go to state 278
-    record_section	go to state 279
-    variant_part	go to state 280
-
-
-
-state 220
-
-    set_type  ->  K_SET . K_OF simple_type   (rule 110)
-
-    K_OF	shift, and go to state 281
-
-
-
-state 221
-
-    string_type  ->  K_STRING .   (rule 113)
-    string_type  ->  K_STRING . '[' const ']'   (rule 114)
-
-    '[' 	shift, and go to state 282
-
-    $default	reduce using rule 113 (string_type)
-
-
-
-state 222
-
-    simple_type  ->  ID_TYPE .   (rule 80)
-
-    $default	reduce using rule 80 (simple_type)
-
-
-
-state 223
-
-    simple_type  ->  '(' . id_name_list ')'   (rule 82)
-
-    ID_NAME	shift, and go to state 16
-
-    id_name_list	go to state 283
-
-
-
-state 224
-
-    pointer_type  ->  '^' . ID_TYPE   (rule 83)
-
-    ID_TYPE	shift, and go to state 284
-
-
-
-state 225
-
-    simple_type  ->  const . OP_DOTDOT const   (rule 81)
-
-    OP_DOTDOT	shift, and go to state 285
-
-
-
-state 226
-
-    const_decl  ->  ID_NAME ':' type . '=' typed_const ';'   (rule 47)
-
-    '=' 	shift, and go to state 286
-
-
-
-state 227
-
-    type  ->  simple_type .   (rule 76)
-
-    $default	reduce using rule 76 (type)
-
-
-
-state 228
-
-    type  ->  pointer_type .   (rule 77)
-
-    $default	reduce using rule 77 (type)
-
-
-
-state 229
-
-    type  ->  structured_type .   (rule 78)
-
-    $default	reduce using rule 78 (type)
-
-
-
-state 230
-
-    structured_type  ->  unpacked_structured_type .   (rule 84)
-
-    $default	reduce using rule 84 (structured_type)
-
-
-
-state 231
-
-    unpacked_structured_type  ->  array_type .   (rule 86)
-
-    $default	reduce using rule 86 (unpacked_structured_type)
-
-
-
-state 232
-
-    unpacked_structured_type  ->  record_type .   (rule 87)
-
-    $default	reduce using rule 87 (unpacked_structured_type)
-
-
-
-state 233
-
-    unpacked_structured_type  ->  set_type .   (rule 88)
-
-    $default	reduce using rule 88 (unpacked_structured_type)
-
-
-
-state 234
-
-    unpacked_structured_type  ->  file_type .   (rule 89)
-
-    $default	reduce using rule 89 (unpacked_structured_type)
-
-
-
-state 235
-
-    type  ->  string_type .   (rule 79)
-
-    $default	reduce using rule 79 (type)
-
-
-
-state 236
-
-    label_list  ->  label_list ',' label_decl .   (rule 28)
-
-    $default	reduce using rule 28 (label_list)
-
-
-
-state 237
-
-    type_decl  ->  ID_NAME '=' type . ';'   (rule 75)
-
-    ';' 	shift, and go to state 287
-
-
-
-state 238
-
-    var_decl  ->  id_name_list ':' type . absolute_clause ';'   (rule 115)
-
-    K_ABSOLUTE	shift, and go to state 288
-
-    $default	reduce using rule 116 (absolute_clause)
-
-    absolute_clause	go to state 289
-
-
-
-state 239
-
-    id_name_list  ->  id_name_list . ',' ID_NAME   (rule 10)
-    fp_sect  ->  K_VAR id_name_list . ':' fptype   (rule 135)
-    fp_sect  ->  K_VAR id_name_list .   (rule 136)
-
-    ',' 	shift, and go to state 25
-    ':' 	shift, and go to state 290
-
-    $default	reduce using rule 136 (fp_sect)
-
-
-
-state 240
-
-    fp_sect  ->  id_name_list ':' . fptype   (rule 134)
-
-    K_STRING	shift, and go to state 243
-    ID_TYPE	shift, and go to state 244
-
-    fptype	go to state 291
-
-
-
-state 241
-
-    fp_sect_list  ->  fp_sect_list ';' . fp_sect   (rule 133)
-
-    K_VAR	shift, and go to state 157
-    ID_NAME	shift, and go to state 16
-
-    id_name_list	go to state 158
-    fp_sect	go to state 292
-
-
-
-state 242
-
-    fp_list  ->  '(' fp_sect_list ')' .   (rule 131)
-
-    $default	reduce using rule 131 (fp_list)
-
-
-
-state 243
-
-    fptype  ->  K_STRING .   (rule 138)
-
-    $default	reduce using rule 138 (fptype)
-
-
-
-state 244
-
-    fptype  ->  ID_TYPE .   (rule 137)
-
-    $default	reduce using rule 137 (fptype)
-
-
-
-state 245
-
-    func_heading  ->  func_heading_beginning fp_list ':' fptype . ';'   (rule 126)
-
-    ';' 	shift, and go to state 293
-
-
-
-state 246
-
-    expr_list  ->  expr_list . ',' expr   (rule 157)
-    factor  ->  ID_FUNC '(' expr_list . ')'   (rule 223)
-
-    ')' 	shift, and go to state 294
-    ',' 	shift, and go to state 266
-
-
-
-state 247
-
-    factor  ->  '(' expr ')' .   (rule 222)
-
-    $default	reduce using rule 222 (factor)
-
-
-
-state 248
-
-    elem  ->  expr OP_DOTDOT . expr   (rule 230)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 295
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 249
-
-    factor  ->  '[' elem_list ']' .   (rule 219)
-
-    $default	reduce using rule 219 (factor)
-
-
-
-state 250
-
-    elem_list1  ->  elem_list1 ',' . elem   (rule 228)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 168
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-    elem	go to state 296
-
-
-
-state 251
-
-    case_label  ->  const .   (rule 171)
-    case_label  ->  const . OP_DOTDOT const   (rule 172)
-
-    OP_DOTDOT	shift, and go to state 297
-
-    $default	reduce using rule 171 (case_label)
-
-
-
-state 252
-
-    case_stmt  ->  K_CASE expr K_OF case_list . else_case K_END   (rule 164)
-    case_list  ->  case_list . ';' case   (rule 166)
-
-    K_ELSE	shift, and go to state 298
-    ';' 	shift, and go to state 299
-
-    $default	reduce using rule 173 (else_case)
-
-    else_case	go to state 300
-
-
-
-state 253
-
-    case_list  ->  case .   (rule 165)
-
-    $default	reduce using rule 165 (case_list)
-
-
-
-state 254
-
-    case  ->  case_label_list . ':' stmt   (rule 168)
-    case_label_list  ->  case_label_list . ',' case_label   (rule 170)
-
-    ',' 	shift, and go to state 301
-    ':' 	shift, and go to state 302
-
-
-
-state 255
-
-    case_label_list  ->  case_label .   (rule 169)
-
-    $default	reduce using rule 169 (case_label_list)
-
-
-
-state 256
-
-    expr  ->  simple_expr relop simple_expr .   (rule 190)
-    simple_expr  ->  simple_expr . addop term   (rule 200)
-
-    K_OR	shift, and go to state 176
-    K_XOR	shift, and go to state 177
-    '+' 	shift, and go to state 182
-    '-' 	shift, and go to state 183
-
-    $default	reduce using rule 190 (expr)
-
-    addop	go to state 187
-
-
-
-state 257
-
-    simple_expr  ->  simple_expr addop term .   (rule 200)
-    term  ->  term . mulop factor   (rule 206)
-
-    K_AND	shift, and go to state 188
-    K_DIV	shift, and go to state 189
-    K_MOD	shift, and go to state 190
-    K_SHL	shift, and go to state 191
-    K_SHR	shift, and go to state 192
-    '*' 	shift, and go to state 193
-    '/' 	shift, and go to state 194
-
-    $default	reduce using rule 200 (simple_expr)
-
-    mulop	go to state 195
-
-
-
-state 258
-
-    term  ->  term mulop factor .   (rule 206)
-
-    $default	reduce using rule 206 (term)
-
-
-
-state 259
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr . K_TO expr K_DO stmt   (rule 178)
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr . K_DOWNTO expr K_DO stmt   (rule 179)
-
-    K_DOWNTO	shift, and go to state 303
-    K_TO	shift, and go to state 304
-
-
-
-state 260
-
-    if_stmt  ->  K_IF expr K_THEN stmt .   (rule 162)
-    if_stmt  ->  K_IF expr K_THEN stmt . K_ELSE stmt   (rule 163)
-
-    K_ELSE	shift, and go to state 305
-
-    $default	reduce using rule 162 (if_stmt)
-
-
-
-state 261
-
-    repeat_stmt  ->  K_REPEAT stmt_list K_UNTIL expr .   (rule 176)
-
-    $default	reduce using rule 176 (repeat_stmt)
-
-
-
-state 262
-
-    while_stmt  ->  K_WHILE expr K_DO stmt .   (rule 177)
-
-    $default	reduce using rule 177 (while_stmt)
-
-
-
-state 263
-
-    with_stmt  ->  K_WITH variable_list K_DO stmt .   (rule 180)
-
-    $default	reduce using rule 180 (with_stmt)
-
-
-
-state 264
-
-    variable_list  ->  variable_list ',' variable .   (rule 182)
-    record_variable  ->  variable . '.'   (rule 183)
-    variable  ->  variable . '[' expr_list ']'   (rule 185)
-    variable  ->  variable . '^'   (rule 187)
-
-    '.' 	shift, and go to state 148
-    '[' 	shift, and go to state 149
-    '^' 	shift, and go to state 150
-
-    $default	reduce using rule 182 (variable_list)
-
-
-
-state 265
-
-    param_list  ->  '(' expr_list ')' .   (rule 155)
-
-    $default	reduce using rule 155 (param_list)
-
-
-
-state 266
-
-    expr_list  ->  expr_list ',' . expr   (rule 157)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 306
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 267
-
-    variable  ->  ID_TYPE '(' variable ')' .   (rule 188)
-
-    $default	reduce using rule 188 (variable)
-
-
-
-state 268
-
-    variable  ->  variable '[' expr_list ']' .   (rule 185)
-
-    $default	reduce using rule 185 (variable)
-
-
-
-state 269
-
-    const_decl  ->  ID_NAME '=' const ';' .   (rule 46)
-
-    $default	reduce using rule 46 (const_decl)
-
-
-
-state 270
-
-    const  ->  sign ID_CONST .   (rule 51)
-
-    $default	reduce using rule 51 (const)
-
-
-
-state 271
-
-    const  ->  sign unsigned_number .   (rule 49)
-
-    $default	reduce using rule 49 (const)
-
-
-
-state 272
-
-    array_type  ->  K_ARRAY '[' . simple_type_list ']' K_OF type   (rule 90)
-
-    ID_TYPE	shift, and go to state 222
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 223
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 225
-    unsigned_number	go to state 214
-    sign	go to state 215
-    simple_type	go to state 307
-    simple_type_list	go to state 308
-
-
-
-state 273
-
-    file_type  ->  K_FILE K_OF . type   (rule 111)
-
-    K_ARRAY	shift, and go to state 216
-    K_FILE	shift, and go to state 217
-    K_PACKED	shift, and go to state 218
-    K_RECORD	shift, and go to state 219
-    K_SET	shift, and go to state 220
-    K_STRING	shift, and go to state 221
-    ID_TYPE	shift, and go to state 222
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 223
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '^' 	shift, and go to state 224
-
-    const	go to state 225
-    unsigned_number	go to state 214
-    sign	go to state 215
-    type	go to state 309
-    simple_type	go to state 227
-    pointer_type	go to state 228
-    structured_type	go to state 229
-    unpacked_structured_type	go to state 230
-    array_type	go to state 231
-    record_type	go to state 232
-    set_type	go to state 233
-    file_type	go to state 234
-    string_type	go to state 235
-
-
-
-state 274
-
-    structured_type  ->  K_PACKED unpacked_structured_type .   (rule 85)
-
-    $default	reduce using rule 85 (structured_type)
-
-
-
-state 275
-
-    variant_part  ->  K_CASE . tag_field K_OF variant_list   (rule 101)
-
-    ID_NAME	shift, and go to state 310
-
-    tag_field	go to state 311
-
-
-
-state 276
-
-    id_name_list  ->  id_name_list . ',' ID_NAME   (rule 10)
-    record_section  ->  id_name_list . ':' type   (rule 100)
-
-    ',' 	shift, and go to state 25
-    ':' 	shift, and go to state 312
-
-
-
-state 277
-
-    record_type  ->  K_RECORD field_list . K_END   (rule 93)
-
-    K_END	shift, and go to state 313
-
-
-
-state 278
-
-    field_list  ->  fixed_part .   (rule 94)
-    field_list  ->  fixed_part . ';' variant_part   (rule 96)
-    fixed_part  ->  fixed_part . ';' record_section   (rule 98)
-
-    ';' 	shift, and go to state 314
-
-    $default	reduce using rule 94 (field_list)
-
-
-
-state 279
-
-    fixed_part  ->  record_section .   (rule 97)
-
-    $default	reduce using rule 97 (fixed_part)
-
-
-
-state 280
-
-    field_list  ->  variant_part .   (rule 95)
-
-    $default	reduce using rule 95 (field_list)
-
-
-
-state 281
-
-    set_type  ->  K_SET K_OF . simple_type   (rule 110)
-
-    ID_TYPE	shift, and go to state 222
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 223
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 225
-    unsigned_number	go to state 214
-    sign	go to state 215
-    simple_type	go to state 315
-
-
-
-state 282
-
-    string_type  ->  K_STRING '[' . const ']'   (rule 114)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 316
-    unsigned_number	go to state 214
-    sign	go to state 215
-
-
-
-state 283
-
-    id_name_list  ->  id_name_list . ',' ID_NAME   (rule 10)
-    simple_type  ->  '(' id_name_list . ')'   (rule 82)
-
-    ')' 	shift, and go to state 317
-    ',' 	shift, and go to state 25
-
-
-
-state 284
-
-    pointer_type  ->  '^' ID_TYPE .   (rule 83)
-
-    $default	reduce using rule 83 (pointer_type)
-
-
-
-state 285
-
-    simple_type  ->  const OP_DOTDOT . const   (rule 81)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 318
-    unsigned_number	go to state 214
-    sign	go to state 215
-
-
-
-state 286
-
-    const_decl  ->  ID_NAME ':' type '=' . typed_const ';'   (rule 47)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 319
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 320
-
-    const	go to state 321
-    unsigned_number	go to state 214
-    sign	go to state 215
-    typed_const	go to state 322
-    array_const	go to state 323
-    record_const	go to state 324
-    set_const	go to state 325
-
-
-
-state 287
-
-    type_decl  ->  ID_NAME '=' type ';' .   (rule 75)
-
-    $default	reduce using rule 75 (type_decl)
-
-
-
-state 288
-
-    absolute_clause  ->  K_ABSOLUTE . CONST_INT ':' CONST_INT   (rule 117)
-    absolute_clause  ->  K_ABSOLUTE . ID_VAR   (rule 118)
-
-    ID_VAR	shift, and go to state 326
-    CONST_INT	shift, and go to state 327
-
-
-
-state 289
-
-    var_decl  ->  id_name_list ':' type absolute_clause . ';'   (rule 115)
-
-    ';' 	shift, and go to state 328
-
-
-
-state 290
-
-    fp_sect  ->  K_VAR id_name_list ':' . fptype   (rule 135)
-
-    K_STRING	shift, and go to state 243
-    ID_TYPE	shift, and go to state 244
-
-    fptype	go to state 329
-
-
-
-state 291
-
-    fp_sect  ->  id_name_list ':' fptype .   (rule 134)
-
-    $default	reduce using rule 134 (fp_sect)
-
-
-
-state 292
-
-    fp_sect_list  ->  fp_sect_list ';' fp_sect .   (rule 133)
-
-    $default	reduce using rule 133 (fp_sect_list)
-
-
-
-state 293
-
-    func_heading  ->  func_heading_beginning fp_list ':' fptype ';' .   (rule 126)
-
-    $default	reduce using rule 126 (func_heading)
-
-
-
-state 294
-
-    factor  ->  ID_FUNC '(' expr_list ')' .   (rule 223)
-
-    $default	reduce using rule 223 (factor)
-
-
-
-state 295
-
-    elem  ->  expr OP_DOTDOT expr .   (rule 230)
-
-    $default	reduce using rule 230 (elem)
-
-
-
-state 296
-
-    elem_list1  ->  elem_list1 ',' elem .   (rule 228)
-
-    $default	reduce using rule 228 (elem_list1)
-
-
-
-state 297
-
-    case_label  ->  const OP_DOTDOT . const   (rule 172)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 330
-    unsigned_number	go to state 214
-    sign	go to state 215
-
-
-
-state 298
-
-    else_case  ->  K_ELSE . stmt   (rule 174)
-    else_case  ->  K_ELSE . stmt ';'   (rule 175)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 331
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 299
-
-    case_list  ->  case_list ';' . case   (rule 166)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    $default	reduce using rule 167 (case)
-
-    const	go to state 251
-    unsigned_number	go to state 214
-    sign	go to state 215
-    case	go to state 332
-    case_label_list	go to state 254
-    case_label	go to state 255
-
-
-
-state 300
-
-    case_stmt  ->  K_CASE expr K_OF case_list else_case . K_END   (rule 164)
-
-    K_END	shift, and go to state 333
-
-
-
-state 301
-
-    case_label_list  ->  case_label_list ',' . case_label   (rule 170)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 251
-    unsigned_number	go to state 214
-    sign	go to state 215
-    case_label	go to state 334
-
-
-
-state 302
-
-    case  ->  case_label_list ':' . stmt   (rule 168)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 335
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 303
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr K_DOWNTO . expr K_DO stmt   (rule 179)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 336
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 304
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr K_TO . expr K_DO stmt   (rule 178)
-
-    K_NIL	shift, and go to state 115
-    K_NOT	shift, and go to state 116
-    ID_FUNC	shift, and go to state 117
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_CONST	shift, and go to state 118
-    CONST_INT	shift, and go to state 119
-    CONST_REAL	shift, and go to state 120
-    CONST_STRING	shift, and go to state 121
-    '(' 	shift, and go to state 122
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 125
-    '@' 	shift, and go to state 126
-
-    sign	go to state 127
-    record_variable	go to state 79
-    variable	go to state 128
-    expr	go to state 337
-    simple_expr	go to state 130
-    term	go to state 131
-    factor	go to state 132
-
-
-
-state 305
-
-    if_stmt  ->  K_IF expr K_THEN stmt K_ELSE . stmt   (rule 163)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 338
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 306
-
-    expr_list  ->  expr_list ',' expr .   (rule 157)
-
-    $default	reduce using rule 157 (expr_list)
-
-
-
-state 307
-
-    simple_type_list  ->  simple_type .   (rule 91)
-
-    $default	reduce using rule 91 (simple_type_list)
-
-
-
-state 308
-
-    array_type  ->  K_ARRAY '[' simple_type_list . ']' K_OF type   (rule 90)
-    simple_type_list  ->  simple_type_list . ',' simple_type   (rule 92)
-
-    ',' 	shift, and go to state 339
-    ']' 	shift, and go to state 340
-
-
-
-state 309
-
-    file_type  ->  K_FILE K_OF type .   (rule 111)
-
-    $default	reduce using rule 111 (file_type)
-
-
-
-state 310
-
-    tag_field  ->  ID_NAME .   (rule 102)
-    tag_field  ->  ID_NAME . ':' ID_TYPE   (rule 103)
-
-    ':' 	shift, and go to state 341
-
-    $default	reduce using rule 102 (tag_field)
-
-
-
-state 311
-
-    variant_part  ->  K_CASE tag_field . K_OF variant_list   (rule 101)
-
-    K_OF	shift, and go to state 342
-
-
-
-state 312
-
-    record_section  ->  id_name_list ':' . type   (rule 100)
-
-    K_ARRAY	shift, and go to state 216
-    K_FILE	shift, and go to state 217
-    K_PACKED	shift, and go to state 218
-    K_RECORD	shift, and go to state 219
-    K_SET	shift, and go to state 220
-    K_STRING	shift, and go to state 221
-    ID_TYPE	shift, and go to state 222
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 223
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '^' 	shift, and go to state 224
-
-    const	go to state 225
-    unsigned_number	go to state 214
-    sign	go to state 215
-    type	go to state 343
-    simple_type	go to state 227
-    pointer_type	go to state 228
-    structured_type	go to state 229
-    unpacked_structured_type	go to state 230
-    array_type	go to state 231
-    record_type	go to state 232
-    set_type	go to state 233
-    file_type	go to state 234
-    string_type	go to state 235
-
-
-
-state 313
-
-    record_type  ->  K_RECORD field_list K_END .   (rule 93)
-
-    $default	reduce using rule 93 (record_type)
-
-
-
-state 314
-
-    field_list  ->  fixed_part ';' . variant_part   (rule 96)
-    fixed_part  ->  fixed_part ';' . record_section   (rule 98)
-
-    K_CASE	shift, and go to state 275
-    ID_NAME	shift, and go to state 16
-
-    $default	reduce using rule 99 (record_section)
-
-    id_name_list	go to state 276
-    record_section	go to state 344
-    variant_part	go to state 345
-
-
-
-state 315
-
-    set_type  ->  K_SET K_OF simple_type .   (rule 110)
-
-    $default	reduce using rule 110 (set_type)
-
-
-
-state 316
-
-    string_type  ->  K_STRING '[' const . ']'   (rule 114)
-
-    ']' 	shift, and go to state 346
-
-
-
-state 317
-
-    simple_type  ->  '(' id_name_list ')' .   (rule 82)
-
-    $default	reduce using rule 82 (simple_type)
-
-
-
-state 318
-
-    simple_type  ->  const OP_DOTDOT const .   (rule 81)
-
-    $default	reduce using rule 81 (simple_type)
-
-
-
-state 319
-
-    array_const  ->  '(' . typed_const_list ')'   (rule 61)
-    record_const  ->  '(' . const_field_list ')'   (rule 64)
-
-    ID_CONST	shift, and go to state 209
-    ID_FIELD	shift, and go to state 347
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 319
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 320
-
-    const	go to state 321
-    unsigned_number	go to state 214
-    sign	go to state 215
-    typed_const	go to state 348
-    array_const	go to state 323
-    typed_const_list	go to state 349
-    record_const	go to state 324
-    const_field_list	go to state 350
-    const_field	go to state 351
-    set_const	go to state 325
-
-
-
-state 320
-
-    set_const  ->  '[' . const_elem_list ']'   (rule 68)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    $default	reduce using rule 69 (const_elem_list)
-
-    const	go to state 352
-    unsigned_number	go to state 214
-    sign	go to state 215
-    const_elem_list	go to state 353
-    const_elem_list1	go to state 354
-    const_elem	go to state 355
-
-
-
-state 321
-
-    typed_const  ->  const .   (rule 57)
-
-    $default	reduce using rule 57 (typed_const)
-
-
-
-state 322
-
-    const_decl  ->  ID_NAME ':' type '=' typed_const . ';'   (rule 47)
-
-    ';' 	shift, and go to state 356
-
-
-
-state 323
-
-    typed_const  ->  array_const .   (rule 58)
-
-    $default	reduce using rule 58 (typed_const)
-
-
-
-state 324
-
-    typed_const  ->  record_const .   (rule 59)
-
-    $default	reduce using rule 59 (typed_const)
-
-
-
-state 325
-
-    typed_const  ->  set_const .   (rule 60)
-
-    $default	reduce using rule 60 (typed_const)
-
-
-
-state 326
-
-    absolute_clause  ->  K_ABSOLUTE ID_VAR .   (rule 118)
-
-    $default	reduce using rule 118 (absolute_clause)
-
-
-
-state 327
-
-    absolute_clause  ->  K_ABSOLUTE CONST_INT . ':' CONST_INT   (rule 117)
-
-    ':' 	shift, and go to state 357
-
-
-
-state 328
-
-    var_decl  ->  id_name_list ':' type absolute_clause ';' .   (rule 115)
-
-    $default	reduce using rule 115 (var_decl)
-
-
-
-state 329
-
-    fp_sect  ->  K_VAR id_name_list ':' fptype .   (rule 135)
-
-    $default	reduce using rule 135 (fp_sect)
-
-
-
-state 330
-
-    case_label  ->  const OP_DOTDOT const .   (rule 172)
-
-    $default	reduce using rule 172 (case_label)
-
-
-
-state 331
-
-    else_case  ->  K_ELSE stmt .   (rule 174)
-    else_case  ->  K_ELSE stmt . ';'   (rule 175)
-
-    ';' 	shift, and go to state 358
-
-    $default	reduce using rule 174 (else_case)
-
-
-
-state 332
-
-    case_list  ->  case_list ';' case .   (rule 166)
-
-    $default	reduce using rule 166 (case_list)
-
-
-
-state 333
-
-    case_stmt  ->  K_CASE expr K_OF case_list else_case K_END .   (rule 164)
-
-    $default	reduce using rule 164 (case_stmt)
-
-
-
-state 334
-
-    case_label_list  ->  case_label_list ',' case_label .   (rule 170)
-
-    $default	reduce using rule 170 (case_label_list)
-
-
-
-state 335
-
-    case  ->  case_label_list ':' stmt .   (rule 168)
-
-    $default	reduce using rule 168 (case)
-
-
-
-state 336
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr K_DOWNTO expr . K_DO stmt   (rule 179)
-
-    K_DO	shift, and go to state 359
-
-
-
-state 337
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr K_TO expr . K_DO stmt   (rule 178)
-
-    K_DO	shift, and go to state 360
-
-
-
-state 338
-
-    if_stmt  ->  K_IF expr K_THEN stmt K_ELSE stmt .   (rule 163)
-
-    $default	reduce using rule 163 (if_stmt)
-
-
-
-state 339
-
-    simple_type_list  ->  simple_type_list ',' . simple_type   (rule 92)
-
-    ID_TYPE	shift, and go to state 222
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 223
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 225
-    unsigned_number	go to state 214
-    sign	go to state 215
-    simple_type	go to state 361
-
-
-
-state 340
-
-    array_type  ->  K_ARRAY '[' simple_type_list ']' . K_OF type   (rule 90)
-
-    K_OF	shift, and go to state 362
-
-
-
-state 341
-
-    tag_field  ->  ID_NAME ':' . ID_TYPE   (rule 103)
-
-    ID_TYPE	shift, and go to state 363
-
-
-
-state 342
-
-    variant_part  ->  K_CASE tag_field K_OF . variant_list   (rule 101)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    $default	reduce using rule 106 (variant)
-
-    const	go to state 364
-    unsigned_number	go to state 214
-    sign	go to state 215
-    variant_list	go to state 365
-    variant	go to state 366
-    case_tag_list	go to state 367
-
-
-
-state 343
-
-    record_section  ->  id_name_list ':' type .   (rule 100)
-
-    $default	reduce using rule 100 (record_section)
-
-
-
-state 344
-
-    fixed_part  ->  fixed_part ';' record_section .   (rule 98)
-
-    $default	reduce using rule 98 (fixed_part)
-
-
-
-state 345
-
-    field_list  ->  fixed_part ';' variant_part .   (rule 96)
-
-    $default	reduce using rule 96 (field_list)
-
-
-
-state 346
-
-    string_type  ->  K_STRING '[' const ']' .   (rule 114)
-
-    $default	reduce using rule 114 (string_type)
-
-
-
-state 347
-
-    const_field  ->  ID_FIELD . ':' typed_const   (rule 67)
-
-    ':' 	shift, and go to state 368
-
-
-
-state 348
-
-    typed_const_list  ->  typed_const .   (rule 62)
-
-    $default	reduce using rule 62 (typed_const_list)
-
-
-
-state 349
-
-    array_const  ->  '(' typed_const_list . ')'   (rule 61)
-    typed_const_list  ->  typed_const_list . ',' typed_const   (rule 63)
-
-    ')' 	shift, and go to state 369
-    ',' 	shift, and go to state 370
-
-
-
-state 350
-
-    record_const  ->  '(' const_field_list . ')'   (rule 64)
-    const_field_list  ->  const_field_list . ',' const_field   (rule 66)
-
-    ')' 	shift, and go to state 371
-    ',' 	shift, and go to state 372
-
-
-
-state 351
-
-    const_field_list  ->  const_field .   (rule 65)
-
-    $default	reduce using rule 65 (const_field_list)
-
-
-
-state 352
-
-    const_elem  ->  const .   (rule 73)
-    const_elem  ->  const . OP_DOTDOT const   (rule 74)
-
-    OP_DOTDOT	shift, and go to state 373
-
-    $default	reduce using rule 73 (const_elem)
-
-
-
-state 353
-
-    set_const  ->  '[' const_elem_list . ']'   (rule 68)
-
-    ']' 	shift, and go to state 374
-
-
-
-state 354
-
-    const_elem_list  ->  const_elem_list1 .   (rule 70)
-    const_elem_list1  ->  const_elem_list1 . ',' const_elem   (rule 72)
-
-    ',' 	shift, and go to state 375
-
-    $default	reduce using rule 70 (const_elem_list)
-
-
-
-state 355
-
-    const_elem_list1  ->  const_elem .   (rule 71)
-
-    $default	reduce using rule 71 (const_elem_list1)
-
-
-
-state 356
-
-    const_decl  ->  ID_NAME ':' type '=' typed_const ';' .   (rule 47)
-
-    $default	reduce using rule 47 (const_decl)
-
-
-
-state 357
-
-    absolute_clause  ->  K_ABSOLUTE CONST_INT ':' . CONST_INT   (rule 117)
-
-    CONST_INT	shift, and go to state 376
-
-
-
-state 358
-
-    else_case  ->  K_ELSE stmt ';' .   (rule 175)
-
-    $default	reduce using rule 175 (else_case)
-
-
-
-state 359
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr K_DOWNTO expr K_DO . stmt   (rule 179)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 377
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 360
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr K_TO expr K_DO . stmt   (rule 178)
-
-    K_BEGIN	shift, and go to state 27
-    K_CASE	shift, and go to state 53
-    K_FOR	shift, and go to state 54
-    K_GOTO	shift, and go to state 55
-    K_IF	shift, and go to state 56
-    K_REPEAT	shift, and go to state 57
-    K_WHILE	shift, and go to state 58
-    K_WITH	shift, and go to state 59
-    ID_PROC	shift, and go to state 60
-    ID_VAR	shift, and go to state 61
-    ID_TYPE	shift, and go to state 62
-    ID_LABEL	shift, and go to state 63
-    CONST_INT	shift, and go to state 64
-
-    $default	reduce using rule 141 (unlabelled_stmt)
-
-    label	go to state 65
-    stmt	go to state 378
-    unlabelled_stmt	go to state 67
-    assignment	go to state 68
-    proc_call	go to state 69
-    goto_stmt	go to state 70
-    compound_stmt	go to state 71
-    if_stmt	go to state 73
-    case_stmt	go to state 74
-    repeat_stmt	go to state 75
-    while_stmt	go to state 76
-    for_stmt	go to state 77
-    with_stmt	go to state 78
-    record_variable	go to state 79
-    variable	go to state 80
-
-
-
-state 361
-
-    simple_type_list  ->  simple_type_list ',' simple_type .   (rule 92)
-
-    $default	reduce using rule 92 (simple_type_list)
-
-
-
-state 362
-
-    array_type  ->  K_ARRAY '[' simple_type_list ']' K_OF . type   (rule 90)
-
-    K_ARRAY	shift, and go to state 216
-    K_FILE	shift, and go to state 217
-    K_PACKED	shift, and go to state 218
-    K_RECORD	shift, and go to state 219
-    K_SET	shift, and go to state 220
-    K_STRING	shift, and go to state 221
-    ID_TYPE	shift, and go to state 222
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 223
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '^' 	shift, and go to state 224
-
-    const	go to state 225
-    unsigned_number	go to state 214
-    sign	go to state 215
-    type	go to state 379
-    simple_type	go to state 227
-    pointer_type	go to state 228
-    structured_type	go to state 229
-    unpacked_structured_type	go to state 230
-    array_type	go to state 231
-    record_type	go to state 232
-    set_type	go to state 233
-    file_type	go to state 234
-    string_type	go to state 235
-
-
-
-state 363
-
-    tag_field  ->  ID_NAME ':' ID_TYPE .   (rule 103)
-
-    $default	reduce using rule 103 (tag_field)
-
-
-
-state 364
-
-    case_tag_list  ->  const .   (rule 108)
-
-    $default	reduce using rule 108 (case_tag_list)
-
-
-
-state 365
-
-    variant_part  ->  K_CASE tag_field K_OF variant_list .   (rule 101)
-    variant_list  ->  variant_list . ';' variant   (rule 105)
-
-    ';' 	shift, and go to state 380
-
-    $default	reduce using rule 101 (variant_part)
-
-
-
-state 366
-
-    variant_list  ->  variant .   (rule 104)
-
-    $default	reduce using rule 104 (variant_list)
-
-
-
-state 367
-
-    variant  ->  case_tag_list . ':' '(' field_list ')'   (rule 107)
-    case_tag_list  ->  case_tag_list . ',' const   (rule 109)
-
-    ',' 	shift, and go to state 381
-    ':' 	shift, and go to state 382
-
-
-
-state 368
-
-    const_field  ->  ID_FIELD ':' . typed_const   (rule 67)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 319
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 320
-
-    const	go to state 321
-    unsigned_number	go to state 214
-    sign	go to state 215
-    typed_const	go to state 383
-    array_const	go to state 323
-    record_const	go to state 324
-    set_const	go to state 325
-
-
-
-state 369
-
-    array_const  ->  '(' typed_const_list ')' .   (rule 61)
-
-    $default	reduce using rule 61 (array_const)
-
-
-
-state 370
-
-    typed_const_list  ->  typed_const_list ',' . typed_const   (rule 63)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '(' 	shift, and go to state 319
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-    '[' 	shift, and go to state 320
-
-    const	go to state 321
-    unsigned_number	go to state 214
-    sign	go to state 215
-    typed_const	go to state 384
-    array_const	go to state 323
-    record_const	go to state 324
-    set_const	go to state 325
-
-
-
-state 371
-
-    record_const  ->  '(' const_field_list ')' .   (rule 64)
-
-    $default	reduce using rule 64 (record_const)
-
-
-
-state 372
-
-    const_field_list  ->  const_field_list ',' . const_field   (rule 66)
-
-    ID_FIELD	shift, and go to state 347
-
-    const_field	go to state 385
-
-
-
-state 373
-
-    const_elem  ->  const OP_DOTDOT . const   (rule 74)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 386
-    unsigned_number	go to state 214
-    sign	go to state 215
-
-
-
-state 374
-
-    set_const  ->  '[' const_elem_list ']' .   (rule 68)
-
-    $default	reduce using rule 68 (set_const)
-
-
-
-state 375
-
-    const_elem_list1  ->  const_elem_list1 ',' . const_elem   (rule 72)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 352
-    unsigned_number	go to state 214
-    sign	go to state 215
-    const_elem	go to state 387
-
-
-
-state 376
-
-    absolute_clause  ->  K_ABSOLUTE CONST_INT ':' CONST_INT .   (rule 117)
-
-    $default	reduce using rule 117 (absolute_clause)
-
-
-
-state 377
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr K_DOWNTO expr K_DO stmt .   (rule 179)
-
-    $default	reduce using rule 179 (for_stmt)
-
-
-
-state 378
-
-    for_stmt  ->  K_FOR ID_VAR OP_DEFEQ expr K_TO expr K_DO stmt .   (rule 178)
-
-    $default	reduce using rule 178 (for_stmt)
-
-
-
-state 379
-
-    array_type  ->  K_ARRAY '[' simple_type_list ']' K_OF type .   (rule 90)
-
-    $default	reduce using rule 90 (array_type)
-
-
-
-state 380
-
-    variant_list  ->  variant_list ';' . variant   (rule 105)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    $default	reduce using rule 106 (variant)
-
-    const	go to state 364
-    unsigned_number	go to state 214
-    sign	go to state 215
-    variant	go to state 388
-    case_tag_list	go to state 367
-
-
-
-state 381
-
-    case_tag_list  ->  case_tag_list ',' . const   (rule 109)
-
-    ID_CONST	shift, and go to state 209
-    CONST_INT	shift, and go to state 210
-    CONST_REAL	shift, and go to state 211
-    CONST_STRING	shift, and go to state 212
-    '+' 	shift, and go to state 123
-    '-' 	shift, and go to state 124
-
-    const	go to state 389
-    unsigned_number	go to state 214
-    sign	go to state 215
-
-
-
-state 382
-
-    variant  ->  case_tag_list ':' . '(' field_list ')'   (rule 107)
-
-    '(' 	shift, and go to state 390
-
-
-
-state 383
-
-    const_field  ->  ID_FIELD ':' typed_const .   (rule 67)
-
-    $default	reduce using rule 67 (const_field)
-
-
-
-state 384
-
-    typed_const_list  ->  typed_const_list ',' typed_const .   (rule 63)
-
-    $default	reduce using rule 63 (typed_const_list)
-
-
-
-state 385
-
-    const_field_list  ->  const_field_list ',' const_field .   (rule 66)
-
-    $default	reduce using rule 66 (const_field_list)
-
-
-
-state 386
-
-    const_elem  ->  const OP_DOTDOT const .   (rule 74)
-
-    $default	reduce using rule 74 (const_elem)
-
-
-
-state 387
-
-    const_elem_list1  ->  const_elem_list1 ',' const_elem .   (rule 72)
-
-    $default	reduce using rule 72 (const_elem_list1)
-
-
-
-state 388
-
-    variant_list  ->  variant_list ';' variant .   (rule 105)
-
-    $default	reduce using rule 105 (variant_list)
-
-
-
-state 389
-
-    case_tag_list  ->  case_tag_list ',' const .   (rule 109)
-
-    $default	reduce using rule 109 (case_tag_list)
-
-
-
-state 390
-
-    variant  ->  case_tag_list ':' '(' . field_list ')'   (rule 107)
-
-    K_CASE	shift, and go to state 275
-    ID_NAME	shift, and go to state 16
-
-    $default	reduce using rule 99 (record_section)
-
-    id_name_list	go to state 276
-    field_list	go to state 391
-    fixed_part	go to state 278
-    record_section	go to state 279
-    variant_part	go to state 280
-
-
-
-state 391
-
-    variant  ->  case_tag_list ':' '(' field_list . ')'   (rule 107)
-
-    ')' 	shift, and go to state 392
-
-
-
-state 392
-
-    variant  ->  case_tag_list ':' '(' field_list ')' .   (rule 107)
-
-    $default	reduce using rule 107 (variant)
-
-
-
-state 393
-
-    $   	go to state 394
-
-
-
-state 394
-
-    $   	go to state 395
-
-
-
-state 395
-
-    $default	accept
-
-
--- a/tp4.tab.c	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1845 +0,0 @@
-/* A Bison parser, made from tp4.y
-   by GNU bison 1.35.  */
-
-#define YYBISON 1  /* Identify Bison output.  */
-
-# define	K_AND	257
-# define	K_ABSOLUTE	258
-# define	K_ARRAY	259
-# define	K_BEGIN	260
-# define	K_CASE	261
-# define	K_CONST	262
-# define	K_DIV	263
-# define	K_DOWNTO	264
-# define	K_DO	265
-# define	K_ELSE	266
-# define	K_END	267
-# define	K_EXTERNAL	268
-# define	K_FILE	269
-# define	K_FORWARD	270
-# define	K_FOR	271
-# define	K_FUNCTION	272
-# define	K_GOTO	273
-# define	K_IF	274
-# define	K_IMPLEMENTATION	275
-# define	K_INTERFACE	276
-# define	K_IN	277
-# define	K_LABEL	278
-# define	K_MOD	279
-# define	K_NIL	280
-# define	K_NOT	281
-# define	K_OF	282
-# define	K_OR	283
-# define	K_PACKED	284
-# define	K_PROCEDURE	285
-# define	K_PROGRAM	286
-# define	K_RECORD	287
-# define	K_REPEAT	288
-# define	K_SET	289
-# define	K_SHL	290
-# define	K_SHR	291
-# define	K_STRING	292
-# define	K_THEN	293
-# define	K_TO	294
-# define	K_TYPE	295
-# define	K_UNIT	296
-# define	K_UNTIL	297
-# define	K_USES	298
-# define	K_VAR	299
-# define	K_WHILE	300
-# define	K_WITH	301
-# define	K_XOR	302
-# define	OP_DOTDOT	303
-# define	OP_DEFEQ	304
-# define	OP_LEQ	305
-# define	OP_NEQ	306
-# define	OP_GEQ	307
-# define	ID_FUNC	308
-# define	ID_PROC	309
-# define	ID_VAR	310
-# define	ID_TYPE	311
-# define	ID_LABEL	312
-# define	ID_UNIT	313
-# define	ID_CONST	314
-# define	ID_FIELD	315
-# define	ID_NAME	316
-# define	CONST_INT	317
-# define	CONST_REAL	318
-# define	CONST_STRING	319
-
-#line 1 "tp4.y"
-
-#include <stdio.h>
-#include <glib.h>
-#include "tokenize.h"
-#include "dict.h"
-#define YYERROR_VERBOSE
-#define YYDEBUG 1
-#define YYLEX_PARAM parser
-#define YYPARSE_PARAM parser
-
-#line 15 "tp4.y"
-#ifndef YYSTYPE
-typedef union {
-	int		const_int;	/* Dla stalych calkowitych. */
-	float		const_real;	/* Dla stalych zmiennoprzecinkowych. */
-	char	      * string;		/* Dla stringow i ID_NAME */
-	DictEntry     * symbol;		/* Dla symboli. */
-	GList	      * list;		/* Dla list. */
-} yystype;
-# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-#line 23 "tp4.y"
-
-/* To musi byc wlaczone po zdefiniowaniu typu %union. */
-#include "parser.h"
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-
-
-#define	YYFINAL		395
-#define	YYFLAG		-32768
-#define	YYNTBASE	83
-
-/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
-#define YYTRANSLATE(x) ((unsigned)(x) <= 319 ? yytranslate[x] : 185)
-
-/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
-static const char yytranslate[] =
-{
-       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-      68,    69,    80,    73,    70,    74,    66,    81,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,    72,    67,
-      78,    71,    79,     2,    82,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,    75,     2,    76,    77,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     3,     4,     5,
-       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
-      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
-      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
-      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
-      56,    57,    58,    59,    60,    61,    62,    63,    64,    65
-};
-
-#if YYDEBUG
-static const short yyprhs[] =
-{
-       0,     0,     2,     4,     9,    10,    14,    21,    22,    26,
-      28,    32,    35,    41,    45,    49,    53,    55,    57,    58,
-      61,    63,    65,    67,    69,    71,    73,    77,    79,    83,
-      85,    87,    89,    91,    94,    97,   100,   103,   106,   109,
-     110,   113,   115,   117,   119,   121,   123,   128,   135,   137,
-     140,   142,   145,   147,   149,   151,   153,   155,   157,   159,
-     161,   163,   167,   169,   173,   177,   179,   183,   187,   191,
-     192,   194,   196,   200,   202,   206,   211,   213,   215,   217,
-     219,   221,   225,   229,   232,   234,   237,   239,   241,   243,
-     245,   252,   254,   258,   262,   264,   266,   270,   272,   276,
-     277,   281,   286,   288,   292,   294,   298,   299,   305,   307,
-     311,   315,   319,   321,   323,   328,   334,   335,   340,   343,
-     347,   351,   354,   357,   360,   363,   367,   373,   375,   377,
-     379,   380,   384,   386,   390,   394,   399,   402,   404,   406,
-     408,   412,   413,   415,   417,   419,   421,   423,   425,   427,
-     429,   431,   433,   437,   440,   441,   445,   447,   451,   454,
-     458,   460,   464,   469,   476,   483,   485,   489,   490,   494,
-     496,   500,   502,   506,   507,   510,   514,   519,   524,   533,
-     542,   547,   549,   553,   556,   558,   563,   566,   569,   574,
-     576,   580,   582,   584,   586,   588,   590,   592,   594,   596,
-     599,   603,   605,   607,   609,   611,   613,   617,   619,   621,
-     623,   625,   627,   629,   631,   633,   635,   637,   639,   641,
-     645,   647,   650,   654,   659,   662,   663,   665,   667,   671,
-     673
-};
-static const short yyrhs[] =
-{
-      84,     0,    89,     0,    85,    86,    88,    66,     0,     0,
-      32,    62,    67,     0,    32,    62,    68,    87,    69,    67,
-       0,     0,    44,    87,    67,     0,    62,     0,    87,    70,
-      62,     0,    94,   159,     0,    90,    91,    92,    93,    66,
-       0,    42,    62,    67,     0,    22,    86,   103,     0,    21,
-      86,    94,     0,   159,     0,    13,     0,     0,    94,    95,
-       0,    96,     0,   100,     0,   101,     0,   102,     0,   141,
-       0,   142,     0,    24,    97,    67,     0,    99,     0,    97,
-      70,    99,     0,    63,     0,    58,     0,    63,     0,    62,
-       0,     8,   105,     0,   100,   105,     0,    41,   119,     0,
-     101,   119,     0,    45,   139,     0,   102,   139,     0,     0,
-     103,   104,     0,   100,     0,   101,     0,   102,     0,   145,
-       0,   146,     0,    62,    71,   106,    67,     0,    62,    72,
-     120,    71,   109,    67,     0,   107,     0,   108,   107,     0,
-      60,     0,   108,    60,     0,    65,     0,    63,     0,    64,
-       0,    73,     0,    74,     0,   106,     0,   110,     0,   112,
-       0,   115,     0,    68,   111,    69,     0,   109,     0,   111,
-      70,   109,     0,    68,   113,    69,     0,   114,     0,   113,
-      70,   114,     0,    61,    72,   109,     0,    75,   116,    76,
-       0,     0,   117,     0,   118,     0,   117,    70,   118,     0,
-     106,     0,   106,    49,   106,     0,    62,    71,   120,    67,
-       0,   121,     0,   122,     0,   123,     0,   138,     0,    57,
-       0,   106,    49,   106,     0,    68,    87,    69,     0,    77,
-      57,     0,   124,     0,    30,   124,     0,   125,     0,   127,
-       0,   136,     0,   137,     0,     5,    75,   126,    76,    28,
-     120,     0,   121,     0,   126,    70,   121,     0,    33,   128,
-      13,     0,   129,     0,   131,     0,   129,    67,   131,     0,
-     130,     0,   129,    67,   130,     0,     0,    87,    72,   120,
-       0,     7,   132,    28,   133,     0,    62,     0,    62,    72,
-      57,     0,   134,     0,   133,    67,   134,     0,     0,   135,
-      72,    68,   128,    69,     0,   106,     0,   135,    70,   106,
-       0,    35,    28,   121,     0,    15,    28,   120,     0,    15,
-       0,    38,     0,    38,    75,   106,    76,     0,    87,    72,
-     120,   140,    67,     0,     0,     4,    63,    72,    63,     0,
-       4,    56,     0,   145,   147,    67,     0,   146,   147,    67,
-       0,    31,    62,     0,    31,    55,     0,    18,    62,     0,
-      18,    54,     0,   143,   148,    67,     0,   144,   148,    72,
-     151,    67,     0,    88,     0,    14,     0,    16,     0,     0,
-      68,   149,    69,     0,   150,     0,   149,    67,   150,     0,
-      87,    72,   151,     0,    45,    87,    72,   151,     0,    45,
-      87,     0,    57,     0,    38,     0,   153,     0,    98,    72,
-     153,     0,     0,   154,     0,   155,     0,   158,     0,   159,
-       0,   161,     0,   162,     0,   168,     0,   169,     0,   170,
-       0,   171,     0,   174,    50,   175,     0,    55,   156,     0,
-       0,    68,   157,    69,     0,   175,     0,   157,    70,   175,
-       0,    19,    98,     0,     6,   160,    13,     0,   152,     0,
-     160,    67,   152,     0,    20,   175,    39,   152,     0,    20,
-     175,    39,   152,    12,   152,     0,     7,   175,    28,   163,
-     167,    13,     0,   164,     0,   163,    67,   164,     0,     0,
-     165,    72,   152,     0,   166,     0,   165,    70,   166,     0,
-     106,     0,   106,    49,   106,     0,     0,    12,   152,     0,
-      12,   152,    67,     0,    34,   160,    43,   175,     0,    46,
-     175,    11,   152,     0,    17,    56,    50,   175,    40,   175,
-      11,   152,     0,    17,    56,    50,   175,    10,   175,    11,
-     152,     0,    47,   172,    11,   152,     0,   174,     0,   172,
-      70,   174,     0,   174,    66,     0,    56,     0,   174,    75,
-     157,    76,     0,   173,    61,     0,   174,    77,     0,    57,
-      68,   174,    69,     0,   177,     0,   177,   176,   177,     0,
-      71,     0,    52,     0,    78,     0,    79,     0,    51,     0,
-      53,     0,    23,     0,   179,     0,   108,   179,     0,   177,
-     178,   179,     0,    73,     0,    74,     0,    29,     0,    48,
-       0,   181,     0,   179,   180,   181,     0,    80,     0,    81,
-       0,     9,     0,    25,     0,    36,     0,    37,     0,     3,
-       0,   174,     0,    60,     0,    63,     0,    64,     0,    65,
-       0,    75,   182,    76,     0,    26,     0,    82,   174,     0,
-      68,   175,    69,     0,    54,    68,   157,    69,     0,    27,
-     181,     0,     0,   183,     0,   184,     0,   183,    70,   184,
-       0,   175,     0,   175,    49,   175,     0
-};
-
-#endif
-
-#if YYDEBUG
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const short yyrline[] =
-{
-       0,    83,    87,    94,    98,    99,   100,   108,   109,   119,
-     126,   136,   142,   148,   154,   160,   166,   169,   177,   178,
-     182,   183,   184,   185,   186,   187,   191,   195,   196,   199,
-     202,   207,   215,   222,   223,   227,   228,   232,   233,   243,
-     244,   248,   249,   250,   251,   255,   264,   268,   274,   276,
-     278,   280,   282,   287,   292,   295,   295,   299,   300,   301,
-     302,   306,   310,   311,   315,   319,   320,   324,   329,   333,
-     334,   338,   339,   343,   344,   350,   356,   357,   358,   359,
-     363,   365,   367,   374,   378,   379,   383,   384,   385,   386,
-     390,   394,   395,   399,   403,   404,   405,   409,   410,   414,
-     415,   422,   426,   428,   433,   434,   437,   438,   442,   443,
-     447,   451,   452,   456,   457,   463,   473,   474,   475,   481,
-     490,   501,   506,   513,   518,   525,   529,   533,   534,   535,
-     538,   539,   543,   544,   547,   552,   557,   564,   566,   571,
-     572,   576,   577,   578,   579,   580,   581,   582,   583,   584,
-     585,   586,   590,   594,   599,   600,   604,   605,   609,   613,
-     617,   618,   621,   622,   626,   630,   631,   634,   635,   639,
-     640,   644,   645,   649,   650,   651,   655,   659,   663,   664,
-     668,   672,   673,   679,   683,   685,   686,   687,   688,   694,
-     695,   698,   698,   698,   698,   698,   698,   698,   702,   703,
-     704,   707,   707,   707,   707,   710,   711,   714,   714,   714,
-     714,   714,   714,   714,   720,   721,   723,   725,   727,   729,
-     730,   731,   732,   733,   735,   739,   740,   744,   745,   748,
-     749
-};
-#endif
-
-
-#if (YYDEBUG) || defined YYERROR_VERBOSE
-
-/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
-static const char *const yytname[] =
-{
-  "$", "error", "$undefined.", "K_AND", "K_ABSOLUTE", "K_ARRAY", "K_BEGIN", 
-  "K_CASE", "K_CONST", "K_DIV", "K_DOWNTO", "K_DO", "K_ELSE", "K_END", 
-  "K_EXTERNAL", "K_FILE", "K_FORWARD", "K_FOR", "K_FUNCTION", "K_GOTO", 
-  "K_IF", "K_IMPLEMENTATION", "K_INTERFACE", "K_IN", "K_LABEL", "K_MOD", 
-  "K_NIL", "K_NOT", "K_OF", "K_OR", "K_PACKED", "K_PROCEDURE", 
-  "K_PROGRAM", "K_RECORD", "K_REPEAT", "K_SET", "K_SHL", "K_SHR", 
-  "K_STRING", "K_THEN", "K_TO", "K_TYPE", "K_UNIT", "K_UNTIL", "K_USES", 
-  "K_VAR", "K_WHILE", "K_WITH", "K_XOR", "OP_DOTDOT", "OP_DEFEQ", 
-  "OP_LEQ", "OP_NEQ", "OP_GEQ", "ID_FUNC", "ID_PROC", "ID_VAR", "ID_TYPE", 
-  "ID_LABEL", "ID_UNIT", "ID_CONST", "ID_FIELD", "ID_NAME", "CONST_INT", 
-  "CONST_REAL", "CONST_STRING", "'.'", "';'", "'('", "')'", "','", "'='", 
-  "':'", "'+'", "'-'", "'['", "']'", "'^'", "'<'", "'>'", "'*'", "'/'", 
-  "'@'", "compilation_unit", "program", "program_heading", "uses_clause", 
-  "id_name_list", "block", "unit", "unit_heading", "interface_part", 
-  "implementation_part", "initialization_part", "decl_sect_list", 
-  "decl_sect", "label_decl_sect", "label_list", "label", "label_decl", 
-  "const_decl_sect", "type_decl_sect", "var_decl_sect", 
-  "int_decl_sect_list", "int_decl_sect", "const_decl", "const", 
-  "unsigned_number", "sign", "typed_const", "array_const", 
-  "typed_const_list", "record_const", "const_field_list", "const_field", 
-  "set_const", "const_elem_list", "const_elem_list1", "const_elem", 
-  "type_decl", "type", "simple_type", "pointer_type", "structured_type", 
-  "unpacked_structured_type", "array_type", "simple_type_list", 
-  "record_type", "field_list", "fixed_part", "record_section", 
-  "variant_part", "tag_field", "variant_list", "variant", "case_tag_list", 
-  "set_type", "file_type", "string_type", "var_decl", "absolute_clause", 
-  "proc_decl", "func_decl", "proc_heading_beginning", 
-  "func_heading_beginning", "proc_heading", "func_heading", "proc_block", 
-  "fp_list", "fp_sect_list", "fp_sect", "fptype", "stmt", 
-  "unlabelled_stmt", "assignment", "proc_call", "param_list", "expr_list", 
-  "goto_stmt", "compound_stmt", "stmt_list", "if_stmt", "case_stmt", 
-  "case_list", "case", "case_label_list", "case_label", "else_case", 
-  "repeat_stmt", "while_stmt", "for_stmt", "with_stmt", "variable_list", 
-  "record_variable", "variable", "expr", "relop", "simple_expr", "addop", 
-  "term", "mulop", "factor", "elem_list", "elem_list1", "elem", 0
-};
-#endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const short yyr1[] =
-{
-       0,    83,    83,    84,    85,    85,    85,    86,    86,    87,
-      87,    88,    89,    90,    91,    92,    93,    93,    94,    94,
-      95,    95,    95,    95,    95,    95,    96,    97,    97,    98,
-      98,    99,    99,   100,   100,   101,   101,   102,   102,   103,
-     103,   104,   104,   104,   104,   104,   105,   105,   106,   106,
-     106,   106,   106,   107,   107,   108,   108,   109,   109,   109,
-     109,   110,   111,   111,   112,   113,   113,   114,   115,   116,
-     116,   117,   117,   118,   118,   119,   120,   120,   120,   120,
-     121,   121,   121,   122,   123,   123,   124,   124,   124,   124,
-     125,   126,   126,   127,   128,   128,   128,   129,   129,   130,
-     130,   131,   132,   132,   133,   133,   134,   134,   135,   135,
-     136,   137,   137,   138,   138,   139,   140,   140,   140,   141,
-     142,   143,   143,   144,   144,   145,   146,   147,   147,   147,
-     148,   148,   149,   149,   150,   150,   150,   151,   151,   152,
-     152,   153,   153,   153,   153,   153,   153,   153,   153,   153,
-     153,   153,   154,   155,   156,   156,   157,   157,   158,   159,
-     160,   160,   161,   161,   162,   163,   163,   164,   164,   165,
-     165,   166,   166,   167,   167,   167,   168,   169,   170,   170,
-     171,   172,   172,   173,   174,   174,   174,   174,   174,   175,
-     175,   176,   176,   176,   176,   176,   176,   176,   177,   177,
-     177,   178,   178,   178,   178,   179,   179,   180,   180,   180,
-     180,   180,   180,   180,   181,   181,   181,   181,   181,   181,
-     181,   181,   181,   181,   181,   182,   182,   183,   183,   184,
-     184
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const short yyr2[] =
-{
-       0,     1,     1,     4,     0,     3,     6,     0,     3,     1,
-       3,     2,     5,     3,     3,     3,     1,     1,     0,     2,
-       1,     1,     1,     1,     1,     1,     3,     1,     3,     1,
-       1,     1,     1,     2,     2,     2,     2,     2,     2,     0,
-       2,     1,     1,     1,     1,     1,     4,     6,     1,     2,
-       1,     2,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     3,     1,     3,     3,     1,     3,     3,     3,     0,
-       1,     1,     3,     1,     3,     4,     1,     1,     1,     1,
-       1,     3,     3,     2,     1,     2,     1,     1,     1,     1,
-       6,     1,     3,     3,     1,     1,     3,     1,     3,     0,
-       3,     4,     1,     3,     1,     3,     0,     5,     1,     3,
-       3,     3,     1,     1,     4,     5,     0,     4,     2,     3,
-       3,     2,     2,     2,     2,     3,     5,     1,     1,     1,
-       0,     3,     1,     3,     3,     4,     2,     1,     1,     1,
-       3,     0,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     3,     2,     0,     3,     1,     3,     2,     3,
-       1,     3,     4,     6,     6,     1,     3,     0,     3,     1,
-       3,     1,     3,     0,     2,     3,     4,     4,     8,     8,
-       4,     1,     3,     2,     1,     4,     2,     2,     4,     1,
-       3,     1,     1,     1,     1,     1,     1,     1,     1,     2,
-       3,     1,     1,     1,     1,     1,     3,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     3,
-       1,     2,     3,     4,     2,     0,     1,     1,     3,     1,
-       3
-};
-
-/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
-   doesn't specify something else to do.  Zero means the default is an
-   error. */
-static const short yydefact[] =
-{
-       4,     0,     0,     1,     7,     2,     0,     0,     0,     0,
-      18,     7,     0,     5,     0,    13,     9,     0,     0,     0,
-      39,     7,     0,     0,     8,     0,     3,   141,     0,     0,
-       0,     0,     0,     0,    19,    20,    21,    22,    23,    24,
-      25,   130,   130,    18,    18,    11,    14,    18,    17,     0,
-      16,     0,    10,     0,     0,     0,     0,   141,     0,     0,
-     154,   184,     0,    30,    29,     0,   160,   139,   142,   143,
-     144,   145,     0,   146,   147,   148,   149,   150,   151,     0,
-       0,     0,    33,   124,   123,    32,    31,     0,    27,   122,
-     121,     0,    35,     0,    37,    34,    36,    38,     0,     0,
-       0,   128,   129,   127,     0,     0,    41,    42,    43,    40,
-      44,    45,    15,    12,     6,   220,     0,     0,   215,   216,
-     217,   218,     0,    55,    56,   225,     0,     0,   214,     0,
-     189,   198,   205,     0,   158,     0,     0,     0,     0,   181,
-       0,   153,     0,   141,   159,   141,   186,     0,   183,     0,
-     187,     0,     0,    26,     0,     0,     0,     0,     0,     0,
-     132,   125,     0,   119,   120,   224,     0,     0,   229,     0,
-     226,   227,   221,   199,   167,   197,   203,   204,   195,   192,
-     196,   191,   201,   202,   193,   194,     0,     0,   213,   209,
-     210,   211,   212,   207,   208,     0,     0,   141,     0,   141,
-     141,     0,     0,   156,     0,   140,   161,   152,     0,    50,
-      53,    54,    52,     0,    48,     0,     0,   112,     0,    99,
-       0,   113,    80,     0,     0,     0,     0,    76,    77,    78,
-      84,    86,    87,    88,    89,    79,    28,     0,   116,   136,
-       0,     0,   131,   138,   137,     0,     0,   222,     0,   219,
-       0,   171,   173,   165,     0,   169,   190,   200,   206,     0,
-     162,   176,   177,   180,   182,   155,     0,   188,   185,    46,
-      51,    49,     0,     0,    85,     0,     0,     0,    94,    97,
-      95,     0,     0,     0,    83,     0,     0,    75,     0,     0,
-       0,   134,   133,   126,   223,   230,   228,     0,   141,   167,
-       0,     0,   141,     0,     0,   141,   157,    91,     0,   111,
-     102,     0,     0,    93,    99,   110,     0,    82,    81,     0,
-      69,    57,     0,    58,    59,    60,   118,     0,   115,   135,
-     172,   174,   166,   164,   170,   168,     0,     0,   163,     0,
-       0,     0,   106,   100,    98,    96,   114,     0,    62,     0,
-       0,    65,    73,     0,    70,    71,    47,     0,   175,   141,
-     141,    92,     0,   103,   108,   101,   104,     0,     0,    61,
-       0,    64,     0,     0,    68,     0,   117,   179,   178,    90,
-     106,     0,     0,    67,    63,    66,    74,    72,   105,   109,
-      99,     0,   107,     0,     0,     0
-};
-
-static const short yydefgoto[] =
-{
-     393,     3,     4,    10,    93,   103,     5,     6,    12,    22,
-      49,    19,    34,    35,    87,    65,    88,    36,    37,    38,
-      46,   109,    95,   225,   214,   215,   322,   323,   349,   324,
-     350,   351,   325,   353,   354,   355,    96,   226,   227,   228,
-     229,   230,   231,   308,   232,   277,   278,   279,   280,   311,
-     365,   366,   367,   233,   234,   235,    97,   289,    39,    40,
-      41,    42,    43,    44,   104,    99,   159,   160,   245,    66,
-      67,    68,    69,   141,   202,    70,    71,    72,    73,    74,
-     252,   253,   254,   255,   300,    75,    76,    77,    78,   138,
-      79,   128,   203,   186,   130,   187,   131,   195,   132,   169,
-     170,   171
-};
-
-static const short yypact[] =
-{
-      39,   -36,    -2,-32768,    34,-32768,    64,   151,    26,    83,
-  -32768,    34,   132,-32768,    83,-32768,-32768,   -29,    92,    21,
-  -32768,    34,   118,   176,-32768,   101,-32768,   231,   121,    73,
-     193,    89,   127,    83,-32768,-32768,   121,   127,    83,-32768,
-  -32768,   125,   125,   156,   156,-32768,    80,-32768,-32768,   146,
-  -32768,   133,-32768,   243,   180,    52,   243,   231,   243,   207,
-     154,-32768,   160,-32768,-32768,   171,-32768,-32768,-32768,-32768,
-  -32768,-32768,    -4,-32768,-32768,-32768,-32768,-32768,-32768,   192,
-     -16,   195,-32768,-32768,-32768,-32768,-32768,   114,-32768,-32768,
-  -32768,   197,-32768,   131,-32768,-32768,-32768,-32768,   -22,   208,
-     199,-32768,-32768,-32768,   225,   226,   121,   127,    83,-32768,
-  -32768,-32768,    24,-32768,-32768,-32768,   275,   227,-32768,-32768,
-  -32768,-32768,   243,-32768,-32768,   243,   207,   275,    31,   268,
-     301,    10,-32768,   248,-32768,   265,   -18,   298,    -3,    31,
-     243,-32768,   207,   339,-32768,   231,-32768,   243,-32768,   243,
-  -32768,    49,    69,-32768,   193,    69,    69,    83,   135,   142,
-  -32768,-32768,   -14,-32768,-32768,-32768,   243,   241,   263,   237,
-     244,-32768,    31,    10,    49,-32768,-32768,-32768,-32768,-32768,
-  -32768,-32768,-32768,-32768,-32768,-32768,   243,   275,-32768,-32768,
-  -32768,-32768,-32768,-32768,-32768,   275,   243,   231,   243,   231,
-     231,   207,   204,-32768,    91,-32768,-32768,-32768,    60,-32768,
-  -32768,-32768,-32768,   252,-32768,   128,   240,   292,   134,    15,
-     293,   247,-32768,    83,   266,   277,   256,-32768,-32768,-32768,
-  -32768,-32768,-32768,-32768,-32768,-32768,-32768,   261,   332,   143,
-     -14,   -22,-32768,-32768,-32768,   270,   211,-32768,   243,-32768,
-     243,   295,     5,-32768,   153,-32768,    22,    10,-32768,    18,
-     329,-32768,-32768,-32768,    31,-32768,   243,-32768,-32768,-32768,
-  -32768,-32768,   122,    69,-32768,   280,   163,   334,   281,-32768,
-  -32768,   122,    49,   213,-32768,    49,   166,-32768,   -19,   284,
-     -14,-32768,-32768,-32768,-32768,-32768,-32768,    49,   231,    49,
-     342,    49,   231,   243,   243,   231,-32768,-32768,    71,-32768,
-     288,   333,    69,-32768,    15,-32768,   286,-32768,-32768,   303,
-      49,-32768,   302,-32768,-32768,-32768,-32768,   310,-32768,-32768,
-  -32768,   316,-32768,-32768,-32768,-32768,   354,   359,-32768,   122,
-     356,   330,    49,-32768,-32768,-32768,-32768,   317,-32768,   215,
-     221,-32768,   341,   312,   321,-32768,-32768,   335,-32768,   231,
-     231,-32768,    69,-32768,-32768,   325,-32768,   172,   166,-32768,
-     166,-32768,   336,    49,-32768,    49,-32768,-32768,-32768,-32768,
-      49,    49,   331,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-      15,   324,-32768,   400,   401,-32768
-};
-
-static const short yypgoto[] =
-{
-  -32768,-32768,-32768,   107,    -9,   392,-32768,-32768,-32768,-32768,
-  -32768,   357,-32768,-32768,-32768,   348,   251,   360,   361,   362,
-  -32768,-32768,   381,  -121,   196,   -46,  -283,-32768,-32768,-32768,
-  -32768,    38,-32768,-32768,-32768,    37,   382,  -135,  -266,-32768,
-  -32768,   198,-32768,-32768,-32768,    23,-32768,   103,   104,-32768,
-  -32768,    35,-32768,-32768,-32768,-32768,   386,-32768,-32768,-32768,
-  -32768,-32768,   374,   375,   378,   383,-32768,   182,  -222,  -143,
-     283,-32768,-32768,-32768,   -74,-32768,   175,   367,-32768,-32768,
-  -32768,   129,-32768,   126,-32768,-32768,-32768,-32768,-32768,-32768,
-  -32768,   -26,   -42,-32768,   245,-32768,  -123,-32768,  -113,-32768,
-  -32768,   179
-};
-
-
-#define	YYLAST		431
-
-
-static const short yytable[] =
-{
-      17,    80,   206,   165,   173,    23,   307,   127,   200,   144,
-     127,   129,   127,   188,   135,   315,   137,   298,   291,   189,
-     237,   238,   275,   157,   243,   198,     7,    27,   303,    28,
-     213,    80,    28,   139,   147,   190,   348,   326,    24,    29,
-      16,    25,    29,   244,   327,    30,   191,   192,    30,   145,
-     148,   176,    31,   251,   260,    31,   262,   263,   304,   149,
-       8,   150,    32,   145,   257,    32,    33,   201,   329,    33,
-     177,     1,   299,   361,   216,   208,   127,    16,     9,   127,
-     167,     2,   258,   168,   217,   383,    11,   384,    28,   158,
-     193,   194,   246,    15,   127,   182,   183,   148,    29,   218,
-     172,   127,   219,   127,   220,   207,   149,   221,   150,   209,
-      63,    31,   210,   211,   212,    64,   204,    80,    20,    80,
-     127,    32,   123,   124,    27,    33,   222,    83,    47,   209,
-     266,    48,   210,   211,   212,    84,   268,   223,   309,   216,
-     127,   339,   123,   124,    89,    16,   224,   340,   239,   217,
-     127,    90,   127,    21,   259,   331,   261,   148,    26,   335,
-     267,   316,   338,    52,   318,   321,   149,   219,   150,   220,
-     101,    80,   102,    80,    80,   264,   330,   343,   251,   222,
-     251,   153,   209,    81,   154,   210,   211,   212,   270,    91,
-     223,   210,   211,    98,    45,   123,   124,    50,   321,   352,
-     114,    25,   127,   156,   127,    25,   295,   240,   168,   241,
-     276,   242,   113,    25,   283,   290,   377,   378,    13,    14,
-     127,   364,   140,   301,   306,   302,   209,   379,   142,   210,
-     211,   212,   158,    25,   319,   312,   133,    27,    53,   123,
-     124,   320,   381,   143,   382,    51,    25,   321,    54,   321,
-      55,    56,   386,   146,   352,    85,    86,   127,   127,   364,
-     389,   336,   337,    61,    62,    57,   151,   152,   155,   115,
-     116,   162,    80,   265,   266,   161,    80,    58,    59,    80,
-     294,   266,   317,    25,   369,   370,    60,    61,    62,    63,
-     371,   372,   163,   164,    64,   166,   174,   117,   196,    61,
-      62,   115,   116,   118,   197,   276,   119,   120,   121,   199,
-     247,   122,   248,   249,   250,   272,   123,   124,   125,   269,
-     273,   281,   282,   284,   175,   126,   285,   286,   287,   117,
-     176,    61,    62,    80,    80,   118,   288,   293,   119,   120,
-     121,   305,   310,   122,   297,    27,    53,   313,   314,   177,
-     125,   328,   178,   179,   180,   333,    54,   126,    55,    56,
-     341,   342,   346,   209,   347,   359,   210,   211,   212,   356,
-     360,   319,   181,    57,   182,   183,   123,   124,   320,   184,
-     185,   276,   357,   358,   362,    58,    59,   363,   374,   368,
-     373,   375,   380,   392,    60,    61,    62,   347,   376,   390,
-     394,   395,    18,   134,   112,   236,   106,   107,   108,    82,
-     385,   271,   387,   391,    92,   388,   274,   344,   345,    94,
-     110,   111,   105,   292,   136,   100,   205,   334,   332,   296,
-       0,   256
-};
-
-static const short yycheck[] =
-{
-       9,    27,   145,   116,   127,    14,   272,    53,    11,    13,
-      56,    53,    58,     3,    56,   281,    58,    12,   240,     9,
-     155,   156,     7,    45,    38,    43,    62,     6,    10,     8,
-     151,    57,     8,    59,    50,    25,   319,    56,    67,    18,
-      62,    70,    18,    57,    63,    24,    36,    37,    24,    67,
-      66,    29,    31,   174,   197,    31,   199,   200,    40,    75,
-      62,    77,    41,    67,   187,    41,    45,    70,   290,    45,
-      48,    32,    67,   339,     5,   149,   122,    62,    44,   125,
-     122,    42,   195,   125,    15,   368,    22,   370,     8,    98,
-      80,    81,   166,    67,   140,    73,    74,    66,    18,    30,
-     126,   147,    33,   149,    35,   147,    75,    38,    77,    60,
-      58,    31,    63,    64,    65,    63,   142,   143,    11,   145,
-     166,    41,    73,    74,     6,    45,    57,    54,    21,    60,
-      70,    13,    63,    64,    65,    62,    76,    68,   273,     5,
-     186,    70,    73,    74,    55,    62,    77,    76,   157,    15,
-     196,    62,   198,    21,   196,   298,   198,    66,    66,   302,
-      69,   282,   305,    62,   285,   286,    75,    33,    77,    35,
-      14,   197,    16,   199,   200,   201,   297,   312,   299,    57,
-     301,    67,    60,    62,    70,    63,    64,    65,    60,    62,
-      68,    63,    64,    68,    19,    73,    74,    22,   319,   320,
-      67,    70,   248,    72,   250,    70,   248,    72,   250,    67,
-     219,    69,    66,    70,   223,    72,   359,   360,    67,    68,
-     266,   342,    68,    70,   266,    72,    60,   362,    68,    63,
-      64,    65,   241,    70,    68,    72,    56,     6,     7,    73,
-      74,    75,    70,    72,    72,    69,    70,   368,    17,   370,
-      19,    20,   373,    61,   375,    62,    63,   303,   304,   380,
-     381,   303,   304,    56,    57,    34,    71,    72,    71,    26,
-      27,    72,   298,    69,    70,    67,   302,    46,    47,   305,
-      69,    70,    69,    70,    69,    70,    55,    56,    57,    58,
-      69,    70,    67,    67,    63,    68,    28,    54,    50,    56,
-      57,    26,    27,    60,    39,   314,    63,    64,    65,    11,
-      69,    68,    49,    76,    70,    75,    73,    74,    75,    67,
-      28,    28,    75,    57,    23,    82,    49,    71,    67,    54,
-      29,    56,    57,   359,   360,    60,     4,    67,    63,    64,
-      65,    12,    62,    68,    49,     6,     7,    13,    67,    48,
-      75,    67,    51,    52,    53,    13,    17,    82,    19,    20,
-      72,    28,    76,    60,    61,    11,    63,    64,    65,    67,
-      11,    68,    71,    34,    73,    74,    73,    74,    75,    78,
-      79,   390,    72,    67,    28,    46,    47,    57,    76,    72,
-      49,    70,    67,    69,    55,    56,    57,    61,    63,    68,
-       0,     0,    10,    55,    47,   154,    46,    46,    46,    28,
-     372,   215,   375,   390,    32,   380,   218,   314,   314,    33,
-      46,    46,    44,   241,    57,    42,   143,   301,   299,   250,
-      -1,   186
-};
-#define YYPURE 1
-
-/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/share/misc/bison.simple"
-
-/* Skeleton output parser for bison,
-
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, when this file is copied by Bison into a
-   Bison output file, you may use that output file without restriction.
-   This special exception was added by the Free Software Foundation
-   in version 1.24 of Bison.  */
-
-/* This is the parser code that is written into each bison parser when
-   the %semantic_parser declaration is not specified in the grammar.
-   It was written by Richard Stallman by simplifying the hairy parser
-   used when %semantic_parser is specified.  */
-
-/* All symbols defined below should begin with yy or YY, to avoid
-   infringing on user name space.  This should be done even for local
-   variables, as they might otherwise be expanded by user macros.
-   There are some unavoidable exceptions within include files to
-   define necessary library symbols; they are noted "INFRINGES ON
-   USER NAME SPACE" below.  */
-
-#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
-
-/* The parser invokes alloca or malloc; define the necessary symbols.  */
-
-# if YYSTACK_USE_ALLOCA
-#  define YYSTACK_ALLOC alloca
-# else
-#  ifndef YYSTACK_USE_ALLOCA
-#   if defined (alloca) || defined (_ALLOCA_H)
-#    define YYSTACK_ALLOC alloca
-#   else
-#    ifdef __GNUC__
-#     define YYSTACK_ALLOC __builtin_alloca
-#    endif
-#   endif
-#  endif
-# endif
-
-# ifdef YYSTACK_ALLOC
-   /* Pacify GCC's `empty if-body' warning. */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-#  if defined (__STDC__) || defined (__cplusplus)
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   define YYSIZE_T size_t
-#  endif
-#  define YYSTACK_ALLOC malloc
-#  define YYSTACK_FREE free
-# endif
-#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
-
-
-#if (! defined (yyoverflow) \
-     && (! defined (__cplusplus) \
-	 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member.  */
-union yyalloc
-{
-  short yyss;
-  YYSTYPE yyvs;
-# if YYLSP_NEEDED
-  YYLTYPE yyls;
-# endif
-};
-
-/* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
-   N elements.  */
-# if YYLSP_NEEDED
-#  define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))	\
-      + 2 * YYSTACK_GAP_MAX)
-# else
-#  define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
-      + YYSTACK_GAP_MAX)
-# endif
-
-/* Copy COUNT objects from FROM to TO.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if 1 < __GNUC__
-#   define YYCOPY(To, From, Count) \
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-#  else
-#   define YYCOPY(To, From, Count)		\
-      do					\
-	{					\
-	  register YYSIZE_T yyi;		\
-	  for (yyi = 0; yyi < (Count); yyi++)	\
-	    (To)[yyi] = (From)[yyi];		\
-	}					\
-      while (0)
-#  endif
-# endif
-
-/* Relocate STACK from its old location to the new one.  The
-   local variables YYSIZE and YYSTACKSIZE give the old and new number of
-   elements in the stack, and YYPTR gives the new location of the
-   stack.  Advance YYPTR to a properly aligned location for the next
-   stack.  */
-# define YYSTACK_RELOCATE(Stack)					\
-    do									\
-      {									\
-	YYSIZE_T yynewbytes;						\
-	YYCOPY (&yyptr->Stack, Stack, yysize);				\
-	Stack = &yyptr->Stack;						\
-	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;	\
-	yyptr += yynewbytes / sizeof (*yyptr);				\
-      }									\
-    while (0)
-
-#endif
-
-
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
-#define yyerrok		(yyerrstatus = 0)
-#define yyclearin	(yychar = YYEMPTY)
-#define YYEMPTY		-2
-#define YYEOF		0
-#define YYACCEPT	goto yyacceptlab
-#define YYABORT 	goto yyabortlab
-#define YYERROR		goto yyerrlab1
-/* Like YYERROR except do call yyerror.  This remains here temporarily
-   to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  */
-#define YYFAIL		goto yyerrlab
-#define YYRECOVERING()  (!!yyerrstatus)
-#define YYBACKUP(Token, Value)					\
-do								\
-  if (yychar == YYEMPTY && yylen == 1)				\
-    {								\
-      yychar = (Token);						\
-      yylval = (Value);						\
-      yychar1 = YYTRANSLATE (yychar);				\
-      YYPOPSTACK;						\
-      goto yybackup;						\
-    }								\
-  else								\
-    { 								\
-      yyerror ("syntax error: cannot back up");			\
-      YYERROR;							\
-    }								\
-while (0)
-
-#define YYTERROR	1
-#define YYERRCODE	256
-
-
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions
-   are run).
-
-   When YYLLOC_DEFAULT is run, CURRENT is set the location of the
-   first token.  By default, to implement support for ranges, extend
-   its range to the last symbol.  */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)       	\
-   Current.last_line   = Rhs[N].last_line;	\
-   Current.last_column = Rhs[N].last_column;
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments.  */
-
-#if YYPURE
-# if YYLSP_NEEDED
-#  ifdef YYLEX_PARAM
-#   define YYLEX		yylex (&yylval, &yylloc, YYLEX_PARAM)
-#  else
-#   define YYLEX		yylex (&yylval, &yylloc)
-#  endif
-# else /* !YYLSP_NEEDED */
-#  ifdef YYLEX_PARAM
-#   define YYLEX		yylex (&yylval, YYLEX_PARAM)
-#  else
-#   define YYLEX		yylex (&yylval)
-#  endif
-# endif /* !YYLSP_NEEDED */
-#else /* !YYPURE */
-# define YYLEX			yylex ()
-#endif /* !YYPURE */
-
-
-/* Enable debugging if requested.  */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args)			\
-do {						\
-  if (yydebug)					\
-    YYFPRINTF Args;				\
-} while (0)
-/* Nonzero means print parse trace.  It is left uninitialized so that
-   multiple parsers can coexist.  */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-#endif /* !YYDEBUG */
-
-/* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef	YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
-   if the built-in stack extension method is used).
-
-   Do not make this value too large; the results are undefined if
-   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
-   evaluated with infinite-precision integer arithmetic.  */
-
-#if YYMAXDEPTH == 0
-# undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-#ifdef YYERROR_VERBOSE
-
-# ifndef yystrlen
-#  if defined (__GLIBC__) && defined (_STRING_H)
-#   define yystrlen strlen
-#  else
-/* Return the length of YYSTR.  */
-static YYSIZE_T
-#   if defined (__STDC__) || defined (__cplusplus)
-yystrlen (const char *yystr)
-#   else
-yystrlen (yystr)
-     const char *yystr;
-#   endif
-{
-  register const char *yys = yystr;
-
-  while (*yys++ != '\0')
-    continue;
-
-  return yys - yystr - 1;
-}
-#  endif
-# endif
-
-# ifndef yystpcpy
-#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
-#   define yystpcpy stpcpy
-#  else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-   YYDEST.  */
-static char *
-#   if defined (__STDC__) || defined (__cplusplus)
-yystpcpy (char *yydest, const char *yysrc)
-#   else
-yystpcpy (yydest, yysrc)
-     char *yydest;
-     const char *yysrc;
-#   endif
-{
-  register char *yyd = yydest;
-  register const char *yys = yysrc;
-
-  while ((*yyd++ = *yys++) != '\0')
-    continue;
-
-  return yyd - 1;
-}
-#  endif
-# endif
-#endif
-
-#line 315 "/usr/share/misc/bison.simple"
-
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
-   into yyparse.  The argument should have type void *.
-   It should actually point to an object.
-   Grammar actions can access the variable by casting it
-   to the proper pointer type.  */
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-#  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-#  define YYPARSE_PARAM_DECL
-# else
-#  define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-# endif
-#else /* !YYPARSE_PARAM */
-# define YYPARSE_PARAM_ARG
-# define YYPARSE_PARAM_DECL
-#endif /* !YYPARSE_PARAM */
-
-/* Prevent warning if -Wstrict-prototypes.  */
-#ifdef __GNUC__
-# ifdef YYPARSE_PARAM
-int yyparse (void *);
-# else
-int yyparse (void);
-# endif
-#endif
-
-/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
-   variables are global, or local to YYPARSE.  */
-
-#define YY_DECL_NON_LSP_VARIABLES			\
-/* The lookahead symbol.  */				\
-int yychar;						\
-							\
-/* The semantic value of the lookahead symbol. */	\
-YYSTYPE yylval;						\
-							\
-/* Number of parse errors so far.  */			\
-int yynerrs;
-
-#if YYLSP_NEEDED
-# define YY_DECL_VARIABLES			\
-YY_DECL_NON_LSP_VARIABLES			\
-						\
-/* Location data for the lookahead symbol.  */	\
-YYLTYPE yylloc;
-#else
-# define YY_DECL_VARIABLES			\
-YY_DECL_NON_LSP_VARIABLES
-#endif
-
-
-/* If nonreentrant, generate the variables here. */
-
-#if !YYPURE
-YY_DECL_VARIABLES
-#endif  /* !YYPURE */
-
-int
-yyparse (YYPARSE_PARAM_ARG)
-     YYPARSE_PARAM_DECL
-{
-  /* If reentrant, generate the variables here. */
-#if YYPURE
-  YY_DECL_VARIABLES
-#endif  /* !YYPURE */
-
-  register int yystate;
-  register int yyn;
-  int yyresult;
-  /* Number of tokens to shift before error messages enabled.  */
-  int yyerrstatus;
-  /* Lookahead token as an internal (translated) token number.  */
-  int yychar1 = 0;
-
-  /* Three stacks and their tools:
-     `yyss': related to states,
-     `yyvs': related to semantic values,
-     `yyls': related to locations.
-
-     Refer to the stacks thru separate pointers, to allow yyoverflow
-     to reallocate them elsewhere.  */
-
-  /* The state stack. */
-  short	yyssa[YYINITDEPTH];
-  short *yyss = yyssa;
-  register short *yyssp;
-
-  /* The semantic value stack.  */
-  YYSTYPE yyvsa[YYINITDEPTH];
-  YYSTYPE *yyvs = yyvsa;
-  register YYSTYPE *yyvsp;
-
-#if YYLSP_NEEDED
-  /* The location stack.  */
-  YYLTYPE yylsa[YYINITDEPTH];
-  YYLTYPE *yyls = yylsa;
-  YYLTYPE *yylsp;
-#endif
-
-#if YYLSP_NEEDED
-# define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
-#else
-# define YYPOPSTACK   (yyvsp--, yyssp--)
-#endif
-
-  YYSIZE_T yystacksize = YYINITDEPTH;
-
-
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
-#if YYLSP_NEEDED
-  YYLTYPE yyloc;
-#endif
-
-  /* When reducing, the number of symbols on the RHS of the reduced
-     rule. */
-  int yylen;
-
-  YYDPRINTF ((stderr, "Starting parse\n"));
-
-  yystate = 0;
-  yyerrstatus = 0;
-  yynerrs = 0;
-  yychar = YYEMPTY;		/* Cause a token to be read.  */
-
-  /* Initialize stack pointers.
-     Waste one element of value and location stack
-     so that they stay on the same level as the state stack.
-     The wasted elements are never initialized.  */
-
-  yyssp = yyss;
-  yyvsp = yyvs;
-#if YYLSP_NEEDED
-  yylsp = yyls;
-#endif
-  goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
-`------------------------------------------------------------*/
- yynewstate:
-  /* In all cases, when you get here, the value and location stacks
-     have just been pushed. so pushing a state here evens the stacks.
-     */
-  yyssp++;
-
- yysetstate:
-  *yyssp = yystate;
-
-  if (yyssp >= yyss + yystacksize - 1)
-    {
-      /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
-      {
-	/* Give user a chance to reallocate the stack. Use copies of
-	   these so that the &'s don't force the real ones into
-	   memory.  */
-	YYSTYPE *yyvs1 = yyvs;
-	short *yyss1 = yyss;
-
-	/* Each stack pointer address is followed by the size of the
-	   data in use in that stack, in bytes.  */
-# if YYLSP_NEEDED
-	YYLTYPE *yyls1 = yyls;
-	/* This used to be a conditional around just the two extra args,
-	   but that might be undefined if yyoverflow is a macro.  */
-	yyoverflow ("parser stack overflow",
-		    &yyss1, yysize * sizeof (*yyssp),
-		    &yyvs1, yysize * sizeof (*yyvsp),
-		    &yyls1, yysize * sizeof (*yylsp),
-		    &yystacksize);
-	yyls = yyls1;
-# else
-	yyoverflow ("parser stack overflow",
-		    &yyss1, yysize * sizeof (*yyssp),
-		    &yyvs1, yysize * sizeof (*yyvsp),
-		    &yystacksize);
-# endif
-	yyss = yyss1;
-	yyvs = yyvs1;
-      }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyoverflowlab;
-# else
-      /* Extend the stack our own way.  */
-      if (yystacksize >= YYMAXDEPTH)
-	goto yyoverflowlab;
-      yystacksize *= 2;
-      if (yystacksize > YYMAXDEPTH)
-	yystacksize = YYMAXDEPTH;
-
-      {
-	short *yyss1 = yyss;
-	union yyalloc *yyptr =
-	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-	if (! yyptr)
-	  goto yyoverflowlab;
-	YYSTACK_RELOCATE (yyss);
-	YYSTACK_RELOCATE (yyvs);
-# if YYLSP_NEEDED
-	YYSTACK_RELOCATE (yyls);
-# endif
-# undef YYSTACK_RELOCATE
-	if (yyss1 != yyssa)
-	  YYSTACK_FREE (yyss1);
-      }
-# endif
-#endif /* no yyoverflow */
-
-      yyssp = yyss + yysize - 1;
-      yyvsp = yyvs + yysize - 1;
-#if YYLSP_NEEDED
-      yylsp = yyls + yysize - 1;
-#endif
-
-      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-		  (unsigned long int) yystacksize));
-
-      if (yyssp >= yyss + yystacksize - 1)
-	YYABORT;
-    }
-
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
-  goto yybackup;
-
-
-/*-----------.
-| yybackup.  |
-`-----------*/
-yybackup:
-
-/* Do appropriate processing given the current state.  */
-/* Read a lookahead token if we need one and don't already have one.  */
-/* yyresume: */
-
-  /* First try to decide what to do without reference to lookahead token.  */
-
-  yyn = yypact[yystate];
-  if (yyn == YYFLAG)
-    goto yydefault;
-
-  /* Not known => get a lookahead token if don't already have one.  */
-
-  /* yychar is either YYEMPTY or YYEOF
-     or a valid token in external form.  */
-
-  if (yychar == YYEMPTY)
-    {
-      YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = YYLEX;
-    }
-
-  /* Convert token to internal form (in yychar1) for indexing tables with */
-
-  if (yychar <= 0)		/* This means end of input. */
-    {
-      yychar1 = 0;
-      yychar = YYEOF;		/* Don't call YYLEX any more */
-
-      YYDPRINTF ((stderr, "Now at end of input.\n"));
-    }
-  else
-    {
-      yychar1 = YYTRANSLATE (yychar);
-
-#if YYDEBUG
-     /* We have to keep this `#if YYDEBUG', since we use variables
-	which are defined only if `YYDEBUG' is set.  */
-      if (yydebug)
-	{
-	  YYFPRINTF (stderr, "Next token is %d (%s",
-		     yychar, yytname[yychar1]);
-	  /* Give the individual parser a way to print the precise
-	     meaning of a token, for further debugging info.  */
-# ifdef YYPRINT
-	  YYPRINT (stderr, yychar, yylval);
-# endif
-	  YYFPRINTF (stderr, ")\n");
-	}
-#endif
-    }
-
-  yyn += yychar1;
-  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
-    goto yydefault;
-
-  yyn = yytable[yyn];
-
-  /* yyn is what to do for this token type in this state.
-     Negative => reduce, -yyn is rule number.
-     Positive => shift, yyn is new state.
-       New state is final state => don't bother to shift,
-       just return success.
-     0, or most negative number => error.  */
-
-  if (yyn < 0)
-    {
-      if (yyn == YYFLAG)
-	goto yyerrlab;
-      yyn = -yyn;
-      goto yyreduce;
-    }
-  else if (yyn == 0)
-    goto yyerrlab;
-
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
-  /* Shift the lookahead token.  */
-  YYDPRINTF ((stderr, "Shifting token %d (%s), ",
-	      yychar, yytname[yychar1]));
-
-  /* Discard the token being shifted unless it is eof.  */
-  if (yychar != YYEOF)
-    yychar = YYEMPTY;
-
-  *++yyvsp = yylval;
-#if YYLSP_NEEDED
-  *++yylsp = yylloc;
-#endif
-
-  /* Count tokens shifted since error; after three, turn off error
-     status.  */
-  if (yyerrstatus)
-    yyerrstatus--;
-
-  yystate = yyn;
-  goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state.  |
-`-----------------------------------------------------------*/
-yydefault:
-  yyn = yydefact[yystate];
-  if (yyn == 0)
-    goto yyerrlab;
-  goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction.  |
-`-----------------------------*/
-yyreduce:
-  /* yyn is the number of a rule to reduce with.  */
-  yylen = yyr2[yyn];
-
-  /* If YYLEN is nonzero, implement the default value of the action:
-     `$$ = $1'.
-
-     Otherwise, the following line sets YYVAL to the semantic value of
-     the lookahead token.  This behavior is undocumented and Bison
-     users should not rely upon it.  Assigning to YYVAL
-     unconditionally makes the parser a bit smaller, and it avoids a
-     GCC warning that YYVAL may be used uninitialized.  */
-  yyval = yyvsp[1-yylen];
-
-#if YYLSP_NEEDED
-  /* Similarly for the default location.  Let the user run additional
-     commands if for instance locations are ranges.  */
-  yyloc = yylsp[1-yylen];
-  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
-#endif
-
-#if YYDEBUG
-  /* We have to keep this `#if YYDEBUG', since we use variables which
-     are defined only if `YYDEBUG' is set.  */
-  if (yydebug)
-    {
-      int yyi;
-
-      YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
-		 yyn, yyrline[yyn]);
-
-      /* Print the symbols being reduced, and their result.  */
-      for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
-	YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
-      YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
-    }
-#endif
-
-  switch (yyn) {
-
-case 1:
-#line 84 "tp4.y"
-{
-	    printf("Program parsed!\n"); 
-	;
-    break;}
-case 2:
-#line 88 "tp4.y"
-{
-	    printf("Unit parsed!\n"); 
-	;
-    break;}
-case 6:
-#line 101 "tp4.y"
-{
-		/* Nie wykorzystujemy listy parametrow. */
-		freeNameList(yyvsp[-2].list);
-	;
-    break;}
-case 8:
-#line 110 "tp4.y"
-{
-		/* XXX Trzeba bedzie tez te unity sparsowac. */
-		registerUnitList(parser, yyvsp[-1].list);
-		freeNameList(yyvsp[-1].list);
-	;
-    break;}
-case 9:
-#line 120 "tp4.y"
-{
-			/* Tworzymy pusta liste. */
-			yyval.list = NULL;
-			/* I dodajemy do niej identyfikator. */
-			yyval.list = g_list_append(yyval.list, g_strdup(yyvsp[0].string));
-		;
-    break;}
-case 10:
-#line 127 "tp4.y"
-{
-			/* Powtarzamy liste. */
-			yyval.list = yyvsp[-2].list;
-			/* Dodajemy kolejny identyfikator. */
-			yyval.list = g_list_append(yyval.list, g_strdup(yyvsp[0].string));
-		;
-    break;}
-case 11:
-#line 137 "tp4.y"
-{
-	;
-    break;}
-case 12:
-#line 143 "tp4.y"
-{
-	;
-    break;}
-case 13:
-#line 149 "tp4.y"
-{
-	;
-    break;}
-case 14:
-#line 155 "tp4.y"
-{
-	;
-    break;}
-case 15:
-#line 161 "tp4.y"
-{
-	;
-    break;}
-case 16:
-#line 167 "tp4.y"
-{
-	;
-    break;}
-case 17:
-#line 170 "tp4.y"
-{
-	;
-    break;}
-case 29:
-#line 200 "tp4.y"
-{;
-    break;}
-case 30:
-#line 203 "tp4.y"
-{;
-    break;}
-case 31:
-#line 208 "tp4.y"
-{
-			/* Tymczasowa zmienna. */
-			static char *temp;
-			temp = g_strdup_printf("%d", yyvsp[0].const_int);
-			registerLabel(parser, temp);
-			g_free(temp);
-		;
-    break;}
-case 32:
-#line 216 "tp4.y"
-{
-			registerLabel(parser, yyvsp[0].string);
-		;
-    break;}
-case 44:
-#line 252 "tp4.y"
-{
-		freeLocal(parser);
-	;
-    break;}
-case 45:
-#line 256 "tp4.y"
-{
-		freeLocal(parser);
-	;
-    break;}
-case 46:
-#line 265 "tp4.y"
-{
-		registerConst(parser, yyvsp[-3].string);
-	;
-    break;}
-case 47:
-#line 269 "tp4.y"
-{
-		registerConst(parser, yyvsp[-5].string);
-	;
-    break;}
-case 48:
-#line 275 "tp4.y"
-{;
-    break;}
-case 49:
-#line 277 "tp4.y"
-{;
-    break;}
-case 50:
-#line 279 "tp4.y"
-{;
-    break;}
-case 51:
-#line 281 "tp4.y"
-{;
-    break;}
-case 52:
-#line 283 "tp4.y"
-{;
-    break;}
-case 53:
-#line 288 "tp4.y"
-{
-		/* Traktujemy wszystkie numery jak zmiennoprzecinkowe. */
-		yyval.const_real = yyvsp[0].const_int;
-	;
-    break;}
-case 67:
-#line 325 "tp4.y"
-{;
-    break;}
-case 75:
-#line 351 "tp4.y"
-{
-		registerType(parser, yyvsp[-3].string);
-	;
-    break;}
-case 80:
-#line 364 "tp4.y"
-{;
-    break;}
-case 81:
-#line 366 "tp4.y"
-{;
-    break;}
-case 82:
-#line 368 "tp4.y"
-{
-		freeNameList(yyvsp[-1].list);
-	;
-    break;}
-case 100:
-#line 416 "tp4.y"
-{
-		freeNameList(yyvsp[-2].list);
-	;
-    break;}
-case 102:
-#line 427 "tp4.y"
-{;
-    break;}
-case 103:
-#line 429 "tp4.y"
-{;
-    break;}
-case 115:
-#line 464 "tp4.y"
-{
-		/* Rejestrujemy po kolei kazda zmienna. */
-		registerVarList(parser, yyvsp[-4].list);
-		/* Usuwamy sama liste. */
-		freeNameList(yyvsp[-4].list);
-	;
-    break;}
-case 119:
-#line 482 "tp4.y"
-{
-		fprintf(stderr, "!!! Clearing local namespace!\n");
-		--(((Parser *)parser)->level);
-		freeLocal(parser);
-	;
-    break;}
-case 120:
-#line 491 "tp4.y"
-{
-		fprintf(stderr, "!!! Clearing local namespace!\n");
-		--(((Parser *)parser)->level);
-		freeLocal(parser);
-	;
-    break;}
-case 121:
-#line 502 "tp4.y"
-{
-		registerProc(parser, yyvsp[0].string);
-		++(((Parser *)parser)->level);
-	;
-    break;}
-case 122:
-#line 507 "tp4.y"
-{
-		++(((Parser *)parser)->level);
-	;
-    break;}
-case 123:
-#line 514 "tp4.y"
-{
-		registerFunc(parser, yyvsp[0].string);
-		++(((Parser *)parser)->level);
-	;
-    break;}
-case 124:
-#line 519 "tp4.y"
-{
-		++(((Parser *)parser)->level);
-	;
-    break;}
-case 134:
-#line 548 "tp4.y"
-{
-		registerVarList(parser, yyvsp[-2].list);
-		freeNameList(yyvsp[-2].list);
-	;
-    break;}
-case 135:
-#line 553 "tp4.y"
-{
-		registerVarList(parser, yyvsp[-2].list);
-		freeNameList(yyvsp[-2].list);
-	;
-    break;}
-case 136:
-#line 558 "tp4.y"
-{
-		registerVarList(parser, yyvsp[0].list);
-		freeNameList(yyvsp[0].list);
-	;
-    break;}
-case 137:
-#line 565 "tp4.y"
-{;
-    break;}
-case 153:
-#line 595 "tp4.y"
-{;
-    break;}
-case 184:
-#line 684 "tp4.y"
-{;
-    break;}
-case 188:
-#line 689 "tp4.y"
-{;
-    break;}
-case 215:
-#line 722 "tp4.y"
-{;
-    break;}
-case 216:
-#line 724 "tp4.y"
-{;
-    break;}
-case 217:
-#line 726 "tp4.y"
-{;
-    break;}
-case 218:
-#line 728 "tp4.y"
-{;
-    break;}
-case 223:
-#line 734 "tp4.y"
-{;
-    break;}
-}
-
-#line 705 "/usr/share/misc/bison.simple"
-
-
-  yyvsp -= yylen;
-  yyssp -= yylen;
-#if YYLSP_NEEDED
-  yylsp -= yylen;
-#endif
-
-#if YYDEBUG
-  if (yydebug)
-    {
-      short *yyssp1 = yyss - 1;
-      YYFPRINTF (stderr, "state stack now");
-      while (yyssp1 != yyssp)
-	YYFPRINTF (stderr, " %d", *++yyssp1);
-      YYFPRINTF (stderr, "\n");
-    }
-#endif
-
-  *++yyvsp = yyval;
-#if YYLSP_NEEDED
-  *++yylsp = yyloc;
-#endif
-
-  /* Now `shift' the result of the reduction.  Determine what state
-     that goes to, based on the state we popped back to and the rule
-     number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
-  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTBASE];
-
-  goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
-  /* If not already recovering from an error, report this error.  */
-  if (!yyerrstatus)
-    {
-      ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
-      yyn = yypact[yystate];
-
-      if (yyn > YYFLAG && yyn < YYLAST)
-	{
-	  YYSIZE_T yysize = 0;
-	  char *yymsg;
-	  int yyx, yycount;
-
-	  yycount = 0;
-	  /* Start YYX at -YYN if negative to avoid negative indexes in
-	     YYCHECK.  */
-	  for (yyx = yyn < 0 ? -yyn : 0;
-	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
-	    if (yycheck[yyx + yyn] == yyx)
-	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
-	  yysize += yystrlen ("parse error, unexpected ") + 1;
-	  yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
-	  yymsg = (char *) YYSTACK_ALLOC (yysize);
-	  if (yymsg != 0)
-	    {
-	      char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
-	      yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
-
-	      if (yycount < 5)
-		{
-		  yycount = 0;
-		  for (yyx = yyn < 0 ? -yyn : 0;
-		       yyx < (int) (sizeof (yytname) / sizeof (char *));
-		       yyx++)
-		    if (yycheck[yyx + yyn] == yyx)
-		      {
-			const char *yyq = ! yycount ? ", expecting " : " or ";
-			yyp = yystpcpy (yyp, yyq);
-			yyp = yystpcpy (yyp, yytname[yyx]);
-			yycount++;
-		      }
-		}
-	      yyerror (yymsg);
-	      YYSTACK_FREE (yymsg);
-	    }
-	  else
-	    yyerror ("parse error; also virtual memory exhausted");
-	}
-      else
-#endif /* defined (YYERROR_VERBOSE) */
-	yyerror ("parse error");
-    }
-  goto yyerrlab1;
-
-
-/*--------------------------------------------------.
-| yyerrlab1 -- error raised explicitly by an action |
-`--------------------------------------------------*/
-yyerrlab1:
-  if (yyerrstatus == 3)
-    {
-      /* If just tried and failed to reuse lookahead token after an
-	 error, discard it.  */
-
-      /* return failure if at end of input */
-      if (yychar == YYEOF)
-	YYABORT;
-      YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
-		  yychar, yytname[yychar1]));
-      yychar = YYEMPTY;
-    }
-
-  /* Else will try to reuse lookahead token after shifting the error
-     token.  */
-
-  yyerrstatus = 3;		/* Each real token shifted decrements this */
-
-  goto yyerrhandle;
-
-
-/*-------------------------------------------------------------------.
-| yyerrdefault -- current state does not do anything special for the |
-| error token.                                                       |
-`-------------------------------------------------------------------*/
-yyerrdefault:
-#if 0
-  /* This is wrong; only states that explicitly want error tokens
-     should shift them.  */
-
-  /* If its default is to accept any token, ok.  Otherwise pop it.  */
-  yyn = yydefact[yystate];
-  if (yyn)
-    goto yydefault;
-#endif
-
-
-/*---------------------------------------------------------------.
-| yyerrpop -- pop the current state because it cannot handle the |
-| error token                                                    |
-`---------------------------------------------------------------*/
-yyerrpop:
-  if (yyssp == yyss)
-    YYABORT;
-  yyvsp--;
-  yystate = *--yyssp;
-#if YYLSP_NEEDED
-  yylsp--;
-#endif
-
-#if YYDEBUG
-  if (yydebug)
-    {
-      short *yyssp1 = yyss - 1;
-      YYFPRINTF (stderr, "Error: state stack now");
-      while (yyssp1 != yyssp)
-	YYFPRINTF (stderr, " %d", *++yyssp1);
-      YYFPRINTF (stderr, "\n");
-    }
-#endif
-
-/*--------------.
-| yyerrhandle.  |
-`--------------*/
-yyerrhandle:
-  yyn = yypact[yystate];
-  if (yyn == YYFLAG)
-    goto yyerrdefault;
-
-  yyn += YYTERROR;
-  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
-    goto yyerrdefault;
-
-  yyn = yytable[yyn];
-  if (yyn < 0)
-    {
-      if (yyn == YYFLAG)
-	goto yyerrpop;
-      yyn = -yyn;
-      goto yyreduce;
-    }
-  else if (yyn == 0)
-    goto yyerrpop;
-
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
-  YYDPRINTF ((stderr, "Shifting error token, "));
-
-  *++yyvsp = yylval;
-#if YYLSP_NEEDED
-  *++yylsp = yylloc;
-#endif
-
-  yystate = yyn;
-  goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here.  |
-`-------------------------------------*/
-yyacceptlab:
-  yyresult = 0;
-  goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here.  |
-`-----------------------------------*/
-yyabortlab:
-  yyresult = 1;
-  goto yyreturn;
-
-/*---------------------------------------------.
-| yyoverflowab -- parser overflow comes here.  |
-`---------------------------------------------*/
-yyoverflowlab:
-  yyerror ("parser stack overflow");
-  yyresult = 2;
-  /* Fall through.  */
-
-yyreturn:
-#ifndef yyoverflow
-  if (yyss != yyssa)
-    YYSTACK_FREE (yyss);
-#endif
-  return yyresult;
-}
-#line 752 "tp4.y"
--- a/tp4.tab.h	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-#ifndef BISON_TP4_TAB_H
-# define BISON_TP4_TAB_H
-
-#ifndef YYSTYPE
-typedef union {
-	int		const_int;	/* Dla stalych calkowitych. */
-	float		const_real;	/* Dla stalych zmiennoprzecinkowych. */
-	char	      * string;		/* Dla stringow i ID_NAME */
-	DictEntry     * symbol;		/* Dla symboli. */
-	GList	      * list;		/* Dla list. */
-} yystype;
-# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-# define	K_AND	257
-# define	K_ABSOLUTE	258
-# define	K_ARRAY	259
-# define	K_BEGIN	260
-# define	K_CASE	261
-# define	K_CONST	262
-# define	K_DIV	263
-# define	K_DOWNTO	264
-# define	K_DO	265
-# define	K_ELSE	266
-# define	K_END	267
-# define	K_EXTERNAL	268
-# define	K_FILE	269
-# define	K_FORWARD	270
-# define	K_FOR	271
-# define	K_FUNCTION	272
-# define	K_GOTO	273
-# define	K_IF	274
-# define	K_IMPLEMENTATION	275
-# define	K_INTERFACE	276
-# define	K_IN	277
-# define	K_LABEL	278
-# define	K_MOD	279
-# define	K_NIL	280
-# define	K_NOT	281
-# define	K_OF	282
-# define	K_OR	283
-# define	K_PACKED	284
-# define	K_PROCEDURE	285
-# define	K_PROGRAM	286
-# define	K_RECORD	287
-# define	K_REPEAT	288
-# define	K_SET	289
-# define	K_SHL	290
-# define	K_SHR	291
-# define	K_STRING	292
-# define	K_THEN	293
-# define	K_TO	294
-# define	K_TYPE	295
-# define	K_UNIT	296
-# define	K_UNTIL	297
-# define	K_USES	298
-# define	K_VAR	299
-# define	K_WHILE	300
-# define	K_WITH	301
-# define	K_XOR	302
-# define	OP_DOTDOT	303
-# define	OP_DEFEQ	304
-# define	OP_LEQ	305
-# define	OP_NEQ	306
-# define	OP_GEQ	307
-# define	ID_FUNC	308
-# define	ID_PROC	309
-# define	ID_VAR	310
-# define	ID_TYPE	311
-# define	ID_LABEL	312
-# define	ID_UNIT	313
-# define	ID_CONST	314
-# define	ID_FIELD	315
-# define	ID_NAME	316
-# define	CONST_INT	317
-# define	CONST_REAL	318
-# define	CONST_STRING	319
-
-
-#endif /* not BISON_TP4_TAB_H */
--- a/tp4.y	Sat Oct 13 21:11:54 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,751 +0,0 @@
-%{
-#include <stdio.h>
-#include <glib.h>
-#include "tokenize.h"
-#include "dict.h"
-#define YYERROR_VERBOSE
-#define YYDEBUG 1
-#define YYLEX_PARAM parser
-#define YYPARSE_PARAM parser
-%}
-
-%pure_parser 				/* Nie chcemy globalnych zmiennych! Precz z globalnymi zmiennymi! */
-
-/* Typ danych dla tokenów. */
-%union {
-	int		const_int;	/* Dla stalych calkowitych. */
-	float		const_real;	/* Dla stalych zmiennoprzecinkowych. */
-	char	      * string;		/* Dla stringow i ID_NAME */
-	DictEntry     * symbol;		/* Dla symboli. */
-	GList	      * list;		/* Dla list. */
-}
-
-%{
-/* To musi byc wlaczone po zdefiniowaniu typu %union. */
-#include "parser.h"
-%}
-
-/* Typy symboli nieterminalnych. */
-%type <list> id_name_list		/* Lista identyfikatorow. */
-%type <const_real> unsigned_number	/* Stala numeryczna. */
-
-/* Slowa kluczowe, poprzedzone 'K_' dla odroznienia od innych identyfikatorow (na przyklad FILE).  */
-
-%token
-K_AND		K_ABSOLUTE	K_ARRAY			K_BEGIN
-K_CASE		K_CONST		K_DIV			K_DOWNTO
-K_DO		K_ELSE		K_END			K_EXTERNAL
-K_FILE		K_FORWARD	K_FOR			K_FUNCTION
-K_GOTO		K_IF		K_IMPLEMENTATION 	K_INTERFACE
-K_IN		K_LABEL		K_MOD			K_NIL
-K_NOT		K_OF		K_OR			K_PACKED
-K_PROCEDURE	K_PROGRAM	K_RECORD		K_REPEAT
-K_SET		K_SHL		K_SHR			K_STRING
-K_THEN		K_TO		K_TYPE			K_UNIT
-K_UNTIL		K_USES		K_VAR			K_WHILE
-K_WITH		K_XOR
-
-%right K_THEN 
-%right K_ELSE            /* resolve dangling else */
-
-
-/* Wieloznakowe operatory. */
-%token
-OP_DOTDOT	/* .. */
-OP_DEFEQ	/* := */
-OP_LEQ		/* <= */
-OP_NEQ		/* <> */
-OP_GEQ		/* >= */
-
-/* Identyfikatory i stale.  */
-
-%type <symbol> ID_FUNC		/* Identyfikator funkcji */
-%type <symbol> ID_PROC		/* Identyfikator procedury */
-%type <symbol> ID_VAR		/* Identyfikator zmiennej */
-%type <symbol> ID_TYPE		/* Identyfikator typu */
-%type <symbol> ID_LABEL		/* Identyfikator etykiety */
-%type <symbol> ID_UNIT		/* Identyfikator jednostki */
-%type <symbol> ID_CONST		/* Identyfikator stalej */
-%type <symbol> ID_FIELD		/* Identyfikator pola rekordu */
-%type <string> ID_NAME 		/* Inny identyfikator, przed nadaniem mu znaczenia (przy deklaracji). */
-%token ID_FUNC ID_PROC ID_VAR ID_TYPE ID_LABEL ID_UNIT ID_CONST ID_FIELD ID_NAME
-
-%type <const_int> CONST_INT 		/* Stala calkowita */
-%type <const_real> CONST_REAL 		/* Stala zmiennoprzecinkowa */
-%type <const_string> CONST_STRING 	/* Stala lancuchowa */
-%token CONST_INT CONST_REAL CONST_STRING
-
-%start compilation_unit
-
-%%
-
-compilation_unit
-	: program	
-	{
-	    printf("Program parsed!\n"); 
-	}
-        | unit		
-	{
-	    printf("Unit parsed!\n"); 
-	}
-        ;
-
-/* Programs: */
-program	: program_heading uses_clause block '.'
-	;
-
-program_heading
-	: /* empty */
-        | K_PROGRAM ID_NAME ';'
-        | K_PROGRAM ID_NAME '(' id_name_list ')' ';'
-	{
-		/* Nie wykorzystujemy listy parametrow. */
-		freeNameList($4);
-	}
-	;
-
-uses_clause
-	: /* empty */
-        | K_USES id_name_list ';'
-	{
-		/* XXX Trzeba bedzie tez te unity sparsowac. */
-		registerUnitList(parser, $2);
-		freeNameList($2);
-	}
-        ;
-
-
-/* Listy identyfikatorow roznych rodzajow */
-id_name_list	: ID_NAME		/* Pierwszy element. */	
-	     	{
-			/* Tworzymy pusta liste. */
-			$$ = NULL;
-			/* I dodajemy do niej identyfikator. */
-			$$ = g_list_append($$, g_strdup($1));
-		}
-		| id_name_list ',' ID_NAME	/* Kolejne elementy. */
-		{
-			/* Powtarzamy liste. */
-			$$ = $1;
-			/* Dodajemy kolejny identyfikator. */
-			$$ = g_list_append($$, g_strdup($3));
-		}
-        	;
-
-/* Blok programu */
-block	: decl_sect_list compound_stmt
-        {
-	}
-	;
-
-/* Units: */
-unit	: unit_heading interface_part implementation_part initialization_part '.'
-	{
-	}
-	;
-
-unit_heading
-	: K_UNIT ID_NAME ';'
-	{
-	}
-	;
-
-interface_part
-	: K_INTERFACE uses_clause int_decl_sect_list
-	{
-	}
-        ;
-
-implementation_part
-	: K_IMPLEMENTATION uses_clause decl_sect_list
-	{
-	}
-        ;
-
-initialization_part
-	: compound_stmt
-	{
-	}
-        | K_END
-	{
-	}
-        ;
-
-/* Declaration sections: */
-
-decl_sect_list
-	: /* empty */
-        | decl_sect_list decl_sect
-        ;
-
-decl_sect
-	: label_decl_sect
-	| const_decl_sect
-	| type_decl_sect
-	| var_decl_sect
-	| proc_decl
-	| func_decl
-	;
-
-label_decl_sect
-	: K_LABEL label_list ';'
-	;
-
-label_list
-	: label_decl
-        | label_list ',' label_decl
-        ;
-
-label	: CONST_INT
-        {}
-		/* must be decimal integer in the range 0..9999 */
-	| ID_LABEL
-	{}
-        ;
-
-/* Uzywany przy deklarowaniu etykiet, kiedy jeszcze nie wiemy, ze ID to etykieta */
-label_decl	: CONST_INT
-	   	{
-			/* Tymczasowa zmienna. */
-			static char *temp;
-			temp = g_strdup_printf("%d", $1);
-			registerLabel(parser, temp);
-			g_free(temp);
-		}
-		| ID_NAME
-		{
-			registerLabel(parser, $1);
-		}
-        	;
-
-const_decl_sect
-	: K_CONST const_decl
-	| const_decl_sect const_decl
-	;
-
-type_decl_sect
-	: K_TYPE type_decl
-	| type_decl_sect type_decl
-	;
-
-var_decl_sect
-	: K_VAR var_decl
-	| var_decl_sect var_decl
-	;
-
-/* Interface declaration sections: */
-
-/* These appear instead of normal declaration sections in the interface
-   part of a unit. The difference is that there are no label declarations
-   and for procedures and functions only the headings are given. */
-
-int_decl_sect_list
-	: /* empty */
-	| int_decl_sect_list int_decl_sect
-	;
-
-int_decl_sect
-	: const_decl_sect
-	| type_decl_sect
-	| var_decl_sect
-	| proc_heading
-	{
-		freeLocal(parser);
-	}
-	| func_heading
-	{
-		freeLocal(parser);
-	}
-	;
-
-/* Constant declarations: */
-
-const_decl
-	: ID_NAME '=' const ';'
-	{
-		registerConst(parser, $1);
-	}
-        | ID_NAME ':' type '=' typed_const ';'
-	{
-		registerConst(parser, $1);
-	}
-        ;
-
-const	: unsigned_number
-        {}
-        | sign unsigned_number
-	{}
-	| ID_CONST
-	{}
-	| sign ID_CONST
-	{}
-	| CONST_STRING
-	{}
-	;
-
-unsigned_number
-	: CONST_INT
-	{
-		/* Traktujemy wszystkie numery jak zmiennoprzecinkowe. */
-		$$ = $1;
-	}
-        | CONST_REAL
-        ;
-
-sign	: '+' | '-'
-	;
-
-typed_const
-	: const
-	| array_const
-	| record_const
-        | set_const
-	;
-
-array_const
-	: '(' typed_const_list ')'
-	;
-
-typed_const_list
-	: typed_const
-	| typed_const_list ',' typed_const
-	;
-
-record_const
-	: '(' const_field_list ')'
-	;
-
-const_field_list
-	: const_field
-	| const_field_list ',' const_field
-	;
-
-const_field
-	: ID_FIELD ':' typed_const
-	{}
-	;
-
-set_const
-	: '[' const_elem_list ']'
-        ;
-
-const_elem_list
-	: /* empty */
-        | const_elem_list1
-        ;
-
-const_elem_list1
-	: const_elem
-	| const_elem_list1 ',' const_elem
-	;
-
-const_elem
-	: const
-	| const OP_DOTDOT const
-	;
-
-/* Type declarations: */
-
-type_decl
-	: ID_NAME '=' type ';'
-	{
-		registerType(parser, $1);
-	}
-	;
-
-type	: simple_type
-	| pointer_type
-        | structured_type
-        | string_type
-        ;
-
-simple_type
-	: ID_TYPE
-	{}
-	| const OP_DOTDOT const	/* subrange */
-	{}
-	| '(' id_name_list ')'	/* enumeration */
-	{
-		freeNameList($2);
-	}
-	;
-
-pointer_type
-	: '^' ID_TYPE
-	;
-
-structured_type
-	: unpacked_structured_type
-        | K_PACKED unpacked_structured_type
-        ;
-
-unpacked_structured_type
-	: array_type
-	| record_type
-	| set_type
-	| file_type
-	;
-
-array_type
-	: K_ARRAY '[' simple_type_list ']' K_OF type
-	;
-
-simple_type_list
-	: simple_type
-	| simple_type_list ',' simple_type
-	;
-
-record_type
-	: K_RECORD field_list K_END
-	;
-
-field_list
-	: fixed_part
-	| variant_part
-	| fixed_part ';' variant_part
-	;
-
-fixed_part
-	: record_section
-	| fixed_part ';' record_section
-	;
-
-record_section
-	: /* empty */
-	| id_name_list ':' type
-	{
-		freeNameList($1);
-	}
-	;
-
-variant_part
-	: K_CASE tag_field K_OF variant_list
-	;
-
-tag_field
-	: ID_NAME
-	{}
-	| ID_NAME ':' ID_TYPE
-	{}
-	;
-
-variant_list
-	: variant
-	| variant_list ';' variant
-	;
-
-variant	: /* empty */
-	| case_tag_list ':' '(' field_list ')'
-	;
-
-case_tag_list
-	: const
-        | case_tag_list ',' const
-        ;
-
-set_type
-	: K_SET K_OF simple_type
-	;
-
-file_type
-	: K_FILE K_OF type
-	| K_FILE
-	;
-
-string_type
-	: K_STRING
-	| K_STRING '[' const ']'
-	;
-
-/* Variable declarations: */
-
-var_decl
-	: id_name_list ':' type absolute_clause ';'
-	{
-		/* Rejestrujemy po kolei kazda zmienna. */
-		registerVarList(parser, $1);
-		/* Usuwamy sama liste. */
-		freeNameList($1);
-	}
-	;
-
-absolute_clause
-	: /* empty */
-        | K_ABSOLUTE CONST_INT ':' CONST_INT
-        | K_ABSOLUTE ID_VAR
-        ;
-
-/* Procedure and function declarations: */
-
-proc_decl
-	: proc_heading proc_block ';'
-	{
-		fprintf(stderr, "!!! Clearing local namespace!\n");
-		--(((Parser *)parser)->level);
-		freeLocal(parser);
-	}
-	;
-
-func_decl
-	: func_heading proc_block ';'
-	{
-		fprintf(stderr, "!!! Clearing local namespace!\n");
-		--(((Parser *)parser)->level);
-		freeLocal(parser);
-	}
-	;
-
-/* XXX Hack -- nazwa funkcji/procedury musi istniec zanim wczytamy parametry. */
-/* XXX Funkcja/procedura mogla byc juz zadeklarowana. */
-proc_heading_beginning
-	: K_PROCEDURE ID_NAME
-	{
-		registerProc(parser, $2);
-		++(((Parser *)parser)->level);
-	}
-	| K_PROCEDURE ID_PROC
-	{
-		++(((Parser *)parser)->level);
-	}
-	;
-
-func_heading_beginning
-	: K_FUNCTION ID_NAME
-	{
-		registerFunc(parser, $2);
-		++(((Parser *)parser)->level);
-	}
-	| K_FUNCTION ID_FUNC
-	{
-		++(((Parser *)parser)->level);
-	}
-	;
-
-proc_heading
-	: proc_heading_beginning fp_list ';'
-	;
-
-func_heading
-	: func_heading_beginning fp_list ':' fptype ';'
-	;
-
-proc_block         	/* omitted inline and interrupt */
-	: block
-	| K_EXTERNAL
-	| K_FORWARD
-	;
-
-fp_list : /* empty */
-	| '(' fp_sect_list ')'
-	;
-
-fp_sect_list
-	: fp_sect
-	| fp_sect_list ';' fp_sect
-	;
-
-fp_sect	: id_name_list ':' fptype
-	{
-		registerVarList(parser, $1);
-		freeNameList($1);
-	}
-	| K_VAR id_name_list ':' fptype
-	{
-		registerVarList(parser, $2);
-		freeNameList($2);
-	}
-	| K_VAR id_name_list
-	{
-		registerVarList(parser, $2);
-		freeNameList($2);
-	}
-	;
-
-fptype	: ID_TYPE
-        {}
-	| K_STRING
-	;
-
-/* Statements: */
-
-stmt	: unlabelled_stmt
-	| label ':' unlabelled_stmt
-        ;
-
-unlabelled_stmt
-	: /* empty */
-	| assignment
-	| proc_call
-	| goto_stmt
-	| compound_stmt
-	| if_stmt
-	| case_stmt
-	| repeat_stmt
-	| while_stmt
-	| for_stmt
-	| with_stmt
-	;
-
-assignment
-	: variable OP_DEFEQ expr
-	;
-
-proc_call
-	: ID_PROC param_list
-	{}
-	;
-
-param_list
-	: /* empty */
-	| '(' expr_list ')'
-	;
-
-expr_list
-	: expr
-	| expr_list ',' expr
-	;
-
-goto_stmt
-	: K_GOTO label
-	;
-
-compound_stmt
-	: K_BEGIN stmt_list K_END
-	;
-
-stmt_list
-	: stmt
-	| stmt_list ';' stmt
-	;
-
-if_stmt	: K_IF expr K_THEN stmt
-	| K_IF expr K_THEN stmt K_ELSE stmt
-	;
-
-case_stmt
-	: K_CASE expr K_OF case_list else_case K_END
-	;
-
-case_list
-	: case
-	| case_list ';' case
-	;
-
-case	: /* empty */
-	| case_label_list ':' stmt
-	;
-
-case_label_list
-	: case_label
-        | case_label_list ',' case_label
-        ;
-
-case_label
-	: const
-        | const OP_DOTDOT const
-        ;
-
-else_case
-	: /* empty */
-	| K_ELSE stmt
-	| K_ELSE stmt ';'
-	;
-
-repeat_stmt
-	: K_REPEAT stmt_list K_UNTIL expr
-	;
-
-while_stmt
-	: K_WHILE expr K_DO stmt
-	;
-
-for_stmt
-	: K_FOR ID_VAR OP_DEFEQ expr K_TO expr K_DO stmt
-	| K_FOR ID_VAR OP_DEFEQ expr K_DOWNTO expr K_DO stmt
-	;
-
-with_stmt
-	: K_WITH variable_list K_DO stmt
-	;
-
-variable_list
-	: variable
-        | variable_list ',' variable
-        ;
-
-/* Variables: */
-
-record_variable
-	: variable '.'
-	;
-
-variable
-	: ID_VAR
-	{}
-	| variable '[' expr_list ']'		/* array component */
-	| record_variable ID_FIELD		/* record field */
-        | variable '^'				/* pointer value */
-	| ID_TYPE '(' variable ')'		/* type cast */
-	{}
-	;
-
-/* Expressions: */
-
-expr	: simple_expr
-	| simple_expr relop simple_expr
-        ;
-
-relop	: '=' | OP_NEQ | '<' | '>' | OP_LEQ | OP_GEQ | K_IN
-        ;
-
-simple_expr
-	: term
-        | sign term
-        | simple_expr addop term
-        ;
-
-addop	: '+' | '-' | K_OR | K_XOR
-	;
-
-term	: factor
-	| term mulop factor
-        ;
-
-mulop	: '*' | '/' | K_DIV | K_MOD | K_SHL | K_SHR | K_AND
-	;
-
-/* Parameterless function calls, and function calls looking like type
-   casts are caught as variables. */
-
-factor	: variable
-        | ID_CONST
-	{}
-        | CONST_INT
-	{}
-	| CONST_REAL
-	{}
-	| CONST_STRING
-	{}
-        | '[' elem_list ']'
-        | K_NIL
-        | '@' variable
-        | '(' expr ')'
-        | ID_FUNC '(' expr_list ')'
-	{}
-        | K_NOT factor
-        ;
-
-elem_list
-	: /* empty */
-        | elem_list1
-        ;
-
-elem_list1
-	: elem
-	| elem_list1 ',' elem
-	;
-
-elem	: expr
-	| expr OP_DOTDOT expr
-	;
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils.c	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,105 @@
+#include <glib.h>
+
+#include "symbols.h"
+#include "parser.h"
+#include "node.h"
+#include "utils.h"
+
+/* Zwalnia listę */    
+void
+freeNameList(GList *list)
+{
+    GList *iter;
+    
+    for (iter=list; iter!=NULL; iter=iter->next) {
+        g_free((char *)(iter->data));
+    }
+    g_list_free(list);
+    list = NULL;
+}
+
+
+/* Wpycha symbol na stos zasięgów. */
+void
+pushScope(Parser *parser, SymbolNode *node)
+{
+    parser->scopes = g_list_prepend(parser->scopes, node);
+}
+
+/* Zdejmuje symbol ze stosu zasięgów. */
+void
+popScope(Parser *parser)
+{
+    GList *first;
+
+    if (parser->scopes == NULL)
+        return;
+
+    first = g_list_first(parser->scopes);
+    parser->scopes = g_list_remove_link(parser->scopes, first);
+    g_list_free(first);
+}
+
+/* Znajduje symbol na stosie zasięgów. */
+SymbolNode *
+findSymbol(Parser *parser, const char *name)
+{
+    GList  *level;
+    SymbolNode *sym;
+
+    sym = NULL;
+    level = g_list_first(parser->scopes);
+    if (parser->levelup) {
+        while ((level!=NULL)&&(sym==NULL)) {
+            sym = getSymbol(((SymbolNode *)level->data)->symbols, name);
+            level = g_list_next(level);
+        }
+    } else {
+        sym = getSymbol(((SymbolNode *)level->data)->symbols, name);
+    }
+
+    return sym;
+}
+
+/* Rejestruje dany symbol w tablicy symboli. */
+void
+registerSymbolNode(Parser *parser, SymbolNode *node)
+{
+    GString *key;
+    GList *iter;
+    Namespace *nam;
+
+    /* Dodajemy symbol do aktualnej przestrzeni nazw. */
+    if (node==NULL)
+        return;
+    /* Do zmiennej rekordowej możemy dodawać TYLKO pola! */
+    iter = parser->scopes;
+    if (node->kind!=SYM_VAR_FIELD) {
+        while ( (iter!=NULL) && (((SymbolNode *)iter->data)->kind==SYM_TYPE_RECORD)) {
+            iter=iter->next;
+        }
+    }
+    if (iter==NULL) 
+        return;
+    nam = ((SymbolNode *)iter->data)->symbols;
+    nam->list = g_list_append(nam->list, node);
+    key = g_string_new(node->name->str);
+    key = g_string_up(key);
+    g_hash_table_insert(nam->table, key->str, node);
+    g_string_free(key, FALSE);
+    node->parent = ((SymbolNode *)iter->data);
+}
+
+/* Wyszukuje symbol w przestrzeni nazw. */
+SymbolNode*
+getSymbol(Namespace * nam, const char *name)
+{
+    SymbolNode         *sym;
+    GString        *key;
+
+    key = g_string_new(name);
+    key = g_string_up(key);
+    sym = g_hash_table_lookup(nam->table, (gpointer) (key->str));
+    g_string_free(key, TRUE);
+    return sym;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils.h	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,26 @@
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <glib.h>
+#include "node.h"
+#include "parser.h"
+#include "symbols.h"
+
+/* Zwalnia listę */    
+void freeNameList(GList *list);
+
+/* Wpycha symbol na stos zasięgów. */
+void pushScope(Parser *parser, SymbolNode *node);
+    
+/* Zdejmuje symbol ze stosu zasięgów. */
+void popScope(Parser *parser);
+
+/* Znajduje symbol na stosie zasięgów. */
+SymbolNode *findSymbol(Parser *parser, const char *name);
+
+/* Wyszukuje symbol w przestrzeni nazw. */
+SymbolNode     *getSymbol(Namespace * nam, const char *name);
+
+/* Rejestruje dany symbol w tablicy symboli. */
+void registerSymbolNode(Parser *parser, SymbolNode *node);
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/view.c	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,362 @@
+#include "view.h"
+
+static chtype   hi_group[HG_MAXIMUM];
+
+/* Przygotowuje kolory. */
+void
+viewInitColors()
+{
+    init_pair(1, COLOR_BLACK, COLOR_BLACK);
+    init_pair(2, COLOR_BLUE, COLOR_BLACK);
+    init_pair(3, COLOR_CYAN, COLOR_BLACK);
+    init_pair(4, COLOR_RED, COLOR_BLACK);
+    init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
+    init_pair(6, COLOR_GREEN, COLOR_BLACK);
+    init_pair(7, COLOR_YELLOW, COLOR_BLACK);
+    hi_group[HG_TEXT] = A_NORMAL;
+    hi_group[HG_TYPE] = COLOR_PAIR(6);
+    hi_group[HG_IDENT] = COLOR_PAIR(6) | A_BOLD;
+    hi_group[HG_KEYWORD] = A_BOLD;
+    hi_group[HG_OPER] = COLOR_PAIR(3) | A_BOLD;
+    hi_group[HG_CONST] = COLOR_PAIR(5) | A_BOLD;
+    hi_group[HG_STRING] = COLOR_PAIR(7);
+    hi_group[HG_COMMENT] = COLOR_PAIR(5);
+    hi_group[HG_LABEL] = COLOR_PAIR(2) | A_BOLD;
+    hi_group[HG_NUMBER] = COLOR_PAIR(7) | A_BOLD;
+    hi_group[HG_PUNCT] = COLOR_PAIR(3);
+    hi_group[HG_LINENO] = COLOR_PAIR(2);
+    hi_group[HG_ERROR] = COLOR_PAIR(4) | A_BOLD;
+
+}
+
+void
+viewInitShades()
+{
+    hi_group[HG_TEXT] = A_NORMAL;
+    hi_group[HG_TYPE] = A_NORMAL;
+    hi_group[HG_IDENT] = A_BOLD;
+    hi_group[HG_KEYWORD] = A_BOLD;
+    hi_group[HG_OPER] = A_BOLD;
+    hi_group[HG_CONST] = A_BOLD;
+    hi_group[HG_STRING] = A_NORMAL;
+    hi_group[HG_COMMENT] = A_NORMAL;
+    hi_group[HG_LABEL] = A_BOLD;
+    hi_group[HG_NUMBER] = A_BOLD;
+    hi_group[HG_PUNCT] = A_NORMAL;
+    hi_group[HG_LINENO] = A_REVERSE;
+    hi_group[HG_ERROR] = A_BLINK;
+}
+
+/* Tworzy nowy obiekt Viewer. */
+Viewer         *
+newViewer(CodeText * text)
+{
+    Viewer         *view;
+
+    initscr();
+    noecho();
+    view = g_new(Viewer, 1);
+    view->height = LINES-1;
+    view->width = COLS;
+    view->win = newwin(LINES-1, COLS, 0, 0);
+    keypad(view->win, TRUE);
+    scrollok(view->win, FALSE);
+    view->status = newwin(1, COLS,LINES-1,0);
+    scrollok(view->status, FALSE);
+    view->text = text;
+    view->top = text->line_list;
+    view->tag_stack = NULL;
+    view->color = A_NORMAL;
+    view->xpos = 0;
+    view->ypos = 0;
+    view->xshift = 0;
+    view->yshift = 0;
+    view->line = view->top;
+    view->selected = ((CodeLine *)view->line->data)->tag_list;
+    if (has_colors()) {
+        start_color();
+        viewInitColors();
+    } else {
+        viewInitShades();
+    }
+    return view;
+}
+
+/* Niszczy obiekt viewer */
+void
+destroyViewer(Viewer * view)
+{
+    delwin(view->win);
+    g_free(view);
+    endwin();
+}
+
+/* Wyswietla na ekranie aktualna zawartosc. */
+void
+viewUpdate(Viewer * view)
+{
+    GList          *iter;
+
+    view->ypos = view->yshift;
+    for (iter = view->top; view->ypos < view->yshift + view->height; ) {
+        if (iter!=NULL) {
+            viewLine(view, iter->data);
+            iter=iter->next;
+        } else {
+            mvwaddch(view->win, view->ypos - view->yshift, 0, hi_group[HG_LINENO] | '~');
+            wclrtoeol(view->win);
+        }
+        ++(view->ypos);
+    }
+    view->xpos = 0;
+    view->ypos = 0;
+    wrefresh(view->win);
+}
+
+/* Wyswiietla pojedyncza linie w podanym miejscu. */
+void
+viewLine(Viewer * view, CodeLine * line)
+{
+    char           *str;
+    int             xcur;
+    GList          *tag;
+    int             line_no;
+
+    if (line == NULL)
+        return;
+    line_no = view->ypos - view->yshift;
+    if (line_no > view->height)
+        return;
+    tag = line->tag_list;
+
+    if (line->label != NULL) {
+        wattrset(view->win, hi_group[HG_LABEL]);
+        mvwaddnstr(view->win, line_no, 0, line->label->str, 12);
+    } else {
+        wattrset(view->win, hi_group[HG_LINENO]);
+        str = g_strdup_printf("%06d", line->number);
+        mvwaddnstr(view->win, line_no, 0, str, 12);
+        g_free(str);
+    }
+
+    wclrtoeol(view->win);
+    wmove(view->win, line_no, 12 + line->indent);
+    xcur = 12 + line->indent;
+    viewApplyTag(view);
+    for (view->xpos = 0; (line->string->str[view->xpos] != '\0') && (xcur < view->width - 20);
+         ++(view->xpos), ++xcur) {
+        viewCheckEnd(view);
+        while ((tag!=NULL)&&(view->xpos >= ((CodeTag *) tag->data)->xstart)) {
+            viewBegin(view, tag->data);
+            tag = tag->next;
+        }
+        if (line->string->str[view->xpos]!='\n') {
+            waddch(view->win, (view->color) | (line->string->str[view->xpos]));
+        }
+    }
+    viewCheckEnd(view);
+    if (line->comment != NULL) {
+        wattrset(view->win, hi_group[HG_COMMENT]);
+        mvwaddnstr(view->win, line_no, 60, line->comment->str, view->width - 60);
+    }
+}
+
+/* Przewija zawartosc ekranu w gore lub w dol o podana ilosc linii. */
+void
+viewScroll(Viewer * view, int lines)
+{
+    int             i;
+
+    if (lines < 0) {
+        for (i = 0; i > lines; --i) {
+            /* Przewijamy w gore. */
+            if (view->top->prev == NULL)
+                break;
+            view->top = view->top->prev;
+            view->yshift -= 1;
+        }
+    }
+
+    if (lines > 0) {
+        for (i = 0; i < lines; ++i) {
+            /* Przewijamy w dol. */
+            if (view->top->next == NULL)
+                break;
+            view->top = view->top->next;
+            view->yshift += 1;
+        }
+    }
+    /* To mozna bardziej optymalnie zrobic! */
+    viewUpdate(view);
+
+}
+
+void
+viewNextNode(Viewer *view) {
+    for (;;) {
+        while (view->selected == NULL) {
+            if (view->line->next == NULL) {
+                view->line = g_list_first(view->text->line_list);
+                view->selected = ((CodeLine *) view->line->data)->tag_list;
+                return;
+            }
+            view->line = view->line->next;
+            view->selected = g_list_first(((CodeLine *) view->line->data)->tag_list);
+        }
+        if (((CodeTag *)view->selected->data)->node==NULL)
+            view->selected = view->selected->next;
+        else
+            return;
+    }    
+}
+
+void
+viewPrevNode(Viewer *view) {
+    for (;;) {
+        while (view->selected == NULL) {
+            if (view->line->prev == NULL) {
+                view->line = g_list_last(view->text->line_list);
+                view->selected = ((CodeLine *) view->line->data)->tag_list;
+                return;
+            }
+            view->line = view->line->prev;
+            view->selected = g_list_last(((CodeLine *) view->line->data)->tag_list);
+        }
+        if (((CodeTag *)view->selected->data)->node==NULL)
+            view->selected = view->selected->prev;
+        else
+            return;
+    }    
+}
+
+/* Czeka na nacisniecie klawisza. Jesli jest to klawisz sterujacy przegladarka to interpretuje go i czeka na nastepny. W
+ * przeciwnym wypadku zwraca nacisniety klawisz. */
+int
+viewKeyPress(Viewer * view)
+{
+    int             key;
+    char *str;
+    CodeTag *tag;
+
+    viewNextNode(view);
+    for (;;) {
+        wmove(view->status, 0, 0);
+        if (view->selected != NULL) {
+            tag = view->selected->data;
+            if (tag->node!=NULL) {
+                switch (((SymbolNode *)tag->node)->kind) {
+                    case EXPR_NUMBER:
+                        str = g_strdup_printf("Stala liczbowa `%s'.", ((ExprNode *)tag->node)->value->str);
+                        break;
+                    case SYM_VAR_LOCAL:
+                        str = g_strdup_printf("Zmienna lokalna `%s'.", ((SymbolNode *)tag->node)->name->str);
+                        break;
+                    case SYM_CONST:
+                        str = g_strdup_printf("Stala nazwana `%s'.", ((SymbolNode *)tag->node)->name->str);
+                        break;
+                    default:
+                        str = g_strdup_printf("Tag od (%d, %d) do (%d, %d), grupa %d.", tag->xstart, tag->ystart, tag->xend, tag->yend, tag->group);
+                }
+                waddstr(view->status, str);
+                g_free(str);
+            }
+            wclrtoeol(view->status);
+            wrefresh(view->status);
+            wmove(view->win, ((CodeTag *) view->selected->data)->ystart - view->yshift,
+                  12 + ((CodeTag *) view->selected->data)->xstart - view->xshift + ((CodeLine *) view->line->data)->indent);
+            wrefresh(view->win);
+        }
+        key = wgetch(view->win);
+        switch (key) {
+            case KEY_RIGHT:
+                if (view->selected != NULL) {
+                    view->selected = view->selected->next;
+                }
+                viewNextNode(view);
+                break;
+            case KEY_LEFT:
+                if (view->selected != NULL) {
+                    view->selected = view->selected->prev;
+                }
+                viewPrevNode(view);
+                break;
+            case KEY_UP:
+                if (view->line->prev!=NULL) {
+                    view->line = view->line->prev;
+                    view->selected = ((CodeLine *)view->line->data)->tag_list;                    
+                }
+                viewPrevNode(view);
+                break;
+            case KEY_DOWN:
+                if (view->line->next!=NULL) {
+                    view->line = view->line->next;
+                    view->selected = ((CodeLine *)view->line->data)->tag_list;                    
+                }
+                viewNextNode(view);
+                break;
+            case KEY_PPAGE:
+                viewScroll(view, -view->height/3);
+                view->line = view->top;
+                view->selected = ((CodeLine *)view->line->data)->tag_list;
+                break;
+            case KEY_NPAGE:
+                viewScroll(view, view->height/2);
+                view->line = view->top;
+                view->selected = ((CodeLine *)view->line->data)->tag_list;
+                break;
+            default:
+                return key;
+        }
+    }
+}
+
+
+/* Rozpoczyna kolorowanie zgodnie z danym tagiem. */
+void
+viewBegin(Viewer * view, CodeTag * tag)
+{
+    /* Wpychamy tokena na stos. */
+    view->tag_stack = g_list_prepend(view->tag_stack, tag);
+    /* I stosujemy jego kolorowanie. */
+    viewApplyTag(view);
+}
+
+/* Ustawia kolorowanie właściwe dla danego taga. */
+void
+viewApplyTag(Viewer * view)
+{
+    chtype          color;
+    CodeTag        *tag;
+
+    color = hi_group[HG_TEXT];
+    if (view->tag_stack == NULL) {
+        wattrset(view->win, color);
+        view->color = color;
+        return;
+    }
+    tag = view->tag_stack->data;
+    color = hi_group[tag->group];
+    wattrset(view->win, color);
+    view->color = color;
+}
+
+/* Sprawdza czy juz trzeba skoczyc kolorowanie zgodnie z aktualnym tagiem. */
+void
+viewCheckEnd(Viewer * view)
+{
+    GList          *first;
+    CodeTag        *tag;
+
+    if (view->tag_stack == NULL)
+        return;
+
+    tag = view->tag_stack->data;
+    if (((view->ypos == tag->yend) && (view->xpos >= tag->xend)) || (view->ypos > tag->yend)) {
+        /* Zdejmujemy tokena ze stosu. */
+        first = view->tag_stack;
+        view->tag_stack = g_list_remove_link(view->tag_stack, first);
+        g_list_free(first);
+        /* Stosujemy ustawienia poprzedniego. */
+        viewApplyTag(view);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/view.h	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,50 @@
+/* Przegladarka do tekstu kodu programu. */
+
+#ifndef VIEW_H
+#define VIEW_H
+
+#include <glib.h>
+#include <ncurses.h>
+#include "codetext.h"
+
+struct Viewer {
+    WINDOW *win;            /* Okno curses. */
+    WINDOW *status;         /* Linia statusu. */
+    CodeText *text;         /* Tekst ktory ma wyswietlac. */
+    GList *top, *bottom;    /* Granice wyswietlonego tekstu. */
+    int height, width;      /* Wysokosc i szerokosc okna. */
+    GList *tag_stack;          /* Stos tokenów. */
+    int xpos, ypos;         /* Pozycja kursora. */
+    int xshift, yshift;     /* Przesunięcie tekstu. */
+    chtype color;           /* Kolor, w jakim wyswietla znaki. */
+    GList *selected;        /* Aktualnie wybrany token. */
+    GList *line;             /* Aktualnie wybrana linia. */
+};
+typedef struct Viewer Viewer;
+    
+/* Tworzy nowy obiekt Viewer. */
+Viewer * newViewer(CodeText *text);
+
+/* Niszczy obiekt viewer */
+void destroyViewer(Viewer *view);
+
+/* Wyswiietla pojedyncza linie w podanym miejscu. */
+void viewLine(Viewer *view, CodeLine *line);
+
+/* Wyswietla na ekranie aktualna zawartosc. */
+void viewUpdate(Viewer *view);
+
+/* Czeka na nacisniecie klawisza. Jesli jest to klawisz sterujacy przegladarka
+ * to interpretuje go i czeka na nastepny. W przeciwnym wypadku zwraca nacisniety 
+ * klawisz. */
+int viewKeyPress(Viewer *view);
+
+/* Rozpoczyna kolorowanie zgodnie z danym tagiem. */
+void viewBegin(Viewer *view, CodeTag *tag); 
+
+/* Ustawia kolorowanie właściwe dla danego taga. */
+void viewApplyTag(Viewer *view);
+
+/* Sprawdza czy juz trzeba skoczyc kolorowanie zgodnie z aktualnym tagiem. */
+void viewCheckEnd(Viewer *view);
+#endif /* not VIEW_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/write.c	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,67 @@
+#include "write.h"
+
+/* Tworzy nowy obiekt */
+Writer *
+newWriter(CodeText *text, const char *filename)
+{
+    Writer *writ;
+
+    writ = g_new(Writer, 1);
+    writ->xpos = 0;
+    writ->ypos = 0;
+    writ->text = text;
+    writ->line = text->line_list;
+    writ->file = fopen(filename, "w");
+
+    return writ;
+}
+
+/* Niszczy obiekt. */
+void 
+destroyWriter(Writer *writ)
+{
+    fclose(writ->file);
+#if 0
+    destroyCodeText(writ->text); 
+#endif
+    g_free(writ);
+}
+
+/* Przesuwa sie do danej kolumny. */
+void
+writeColumn(Writer *writ, int col)
+{
+    while (writ->xpos<col) {
+        fprintf(writ->file, " ");
+        ++(writ->xpos);
+    }
+}
+
+/* Wypisuje text do pliku. */
+void
+writeFile(CodeText *text, const char *filename)
+{
+    Writer *writ;
+    CodeLine *line;
+
+    writ = newWriter(text, filename);
+    while (writ->line!=NULL) {
+        writ->xpos = 0;
+        line = ((CodeLine *)writ->line->data);
+        if (line->label!=NULL) {
+            fprintf(writ->file, "%s", line->label->str);
+            writ->xpos += line->label->len;
+        }
+        writeColumn(writ, 12+(line->indent)*4);
+        fprintf(writ->file, "%s", line->string->str);
+        writ->xpos += line->string->len;
+        if (line->comment!=NULL) {
+            writeColumn(writ, 80);
+            fprintf(writ->file, "%s", line->comment->str);
+            writ->xpos += line->comment->len;
+        }
+        fprintf(writ->file, "\n");
+        writ->line = g_list_next(writ->line);
+    }
+    destroyWriter(writ);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/write.h	Sat Oct 13 21:14:50 2012 +0200
@@ -0,0 +1,22 @@
+/* Ten fragment sluzy do wypisywania gotowego CodeText do pliku. */
+
+#include <glib.h>
+#include <stdio.h>
+#include "codetext.h"
+
+struct Writer {
+    FILE *file;
+    int xpos, ypos;
+    GList *line;
+    CodeText *text;
+};
+typedef struct Writer Writer;
+
+/* Tworzy nowy obiekt */
+Writer *newWriter(CodeText *text, const char *filename);
+
+/* Niszczy obiekt. */
+void destroyWriter(Writer *writ);
+
+/* Wypisuje text do pliku. */
+void writeFile(CodeText *text, const char *filename);