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.

Printable View

- 11-15-2008audinueSyntax design...
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. - 11-15-2008laserlight
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.

- 11-15-2008brewbuck
- 11-16-2008audinueQuote:

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.

Quote:

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?

Code:`1. 123321, 223311, 1024, 4096`

2. 0x00ff, 0x0123, 0x1212a

3. 0.1232, 123.121, 0.0001231

Thank you. - 11-16-2008CornedBee
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. - 11-16-2008tabstop
And in C99, there's also the exciting "floating point numbers in hexadecimal scientific notation".

- 11-16-2008audinueQuote:

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".

- 11-16-2008tabstop
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. - 11-16-2008audinue
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

- 11-16-2008tabstop
Because numbers that start with zero are in octal notation.

- 11-17-2008P4R4N01D
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 - 11-17-2008laserlightQuote:

Originally Posted by**P4R4N01D**