on the first assignment what about syntax errors. I am looking for a ( or a word Can I assume they won't haveor something like that.Code:for )
Printable View
on the first assignment what about syntax errors. I am looking for a ( or a word Can I assume they won't haveor something like that.Code:for )
Um linuxdude you are going from Pascal to C so you shouldn't be looking for
should be more along the lines ofCode:for (
Code:for i := 0
I figured we could have both types of for loops in the code
Ah, I would guess if there is a syntax error then you ignore it :)
One last question. Will all the for loops conditional part at least be on one line? Also can we assume that variable name isn't a keyword??
Do not assume anything :)
>but when is it due?
As long as it takes everyone to finish. When everyone who signed up in the first month submits and entry, the contest will be judged and the results posted. So feel free to take your time and do a good job. :)
>I figured we could have both types of for loops in the code
Yes. The extension shouldn't effect use of the rest of the language at all. :)
>I would guess if there is a syntax error then you ignore it
If it's a syntax error with the extension then you should handle it appropriately. I don't expect the preprocessor to completely understand anything more than the extension that it implements, but valid extension syntax should usually compile into valid C or C++ code.
>Will all the for loops conditional part at least be on one line?
Not necessarily. C and C++ are free-form languages. ;)
>Also can we assume that variable name isn't a keyword??
Adding a check to ensure that the variable is a valid identifier and not a keyword would be a very good idea. The variable name does count as the syntax of the extension. Besides, such a check is relatively easy anyway. ;)
what about a loop like this. How is it in PASCAL?Do we have to incorporate those. And if so what is the syntax?Code:for(i=0;i<250;x+=2);
or
for(i=0;i<100;x^=20);
Pascal for loops only increment or decrement by 1.
hmm, i'd enter this contest, but i'm too busy working on my actual language, lol. I'll just submit an OST->C++ converter program
>is that what you mean?
That would be a good start, but don't forget that the string has to be able to grow and shrink on its own. So using a statically sized array in the preprocessor doesn't meet the requirements.
I think the approach and method is for you to figure out.
>that means that i will heavily use realloc()?
Well, you don't have to. You could use malloc to allocate an array of some insanely huge size so that realloc or anything similar is unnecessary. ;) As for the actual implementation, that's up to you to decide. You get to weigh different options and choose the one that fits the task best. :)