Advertisement
chasesmith20

main 2/11

Feb 11th, 2020
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.29 KB | None | 0 0
  1. /*Group 2 Program 2
  2. Paul Maclean- mac7537@calu.edu
  3. Mike Gorse- gor9632@calu.edu
  4. Robert Breckenridge- bre6896@calu.edu
  5. Chase Smith- smi8808@calu.edu
  6.  
  7. CSC 460
  8. Language Translations
  9. */
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include "scanner.h"
  14.  
  15. int main(int argc, char *argv[]) {
  16.    
  17.     typedef enum{};
  18.    
  19.    FILE *fp;
  20. //Reading from a file
  21. char *fgets( char *buf, int n, FILE *fp );
  22.  
  23. //Writing to a file, listing file? and temp file?
  24.    fp = fopen("...", "w+");
  25.    fprintf(fp, "...\n");            //not sure what you guys want to put here.
  26.    fputs("...\n", fp);              //could we use the file operations from program 1?
  27.    fclose(fp);
  28.    
  29.    return 0;
  30.     };
  31.    
  32.     do
  33.     {
  34.         the.token = scanner(token.buffer, in.file, out.file);
  35.         token.ident(the.token, token.symbol);                   //token.sybol = string
  36.        
  37.         fprintf(out.file, "\n Token Number: %3d\t, Token Type: %10s\t\t, Token: %s", the.token, token.symbol, token.buffer);        //THIS MAY BE WRONG, MY NOTES ARE WONKY
  38.     }while(the.token! = SCANEOF);
  39.    
  40.     //THIS IS ALL JUST FROM MY NOTES
  41.     switch(the.token)   //decoding numerated tokens
  42.     {
  43.         case BEGIN: strcpy(token.symbol, "BEGIN");
  44.             break;
  45.        
  46.         case '(': strcpy(token.symbol, "LPAREN");
  47.             break;
  48.        
  49.         case ')': strcpy(token.symbol, "RPAREN");
  50.             break;
  51.        
  52.         case END: strycpy(token.symbol, "END");
  53.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement