Knowledge

Syntax diagram

Source đź“ť

54:
Manual. In the compilation field, textual representations like BNF or its variants are usually preferred. BNF is text-based, and used by compiler writers and parser generators. Railroad diagrams are visual, and may be more readily understood by laypeople, sometimes incorporated into graphic design.
74:
Each diagram has an entry point and an end point. The diagram describes possible paths between these two points by going through other nonterminals and terminals. Historically, terminals have been represented by round boxes and nonterminals by rectangular boxes but there is no official standard.
70:
The representation of a grammar is a set of syntax diagrams. Each diagram defines a "nonterminal" stage in a process. There is a main diagram which defines the language in the following way: to belong to the language, a word must describe a path in the main diagram.
692: 683:
One possible syntax diagram for the example grammars is below. While the syntax for the text-based grammars differs, the syntax diagram for all of them can be the same because it is a
756: 279:"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" 691: 39: 708: 703: 632: 831: 816: 743: 792: 760: 31: 755:
Note: the first link is sometimes blocked by the server outside of its domain, but it is available on
728: 27: 782: 836: 825: 59: 47: 43: 684: 62:
format provides yet another example of a popular modern usage of these diagrams.
777: 46:. Early books using syntax diagrams include the "Pascal User Manual" written by 802: 83:
We use arithmetic expressions as an example, in various grammar formats.
817:
SRFB Syntax Diagram representation by Function Basis + svg generation
680:, but it is not used here for consistency with the other examples. 629:, but it is not used here for consistency with the other examples. 51: 56: 35: 797: 787: 807: 772: 746:
Command AND Edit (CANDE) Language: Information Manual
672: 618: 783:From EBNF to a postscript file with the diagrams 226:"x" | "y" | "z" 50:(diagrams start at page 47) and the Burroughs 8: 30:. They represent a graphical alternative to 16:Visual description of context-free grammar 803:Augmented Syntax Diagram (ASD) grammars 793:SQLite syntax diagram generator for SQL 721: 671:This format also supports ranges, e.g. 773:JSON website including syntax diagrams 812:Syntax Diagram Application Demo Site 7: 42:, and other text-based grammars as 55:The canonical source defining the 14: 798:Online Railroad Diagram Generator 759:. The file was also mirrored at 731:The Programming Language Pascal. 690: 617:ABNF also supports ranges, e.g. 1: 704:Recursive transition network 66:Principle of syntax diagrams 26:) are a way to represent a 853: 788:EBNF Parser & Renderer 633:Red (programming language) 40:Augmented Backus–Naur form 709:Extended Backus–Naur form 637: 469: 285: 88: 744:Burroughs B6700/B7700 28:context-free grammar 778:Generator from EBNF 761:standardpascal.org 24:railroad diagrams 844: 832:Formal languages 749: 741: 735: 726: 694: 679: 678: 675: 667: 666: 662: 659: 656: 653: 650: 647: 644: 641: 628: 627: 624: 621: 613: 612: 609: 606: 603: 600: 597: 594: 591: 588: 585: 582: 579: 576: 573: 570: 567: 564: 561: 558: 555: 552: 548: 545: 542: 539: 536: 533: 530: 527: 524: 521: 518: 515: 512: 509: 506: 503: 500: 497: 494: 491: 488: 485: 482: 479: 476: 473: 463: 460: 457: 454: 451: 448: 445: 442: 439: 436: 433: 430: 427: 424: 421: 418: 415: 412: 409: 406: 403: 400: 397: 394: 391: 388: 385: 382: 379: 376: 373: 370: 367: 364: 361: 358: 355: 352: 349: 346: 343: 340: 337: 334: 331: 328: 325: 322: 319: 316: 313: 310: 307: 304: 301: 298: 295: 292: 289: 278: 275: 272: 269: 266: 263: 260: 257: 254: 251: 247: 244: 241: 238: 235: 232: 229: 225: 222: 219: 216: 212: 209: 206: 203:| "(" 202: 199: 196: 192: 189: 186: 183: 180: 177: 174: 171: 168: 165: 161: 158: 155: 151: 148: 145: 142: 139: 136: 133: 130: 127: 124: 120: 117: 114: 110: 107: 104: 101: 98: 95: 92: 60:data interchange 32:Backus–Naur form 852: 851: 847: 846: 845: 843: 842: 841: 822: 821: 769: 753: 752: 742: 738: 729:Niklaus Wirth: 727: 723: 718: 700: 676: 673: 669: 668: 664: 663: 660: 657: 654: 651: 648: 645: 642: 639: 635:Parse Dialect: 625: 622: 619: 615: 614: 610: 607: 604: 601: 598: 595: 592: 589: 586: 583: 580: 577: 574: 571: 568: 565: 562: 559: 556: 553: 550: 549: 546: 543: 540: 537: 534: 531: 528: 525: 522: 519: 516: 513: 510: 507: 504: 501: 498: 495: 492: 489: 486: 483: 480: 477: 474: 471: 465: 464: 461: 458: 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 425: 422: 419: 416: 413: 410: 407: 404: 401: 398: 395: 392: 389: 386: 383: 380: 377: 374: 371: 368: 365: 362: 359: 356: 353: 350: 347: 344: 341: 338: 335: 332: 329: 326: 323: 320: 317: 314: 311: 308: 305: 302: 299: 296: 293: 290: 287: 281: 280: 276: 273: 270: 267: 264: 261: 258: 255: 252: 249: 245: 242: 239: 236: 233: 230: 227: 223: 220: 217: 214: 210: 207: 204: 200: 197: 194: 190: 187: 184: 181: 178: 175: 172: 169: 166: 163: 159: 156: 153: 149: 146: 143: 140: 137: 134: 131: 128: 125: 122: 118: 115: 112: 108: 105: 102: 99: 96: 93: 90: 81: 68: 20:Syntax diagrams 17: 12: 11: 5: 850: 848: 840: 839: 834: 824: 823: 820: 819: 814: 805: 800: 795: 790: 785: 780: 775: 768: 767:External links 765: 751: 750: 736: 720: 719: 717: 714: 713: 712: 706: 699: 696: 638: 470: 286: 213:")" 162:"*" 121:"+" 89: 80: 77: 67: 64: 15: 13: 10: 9: 6: 4: 3: 2: 849: 838: 835: 833: 830: 829: 827: 818: 815: 813: 811: 806: 804: 801: 799: 796: 794: 791: 789: 786: 784: 781: 779: 776: 774: 771: 770: 766: 764: 762: 758: 748: 747: 740: 737: 734: 732: 725: 722: 715: 710: 707: 705: 702: 701: 697: 695: 693: 688: 686: 681: 636: 634: 630: 611:"9" 605:"8" 599:"7" 593:"6" 587:"5" 581:"4" 575:"3" 569:"2" 563:"1" 557:"0" 535:"z" 529:"y" 523:"x" 514:")" 508:"(" 468: 459:"9" 453:"8" 447:"7" 441:"6" 435:"5" 429:"4" 423:"3" 417:"2" 411:"1" 405:"0" 372:"z" 366:"y" 360:"x" 348:")" 336:"(" 284: 87: 84: 78: 76: 72: 65: 63: 61: 58: 53: 49: 48:Niklaus Wirth 45: 44:metalanguages 41: 37: 33: 29: 25: 21: 809: 754: 745: 739: 730: 724: 689: 685:metalanguage 682: 670: 631: 616: 466: 282: 85: 82: 73: 69: 23: 19: 18: 757:archive.org 733:(July 1973) 643:expression: 399:digit 378:constant 354:variable 342:expression 318:factor 303:term 288:expression 826:Categories 716:References 511:expression 472:expression 208:expression 126:expression 94:expression 810:Augmented 661:constant: 658:variable: 330:variable 324:constant 837:Diagrams 698:See also 538:constant 517:variable 502:variable 496:constant 262:constant 231:constant 218:variable 198:variable 188:constant 677:charset 655:factor: 626:%x30-39 309:factor 79:Example 808:(ASD) 711:(EBNF) 674:digit: 665:digit: 490:factor 487:factor 467:ABNF: 393:digit 384:digit 283:EBNF: 176:factor 157:factor 147:factor 649:term: 620:DIGIT 551:DIGIT 547:digit 294:term 271:digit 253:digit 243:digit 86:BNF: 52:CANDE 481:term 478:term 274:> 268:< 265:> 259:< 256:> 250:< 246:> 240:< 234:> 228:< 221:> 215:< 211:> 205:< 201:> 195:< 191:> 185:< 179:> 173:< 170:> 167:term 164:< 160:> 154:< 150:> 144:< 138:> 135:term 132:< 129:> 123:< 119:> 116:term 113:< 109:> 106:term 103:< 97:> 91:< 57:JSON 36:EBNF 22:(or 640:Red 277:::= 237:::= 224:::= 182:::= 141:::= 100:::= 828:: 763:. 687:. 544:1* 396:}; 248:| 193:| 152:| 111:| 38:, 34:, 652:] 646:] 623:= 608:/ 602:/ 596:/ 590:/ 584:/ 578:/ 572:/ 566:/ 560:/ 554:= 541:= 532:/ 526:/ 520:= 505:/ 499:/ 493:= 484:= 475:= 462:; 456:| 450:| 444:| 438:| 432:| 426:| 420:| 414:| 408:| 402:= 390:{ 387:, 381:= 375:; 369:| 363:| 357:= 351:; 345:, 339:, 333:| 327:| 321:= 315:; 312:, 306:= 300:; 297:, 291:=

Index

context-free grammar
Backus–Naur form
EBNF
Augmented Backus–Naur form
metalanguages
Niklaus Wirth
CANDE
JSON
data interchange
Red (programming language)
metalanguage
"Railroad" syntax diagram
Recursive transition network
Extended Backus–Naur form
Niklaus Wirth: The Programming Language Pascal. (July 1973)
Burroughs B6700/B7700 Command AND Edit (CANDE) Language: Information Manual
archive.org
standardpascal.org
JSON website including syntax diagrams
Generator from EBNF
From EBNF to a postscript file with the diagrams
EBNF Parser & Renderer
SQLite syntax diagram generator for SQL
Online Railroad Diagram Generator
Augmented Syntax Diagram (ASD) grammars
(ASD) Augmented Syntax Diagram Application Demo Site
SRFB Syntax Diagram representation by Function Basis + svg generation
Categories
Formal languages
Diagrams

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑