Computing > Programming

B# programming language

<< < (7/7)

rstofer:
What I found amazing about Wirth's syntax diagrams and his P4 compiler was the correlation between the two.  The compiler block outline was derived exactly from the syntax diagrams.  In my view, the syntax diagrams are far superior to BNF or EBNF.  If you have all the diagrams, you can start writing a recursive descent compiler directly.

The ability to do this a predicated on a particular non-ambiguous grammar but that is not a limitation as the language clearly proves.

SiliconWizard:

--- Quote from: rstofer on September 11, 2019, 10:35:46 pm ---The ability to do this a predicated on a particular non-ambiguous grammar but that is not a limitation as the language clearly proves.

--- End quote ---

For simple parsing, a completely context-free grammar is required. Grammars of many languages, including C, are not context-free, so that makes parsers a hell to write with many context-dependent cases.

One fun example is the parsing of C types. Compare that to parsing Pascal (and all derivatives) types...
For some fun: https://cdecl.org/

Really, as much as I like C, I think Ritchie must have been high on some heavy stuff when designing the declaration of C types. That was the early seventies and all...

Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version