Posted: Thu Aug 26, 2004 9:28 am Post subject: Simple While program
Is this right, I think it is but there seems to be something I cant put my finger on, it's a restrited form of a while program, is the syntax correct compared with the grammar??
Posted: Thu Aug 26, 2004 2:06 pm Post subject: (No subject)
This is in java?????
I have never seen some one define what an int is or var like this in java nor use := and ::= quite like that in java. Ethere this is somting way behond me or it is not standered sun java.
Also i am not shure of the logic behind the code, it seems to me that all the varbiles will be the same and it will make a infent loop.
Is there more code u are not show us? (b/c the one while loop is not closed)
Also are u shure this is java, b/c u posted this in the java help section...
Computer Science CanadaHelp with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
wtd
Posted: Thu Aug 26, 2004 2:18 pm Post subject: (No subject)
Java uses "=" for assignment, rather than ":=". Otherwise the posted code is correct.
"
Cervantes
Posted: Thu Aug 26, 2004 3:20 pm Post subject: (No subject)
Hacker Dan wrote:
Also are u shure this is java, b/c u posted this in the java help section...
err, this was originally in the Turing Help section, so I guess a mod moved it, and deleted zster's reply. Anywho, I don't think necromancer posted it in the Java forum himself.
Dan
Posted: Thu Aug 26, 2004 3:48 pm Post subject: (No subject)
wtd wrote:
Java uses "=" for assignment, rather than ":=". Otherwise the posted code is correct.
"
and the or in the while loop
It kind of looks like a mix between java and turing. But even if it is i still do not see how/why INT and VAR and all that stuff at the top is being declaered or why the while loops are there and not just a normal loop if it the values will allways be the same....
Computer Science CanadaHelp with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Tony
Posted: Thu Aug 26, 2004 3:51 pm Post subject: (No subject)
Posted: Mon Sep 06, 2004 9:49 am Post subject: (No subject)
Cervantes wrote:
Hacker Dan wrote:
Also are u shure this is java, b/c u posted this in the java help section...
err, this was originally in the Turing Help section, so I guess a mod moved it, and deleted zster's reply. Anywho, I don't think necromancer posted it in the Java forum himself.
I realised what I did then I posted it in Java, and yes it is Java
tony wrote:
??what the...
Doh, yeah pretty obvious, most things are when their pointed out
So apart from not being closed and the possibility that there is no need for a while loop when a normal loop will suffice?? It's ok right, the declerations aside, because well there confusing
rizzix
Posted: Mon Sep 06, 2004 12:00 pm Post subject: (No subject)
The declarations are NOT java. The assignements are NOT java. What ever language your using is most certainly not java. it appears to be delphi or something.. (but i would not know,, its alien to me anyways) but its definately not java.
---
btw you can;t challenge us on this fact.. cuz we've been programming java for quite sometime and continue to do so.. we know all the new and latest modifications to the java language.. but what you have posted up there is just simply not java.
Sponsor Sponsor
wtd
Posted: Mon Sep 06, 2004 1:36 pm Post subject: (No subject)
rizzix wrote:
The declarations are NOT java. The assignements are NOT java. What ever language your using is most certainly not java. it appears to be delphi or something.. (but i would not know,, its alien to me anyways) but its definately not java.
---
btw you can;t challenge us on this fact.. cuz we've been programming java for quite sometime and continue to do so.. we know all the new and latest modifications to the java language.. but what you have posted up there is just simply not java.
What he posted first was a BNF grammar. It describes the syntax of a programming language. The latter was quasi-Java, just using the Pascal-esque ":=" and "or" instead of "=" and "||".
rizzix
Posted: Mon Sep 06, 2004 1:52 pm Post subject: (No subject)
o i c.. BNF!! shooot!! that explains those assignments.
but in any case he did ask me if it was java.. dosent matter if he's trying to describe the java grammar. its definately not java now is it? his descriptions are slightly wrong here and there.
Dan
Posted: Mon Sep 06, 2004 3:07 pm Post subject: (No subject)
so i think what he ment was:
code:
while(true)
{
int x = 18;
while(x>0)
{
int u = x+4;
x++;
}
int y = ((u+x)-(u-1));
}
that is simplfing the staments down since they will allways be that no matter what. The y = part will never run b/c it is out side of the 2nd infent loop so x and u will keep going up intill u/x over loads the memory and then will ether crash the app or go to the negtives, if java dose go to negtives then the 2nd loop will exit and y will get a realy messed up number. then the 1st loop will start agaen and x will be reset back to 18 and u back x+4. And this will keep going on forever and y will allways have the same value.
Edit: P.S. if the lang only has the values for 0-9 for ints then it will crash at the 1st decleration of the x b/c 18 is not one of thos numbers....
Computer Science CanadaHelp with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
wtd
Posted: Mon Sep 06, 2004 3:42 pm Post subject: (No subject)
The gammar, unless I'm really rusty, says that numbers can be composed of any digits between 0 and 9. It doesn't say it can only be one of those.
For what it's worth, I really like Ada/Ruby integers, where _ is an acceptable character.
code:
my_int = 1_000_000
Or
code:
My_Int : Integer := 1_000_000;
Vs.
code:
int myInt = 1000000;
Ada's syntax for different bases is nice too.
code:
My_Binary_Number : Integer := 2#10101101#;
rizzix
Posted: Mon Sep 06, 2004 4:15 pm Post subject: (No subject)
wtd wrote:
Ada's syntax for sidderent bases is nice too.
code:
My_Binary_Number : Integer := 2#10101101#;
what do u mean? heh sorry i dunt understand
but if its what i think it is.. turing supports that too. lol.. hmm so does java, c++/c but not base2 only 8 and 16 i think.. hmm perl supports base2.
Dan
Posted: Mon Sep 06, 2004 6:07 pm Post subject: (No subject)
wtd wrote:
The gammar, unless I'm really rusty, says that numbers can be composed of any digits between 0 and 9. It doesn't say it can only be one of those.
Ah ic, it is me that is most likey wrong, i miss undestud what it ment but still u will get the overflow problem in that progam b/c of the inf loop...
Computer Science CanadaHelp with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
wtd
Posted: Mon Sep 06, 2004 6:07 pm Post subject: (No subject)
rizzix wrote:
wtd wrote:
Ada's syntax for sidderent bases is nice too.
code:
My_Binary_Number : Integer := 2#10101101#;
what do u mean? heh sorry i dunt understand
but if its what i think it is.. turing supports that too. lol.. hmm so does java, c++/c but not base2 only 8 and 16 i think.. hmm perl supports base2.