I'm working on an assembler for a "simple virtual machine", and because of data mapping concerns, I have to basically take multiple runs through the input.
The input is given in stdin. Now, I'm thinking of two options.
1) create a structure which will hold possibly valid commands, ie, lines which are not blank (all whitespaces)
or are not lines which lead with comments.
2) use getc to take in all characters and an equivalent amount of ungetc commands to move the "stdin pointer" back to
position zero.
Which of these above options do you think is more efficient? Do you think a structure holding a possible tens of thousands of strings comprised of an order of magnitude greater amount of characters to be too large. ie, it's so big that it's a waste of resources?
The input is given in stdin. Now, I'm thinking of two options.
1) create a structure which will hold possibly valid commands, ie, lines which are not blank (all whitespaces)
or are not lines which lead with comments.
2) use getc to take in all characters and an equivalent amount of ungetc commands to move the "stdin pointer" back to
position zero.
Which of these above options do you think is more efficient? Do you think a structure holding a possible tens of thousands of strings comprised of an order of magnitude greater amount of characters to be too large. ie, it's so big that it's a waste of resources?