Merge pull request #25 from UB-CSE443/Sprint2-Infrastructure-FE-t#30
Organization + Task 1 objectives t#30
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,3 +4,6 @@ alpha
|
|||||||
flex.h
|
flex.h
|
||||||
grammar.tab.c
|
grammar.tab.c
|
||||||
grammar.tab.h
|
grammar.tab.h
|
||||||
|
.vscode
|
||||||
|
out
|
||||||
|
src
|
36
Makefile
36
Makefile
@ -25,27 +25,20 @@ debug: CFLAGS += -DDEBUG=1
|
|||||||
debug: clean compiler
|
debug: clean compiler
|
||||||
|
|
||||||
test:
|
test:
|
||||||
./$(EXE) ./tests/test_comments.alpha
|
./$(EXE) -tok ./tests/sprint1/test_comment_fix1.alpha
|
||||||
./$(EXE) ./tests/test_generalTokenTest.alpha
|
./$(EXE) -tok ./tests/sprint1/test_comment_fix2.alpha
|
||||||
./$(EXE) ./tests/test_keywords.alpha
|
./$(EXE) -tok ./tests/sprint1/test_comment_issues.alpha
|
||||||
./$(EXE) ./tests/test_operators.alpha
|
./$(EXE) -tok ./tests/sprint1/test_comments.alpha
|
||||||
./$(EXE) ./tests/test_otherpunc.alpha
|
./$(EXE) -tok ./tests/sprint1/test_general_token.alpha
|
||||||
./$(EXE) ./tests/test_simpleIntTest.alpha
|
./$(EXE) -tok ./tests/sprint1/test_keywords.alpha
|
||||||
./$(EXE) ./tests/test_simpleLiterals.alpha
|
./$(EXE) -tok ./tests/sprint1/test_operators.alpha
|
||||||
./$(EXE) ./tests/test_real_alpha_file.alpha
|
./$(EXE) -tok ./tests/sprint1/test_other_punc.alpha
|
||||||
./$(EXE) ./tests/test_real_alpha_2.alpha
|
./$(EXE) -tok ./tests/sprint1/test_punc_grouping.alpha
|
||||||
./$(EXE) -tok ./tests/test_comments.alpha
|
./$(EXE) -tok ./tests/sprint1/test_real_alpha_file1.alpha
|
||||||
./$(EXE) -tok ./tests/test_generalTokenTest.alpha
|
./$(EXE) -tok ./tests/sprint1/test_real_alpha_file2.alpha
|
||||||
./$(EXE) -tok ./tests/test_keywords.alpha
|
./$(EXE) -tok ./tests/sprint1/test_simple_int.alpha
|
||||||
./$(EXE) -tok ./tests/test_operators.alpha
|
./$(EXE) -tok ./tests/sprint1/test_simple_literals.alpha
|
||||||
./$(EXE) -tok ./tests/test_otherpunc.alpha
|
./$(EXE) -tok ./tests/sprint1/test_variables.alpha
|
||||||
./$(EXE) -tok ./tests/test_simpleIntTest.alpha
|
|
||||||
./$(EXE) -tok ./tests/test_simpleLiterals.alpha
|
|
||||||
./$(EXE) -tok ./tests/test_real_alpha_file.alpha
|
|
||||||
./$(EXE) -tok ./tests/test_real_alpha_2.alpha
|
|
||||||
./$(EXE) -tok -st ./tests/test_real_alpha_2.alpha
|
|
||||||
./$(EXE) -st -tok ./tests/test_operators.alpha
|
|
||||||
./$(EXE) -st ./tests/test_keywords.alpha
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
@ -56,3 +49,4 @@ clean:
|
|||||||
rm -f grammar.tab.c
|
rm -f grammar.tab.c
|
||||||
rm -f grammar.tab.h
|
rm -f grammar.tab.h
|
||||||
rm -f *.st
|
rm -f *.st
|
||||||
|
rm -rf out
|
@ -52,6 +52,13 @@
|
|||||||
%token RESERVE 613
|
%token RESERVE 613
|
||||||
%token RELEASE 614
|
%token RELEASE 614
|
||||||
%token COMMENT 700
|
%token COMMENT 700
|
||||||
%%
|
|
||||||
|
|
||||||
|
%%
|
||||||
|
DBLOCK: %empty;
|
||||||
|
|
||||||
|
FUNCTION_DECLARATION: FUNCTION ID COLON ID
|
||||||
|
| EXTERNAL FUNCTION ID COLON ID
|
||||||
|
;
|
||||||
|
RECORD_DECLARATION: TYPE ID COLON DBLOCK;
|
||||||
|
ARRAY_DECLARATION: ID ASSIGN RESERVE ID L_PAREN C_INTEGER R_PAREN;
|
||||||
%%
|
%%
|
||||||
|
9
runner.c
9
runner.c
@ -115,10 +115,19 @@ int new_file(char *arg, char *alpha) {
|
|||||||
int type_len;
|
int type_len;
|
||||||
const char *basename = alpha;
|
const char *basename = alpha;
|
||||||
const char *slash = strchr(alpha, '/');
|
const char *slash = strchr(alpha, '/');
|
||||||
|
|
||||||
while (slash != NULL) {
|
while (slash != NULL) {
|
||||||
basename = slash + 1;
|
basename = slash + 1;
|
||||||
slash = strchr(basename, '/');
|
slash = strchr(basename, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mkdir("./out", 0777);
|
||||||
|
|
||||||
|
char *new_basename = calloc(strlen(basename) + 5, sizeof(char));
|
||||||
|
strcpy(new_basename, "./out/");
|
||||||
|
strcat(new_basename, basename);
|
||||||
|
basename = new_basename;
|
||||||
|
|
||||||
if (strcmp(arg, "-tok") == 0) {
|
if (strcmp(arg, "-tok") == 0) {
|
||||||
type_len = TOK_LEN;
|
type_len = TOK_LEN;
|
||||||
} else if (strcmp(arg, "-st") == 0) {
|
} else if (strcmp(arg, "-st") == 0) {
|
||||||
|
1
runner.h
1
runner.h
@ -12,6 +12,7 @@
|
|||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "symbol_table.h"
|
#include "symbol_table.h"
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
extern int line_number, column_number;
|
extern int line_number, column_number;
|
||||||
extern char *yytext;
|
extern char *yytext;
|
||||||
|
1
tests/sprint1/test_comment_fix1.alpha
Normal file
1
tests/sprint1/test_comment_fix1.alpha
Normal file
@ -0,0 +1 @@
|
|||||||
|
(***)
|
1
tests/sprint1/test_comment_fix2.alpha
Normal file
1
tests/sprint1/test_comment_fix2.alpha
Normal file
@ -0,0 +1 @@
|
|||||||
|
(*(**)*)
|
@ -1,23 +0,0 @@
|
|||||||
This is a test
|
|
||||||
9combined 7okens
|
|
||||||
12345
|
|
||||||
893247892
|
|
||||||
combined'DueToUnknownChar _validtoken __validtoken1 _valid_token2 validToken3_
|
|
||||||
true false
|
|
||||||
null while !wrong if when
|
|
||||||
else type function
|
|
||||||
return external as
|
|
||||||
string _NOte_that_was_not_reserved
|
|
||||||
([)]{}:;,->"\
|
|
||||||
+-*/%
|
|
||||||
<=
|
|
||||||
:=
|
|
||||||
"This is not a valid
|
|
||||||
String"
|
|
||||||
"This is a valid String"
|
|
||||||
!|
|
|
||||||
..
|
|
||||||
(* this is a comment *)
|
|
||||||
(*Not a comment
|
|
||||||
$^&
|
|
||||||
>
|
|
@ -1,17 +0,0 @@
|
|||||||
+
|
|
||||||
-
|
|
||||||
*
|
|
||||||
/
|
|
||||||
\
|
|
||||||
%
|
|
||||||
<
|
|
||||||
>
|
|
||||||
=
|
|
||||||
:=
|
|
||||||
=:
|
|
||||||
:
|
|
||||||
=
|
|
||||||
!
|
|
||||||
&
|
|
||||||
|
|
|
||||||
.
|
|
Reference in New Issue
Block a user