Skip to content
  1. Apr 29, 2020
  2. Apr 28, 2020
    • cjsr4d's avatar
      Semantic Error Handled · 7e50fb41
      cjsr4d authored
      Create a function that handles semantic error once called based on the string that is passed.
      7e50fb41
  3. Apr 27, 2020
    • cjsr4d's avatar
      Symbol Table Added · 9e361812
      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.
      9e361812
  4. Apr 23, 2020
    • cjsr4d's avatar
      Old file · 75c5231e
      cjsr4d authored
      75c5231e
    • cjsr4d's avatar
      Merge branch 'Tree' into P2 · 3be53567
      cjsr4d authored
      # Conflicts:
      #	Projects/P2/main.c
      #	Projects/P2/parser.c
      #	Projects/P2/productions.c
      3be53567
    • cjsr4d's avatar
      First keywords were added · d7bcad71
      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.
      d7bcad71
    • cjsr4d's avatar
      Fixed adding of children · 72bb011c
      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.
      72bb011c
    • cjsr4d's avatar
      Federal SEGFAULT Relief Fund · da58eb25
      cjsr4d authored
      Attempting to run addToken on Nodes that were uninitialized was causing SEGFAULTs. newNode was reconfigured to initialize all the values in Node
      da58eb25
    • cjsr4d's avatar
      Removed Error Causing Conflicts · 781cb908
      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
      781cb908
    • cjsr4d's avatar
      Build a Tree in P2 · 0b06fd4c
      cjsr4d authored
      Each production now makes a node and attaches their children. The children all return nodes that contain their children.
      0b06fd4c
  5. Apr 22, 2020
    • cjsr4d's avatar
      Build a Tree in P2 · 925b2bcc
      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.
      925b2bcc
    • cjsr4d's avatar
      Refitting P0 to Accommodate P2 · 6bc06fab
      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
      6bc06fab
  6. Apr 18, 2020
    • cjsr4d's avatar
      New Token Names · 68ffcd84
      cjsr4d authored
      Simple switches or a switch to distinguish from another potential token type
      68ffcd84
    • cjsr4d's avatar
      References for P2 · ddb488a3
      cjsr4d authored
      ddb488a3
    • cjsr4d's avatar
      More Productions · 98aa4794
      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()
      98aa4794
  7. Apr 17, 2020
    • cjsr4d's avatar
      HWs, Reference, Lectures, etc. · 00edd9b4
      cjsr4d authored
      00edd9b4
    • cjsr4d's avatar
      References for P2 · 7a853643
      cjsr4d authored
      7a853643
    • cjsr4d's avatar
      Beginnings of the Parser Implementation · 3a21094f
      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
      3a21094f
    • cjsr4d's avatar
      Reflecting changes for P2 in P1 · 4e16d932
      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
      4e16d932
  8. Apr 14, 2020
  9. Apr 12, 2020
  10. Apr 11, 2020
  11. Apr 06, 2020
    • cjsr4d's avatar
      Changed specifics around operators as a whole · 8cb4b271
      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
      *
      8cb4b271
    • cjsr4d's avatar
      Changed specifics around operators as a whole · c0ab8133
      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
      c0ab8133
    • cjsr4d's avatar
      Merge branch 'memoryOperators' into operators · ee30cceb
      cjsr4d authored
      # Conflicts:
      #	Projects/P1/scanner.c
      ee30cceb
    • cjsr4d's avatar
      Added memory operators · 8d566baa
      cjsr4d authored
      8d566baa
  12. Apr 05, 2020
    • cjsr4d's avatar
      Improved lookahead · 111759db
      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.
      111759db
    • cjsr4d's avatar
      Added functionality for memory operator and moved table comment to README.md · bc146717
      cjsr4d authored
      All the particulars for the memory operators are set up. The next step is testing.
      bc146717
    • cjsr4d's avatar
      Delimiters set up and operational · 3aff5eed
      cjsr4d authored
      All the particulars to handle having delimiters in the language are in place.
      3aff5eed
    • cjsr4d's avatar
      Math operators are operational · d3835bb6
      cjsr4d authored
      The only changes were made to keywordCheck(). The tk_ prefix is now added to the string.
      d3835bb6
    • cjsr4d's avatar
      Places for mathematical operators · 35131dab
      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()
      35131dab
    • cjsr4d's avatar
      Output and verification · fd41660f
      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.
      fd41660f
  13. Apr 04, 2020
    • cjsr4d's avatar
      Boolean tokens · c01421c2
      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.
      c01421c2
    • cjsr4d's avatar
      < and > Handled · cd908d79
      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()
      cd908d79
    • cjsr4d's avatar
      Added functionality for 3 new operators · f4c373b3
      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
      f4c373b3
  14. Apr 03, 2020