Mmm... anyone know what kind of diagram is this?
I saw something like this on ORACLE SQL Reference...
http://audinue.navhost.com/Draft.jpg
Maybe I can use it to design a programming language syntax.
Thanks in advance.
Mmm... anyone know what kind of diagram is this?
I saw something like this on ORACLE SQL Reference...
http://audinue.navhost.com/Draft.jpg
Maybe I can use it to design a programming language syntax.
Thanks in advance.
It is, uh, a syntax diagram. They arguably are an easier to trace alternative to EBNF, but a downside is that they are harder to translate and feed into parser generators.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Eww.. thanks for the answer laserlight! *_*It is, uh, a syntax diagram. They arguably are an easier to trace alternative to EBNF, but a downside is that they are harder to translate and feed into parser generators.
I drew it myself using Visio, there is a lot of mistake in it since I don't know what Syntax Diagram is.In this case the diagram looks like it was generated by Antlr, so it probably started out in parser form in the first place.
Umm... can I add the second silly question?
We know three types of regular numbers in C...
Can you tell me what are their name please?
I know the second numbers are known as "hexadecimal numbers"...Code:1. 123321, 223311, 1024, 4096 2. 0x00ff, 0x0123, 0x1212a 3. 0.1232, 123.121, 0.0001231
Thank you.
The first are integers in decimal notation.
The second are integers in hexdecimal notation.
The third are floating point numbers in point notation.
There's also integers in octal notation and floating point numbers in scientific notation.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
And in C99, there's also the exciting "floating point numbers in hexadecimal scientific notation".
Any example please?There's also integers in octal notation and floating point numbers in scientific notation.
And in C99, there's also the exciting "floating point numbers in hexadecimal scientific notation".
You've never seen scientific notation before?
Anyway, octal always starts with 0, so 037 is octal.
Scientific notation is what it is: 4.75e128
And the funky hex stuff uses hex for the significand, but decimal for the exponent, so that same number would look like 0x4.cp128.
Oh my god... I never saw those thing.
o_O... Incredible.
And yet another silly question...
I just curious of decimal notation...
Why we not allowed to start a number from 0?
For instance: 0000123, 00523
It will give a clear looks of constants instead of hexadecimal number.
Code:#define ERROR_XXX 00001 #define ERROR_XXXX 00082 #define ERROR_XYZ 00103 #define ERROR_YYY 00127
Last edited by audinue; 11-16-2008 at 07:39 AM.
Because numbers that start with zero are in octal notation.
Last edited by tabstop; 11-16-2008 at 07:45 AM.
That "syntax diagram" looks like a failed Railroad Diagram. I would find EBNF easier to understand than those ovals and arrows. whats w/ those arrows anyway, they certainatly don't make it easier to follow.
Also, I didn't know that numbers that start w/ 0 are in base 8. I am suprised the 0s don't get truncated. Still, in maths (outside of C) 00001 is exactly the same as 1, becasue one has to explicitly define if the number is in a different base to 10 which is default. It works well though as it doesn't limit either number base.
So something to remember: 0x~ = hex, 0~ = octal, where ~ represents a number
long time no C; //seige
You miss 100% of the people you don't C;
Code:if (language != LANG_C && language != LANG_CPP) drown(language);
I believe that "syntax diagram" and "railroad diagram" are synonyms. The arrows allow the reader to distinguish between repetition and alternatives.Originally Posted by P4R4N01D
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)