- Apr 29, 2020
-
-
cjsr4d authored
-
- Apr 28, 2020
-
-
cjsr4d authored
Create a function that handles semantic error once called based on the string that is passed.
-
- Apr 27, 2020
-
-
cjsr4d authored
Created a symbol table with an array of declared identifiers and a size. The variable is inserted into the table if it is unique and an error is output if it is not.
-
- Apr 23, 2020
-
-
cjsr4d authored
-
cjsr4d authored
# Conflicts: # Projects/P2/main.c # Projects/P2/parser.c # Projects/P2/productions.c
-
cjsr4d authored
The first keyword for some productions wasn't being added to the children of the parent node so they never showed up in the printed out tree. That was fixed by creating a node for them and attaching them to the parent node for their production.
-
cjsr4d authored
The sizeof() function on a Node's children would return a number that made no sense. The size of the struct Node was bigger that the size of the children array so nothing would copy over. The solution was to create a new array, copy all the children from the parentNode children array and add the newest child onto the end. Once this was done the address that holds all the children was assigned to the parentNode, thus adding the new child. Printing the tree also requires the printf function to be outside of the for loop or it will print the parent each time.
-
cjsr4d authored
Attempting to run addToken on Nodes that were uninitialized was causing SEGFAULTs. newNode was reconfigured to initialize all the values in Node
-
cjsr4d authored
The files for P0 will have to be restored from the repository but for now the previous implementations are commented out. They were causing errors that had nothing to do with P2. newNode was adapted to fit the purposes of P2
-
cjsr4d authored
Each production now makes a node and attaches their children. The children all return nodes that contain their children.
-
- Apr 22, 2020
-
-
cjsr4d authored
All productions have been created and operate as intended Each production now makes a node and attaches their children. The children all return nodes that contain their children.
-
cjsr4d authored
Created a new Node type that can hold more than 2 children. This is for the productions whose children are the products. All functions that apply were made to be pass by reference. Functions that output the tree and add to the tree were re-tooled to handle more than one child
-
- Apr 18, 2020
-
-
cjsr4d authored
Simple switches or a switch to distinguish from another potential token type
-
cjsr4d authored
-
cjsr4d authored
* The tokenIs() function slims down on the typing and expresses what is being checked. * Added productions: * varsProd() * exprProd() * blockProd() * statsProd() * mStatProd() * statProd() * outProd()
-
- Apr 17, 2020
-
-
cjsr4d authored
-
cjsr4d authored
-
cjsr4d authored
parser.c -------- * Lookahead at the first token, dive into the first production * The parser uses recursive descent parsing so when the parser is done the last token should be EOF * If the token is not EOF an error occurred parserIO.c ---------- * The handling of the file has been taken care of by the scanner since it's the part that needs to read from the file, not the parser * parserError will handle any error messages based on the input productions.c ------------- * Every program starts at the programProduction function. * The type of token is predicted based on the lookahead then the appropriate function is jumped into * The basic productions all contained one terminal, identifier * This is a proof of concept for the parser, hence the simple productions
-
cjsr4d authored
scannerIO.c ------------- * Name changed to reflect where it is and what purpose it serves * Rolled getFile and getFileName into one function called getFile. * This combination meant that the fileName string didn't need to be returned. It was instead used to set the global file pointer, stream scanner.c --------- * Removed all "tk_"s in the token types. They were unnecessary. * Renamed tokenChar to streamCharacter since the character is coming from the stream and not the token * Implemented lookahead in scanner.c instead of in the driver. * classToken was meant to be a temporary name but it stuck. It's been changed for simplicity testScanner.c ------------- * All the previous functions were rolled up into getFile(). * The lookahead functionality was moved to scanner.c
-
- Apr 14, 2020
- Apr 12, 2020
-
-
cjsr4d authored
-
- Apr 11, 2020
- Apr 06, 2020
-
-
cjsr4d authored
* Instead of checking the ASCII values of tokenChar and evaluating the contents that way, a isdigit(), isalpha, and isspace() is used. * Getting WS after '}' is acceptable and has been changed from being an error * When nextState is an error code and then assigned to currState the next line travels FSA based on that error code. A check of currState's polarity is made and if it passes nextState can be evaluated * Returns EOF token if the program ends without a second comment character * Switch line and column to read more intuitively *
-
cjsr4d authored
* Instead of checking the ASCII values of tokenChar and evaluating the contents that way, a isdigit(), isalpha, and isspace() is used. * Getting WS after '}' is acceptable and has been changed from being an error * When nextState is an error code and then assigned to currState the next line travels FSA based on that error code. A check of currState's polarity is made and if it passes nextState can be evaluated
-
cjsr4d authored
# Conflicts: # Projects/P1/scanner.c
-
cjsr4d authored
-
- Apr 05, 2020
-
-
cjsr4d authored
scanner.c --------- * Added EOF to to character classification and token type logic * An error is output when an unrecognized character is approached * Character is checked and processed before any logic is done to determine the token type. This is to perform a true lookahead, a function that was done in a lackluster way before this edit.
-
cjsr4d authored
All the particulars for the memory operators are set up. The next step is testing.
-
cjsr4d authored
All the particulars to handle having delimiters in the language are in place.
-
cjsr4d authored
The only changes were made to keywordCheck(). The tk_ prefix is now added to the string.
-
cjsr4d authored
InputOutput.c ------------- * The error code for an incorrectly formed mathematical operator is -13. The tokenError() function can now handle that exception scanner.c --------- * The FSA table, both variable and comment, had mathematical operators added to them. * When the end state for each operator is reached the token code is now available to return from the switch statement found in scanner() * Mathematical operators were added to the enumerator in charType()
-
cjsr4d authored
Parts of scanner.c are changed to no longer grab the whole word when an error is found. Whenever an error was found and no space followed the error code was being used to index the FSA table. Error codes are negative so this caused a SEGFAULT every time. InputOutput.c was reworded so that it doesn't allude to the whole word being grabbed. scanner.c --------- * If the nextState isn't negative then the classToken Token needs to be updated and the next character needs to be taken from the stream * When an error is found the previous functionality allowed for the program to keep pulling from the stream and updated the token. This wasn't tenable anymore so it was removed. The output for the error only states that there was an error around the character that caused the error.
-
- Apr 04, 2020
-
-
cjsr4d authored
scanner.c --------- * The greater than and less than operators are singular in representation. To allow them to be used without spaces surrounding them the character that determines the next state needs to be returned to the stream. * The character from the stream does not need to be returned for the '==' token. Some minor changes were made to InputOutput.c P1Bools.sp2020 was added to test the boolean operators.
-
cjsr4d authored
scanner.c --------- * With regards to '<' and '>', no issues arose during testing * A SEGFAULT occurs once '=' is tested * The enumerator is utilized with return statements based on the passed character in charType()
-
cjsr4d authored
scanner.c --------- * Table was extended * Without spaces the operator token was being consumed so ungetc() was added to replace the character once an accepting state was reached * Accepting states 1003, 1004, 1005 were added to handle, less than, greater than, and equivalent to operators respectively
-
- Apr 03, 2020