Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Group 2 Program 2
- Paul Maclean- mac7537@calu.edu
- Mike Gorse- gor9632@calu.edu
- Robert Breckenridge- bre6896@calu.edu
- Chase Smith- smi8808@calu.edu
- CSC 460
- Language Translations
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "scanner.h"
- int main(int argc, char *argv[]) {
- typedef enum{};
- FILE *fp;
- //Reading from a file
- char *fgets( char *buf, int n, FILE *fp );
- //Writing to a file, listing file? and temp file?
- fp = fopen("...", "w+");
- fprintf(fp, "...\n"); //not sure what you guys want to put here.
- fputs("...\n", fp); //could we use the file operations from program 1?
- fclose(fp);
- return 0;
- };
- do
- {
- the.token = scanner(token.buffer, in.file, out.file);
- token.ident(the.token, token.symbol); //token.sybol = string
- 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
- }while(the.token! = SCANEOF);
- //THIS IS ALL JUST FROM MY NOTES
- switch(the.token) //decoding numerated tokens
- {
- case BEGIN: strcpy(token.symbol, "BEGIN");
- break;
- case '(': strcpy(token.symbol, "LPAREN");
- break;
- case ')': strcpy(token.symbol, "RPAREN");
- break;
- case END: strycpy(token.symbol, "END");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement