Skip to content

Commit

Permalink
Parse table generated, parse tree in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
SinghCoder committed Feb 22, 2020
2 parents 920803d + 980fe17 commit c275053
Show file tree
Hide file tree
Showing 14 changed files with 583 additions and 1,039 deletions.
23 changes: 20 additions & 3 deletions Code/driver.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "lexer.h"
#include "parser.h"
#include "treeADT.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
setvbuf(stdout, NULL, _IONBF, 0);
FILE *source = fopen("test.txt", "r");
lexer_init();
// printf("lexer initialized %d\n", lookup_table[0].present);
Expand All @@ -16,13 +18,28 @@ int main() {
// print_token_stream(source);

FILE *fptr = fopen("grammar.txt", "r");
if (fptr == NULL) {
if (fptr == NULL)
{
perror("fopen");
}
grammar_fill(fptr);
// populate_first_sets();

populate_first_sets();

populate_follow_sets();

createParseTable();
// ull *fset = get_rule_first_set(grammar[0].head);
// print_rule_fset(fset);

// print_first_sets();
// print_follow_sets();

// print_grammar();
free(source);
// print_parse_table();

tree_node* ptr = parseInputSourceCode(source);

// free(source);
printf(".......end.......\n");
} // end of main
2 changes: 1 addition & 1 deletion Code/hashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef struct {

int fastModExp(int a, int b, int m);

typedef hash_element *hash_table;
typedef hash_element *hash_table; // change to static allocation

hash_table init_hash_table();

Expand Down
35 changes: 0 additions & 35 deletions Code/junk1.c

This file was deleted.

44 changes: 0 additions & 44 deletions Code/junkfile2.c

This file was deleted.

Loading

0 comments on commit c275053

Please sign in to comment.