Skip to content

Grammar railroad diagram #2

Description

@mingodad

Using this tool https://www.bottlecaps.de/convert/ and then manually adding the tokens from dvscan.l we can get a nice railroad diagram for the grammar in dvparse.y, copy the EBNF shown bellow and paste at https://www.bottlecaps.de/rr/ui on the tab Edit Grammar then click on the tab View Diagram I hope this can help to have a global view of the grammar.

/* converted on Sat Dec 18, 2021, 15:03 (UTC+01) by bison-to-w3c v0.54 which is Copyright (c) 2011-2021 by Gunther Rademacher <grd@gmx.net> */

goal     ::= initialize module
initialize
         ::=
module   ::= moduleHeader moduleParameter* '\n' moduleElement*
moduleParameter
         ::= KWVOLATILE
           | KWPERSISTENT
           | KWUNDO_REDO
moduleHeader
         ::= KWMODULE upperIdent optIdent
optIdent ::= IDENT?
moduleElement
         ::= import
           | enum
           | typedef
           | schema
           | class
           | relationship
import   ::= KWIMPORT upperIdent '\n'
enum     ::= enumHeader KWBEGIN entry+ KWEND
enumHeader
         ::= KWENUM upperIdent optIdent '\n'
entry    ::= IDENT ( '=' INTEGER )? '\n'
typedef  ::= KWTYPEDEF IDENT ( '=' STRING )? '\n'
schema   ::= KWSCHEMA upperIdent '\n'
class    ::= classHeader classOptions '\n' ( KWBEGIN ( ( property | cacheTogether ) '\n' | union )+ KWEND )?
classHeader
         ::= KWCLASS upperIdent optLabel
classOptions
         ::= classOption*
classOption
         ::= KWREFERENCE_SIZE INTEGER
           | KWFREE_LIST
           | KWCREATE_ONLY
           | KWARRAY
           | KWATTRIBUTES
           | KWSPARSE
property ::= ( baseProperty | KWARRAY baseProperty INDEX? ) propertyAttributes
propertyAttributes
         ::= propertyAttribute*
propertyAttribute
         ::= KWCASCADE
           | KWVIEW
           | KWSPARSE
           | '=' STRING
baseProperty
         ::= ( moduleSpec? IDENT | propertyType ) upperIdent
cacheTogether
         ::= cacheTogetherHeader upperIdent*
cacheTogetherHeader
         ::= KWCACHE_TOGETHER
moduleSpec
         ::= IDENT ':'
propertyType
         ::= INTTYPE
           | UINTTYPE
           | KWFLOAT
           | KWDOUBLE
           | KWBIT
           | KWBOOL
           | KWCHAR
           | KWENUM
           | KWTYPEDEF
           | KWSYM
union    ::= unionHeader KWBEGIN ( property ':' unionCases '\n' )+ KWEND
unionHeader
         ::= KWUNION upperIdent '\n'
unionCases
         ::= unionCase+
unionCase
         ::= IDENT
relationship
         ::= relationshipHeader relationshipType relationshipOption* '\n'
relationshipHeader
         ::= KWRELATIONSHIP upperIdent optLabel upperIdent optLabel
optLabel ::= ( ':' IDENT )?
relationshipType
         ::= ( KWLINKED_LIST | KWDOUBLY_LINKED | KWTAIL_LINKED | KWARRAY | ( KWHEAP | KWHASHED | KWORDERED_LIST ) key )?
key      ::= ( upperIdent ( '.' upperIdent )* )*
relationshipOption
         ::= KWCASCADE
           | KWMANDATORY
           | KWPARENT_ONLY
           | KWCHILD_ONLY
           | KWSPARSE
           | KWUNORDERED
upperIdent
         ::= IDENT

//Tokens
//<INITIAL>\("[^"]+"\)\s+{myDebug("\([^\\]+\).+
KWARRAY ::= "array"
KWATTRIBUTES ::= "attributes"
KWBIT ::= "bit"
KWBOOL ::= "bool"
KWCACHE_TOGETHER ::= "cache_together"
KWCASCADE ::= "cascade"
KWCHAR ::= "char"
KWCHILD_ONLY ::= "child_only"
KWCLASS ::= "class"
KWCREATE_ONLY ::= "create_only"
KWDOUBLE ::= "double"
KWDOUBLY_LINKED ::= "doubly_linked"
KWENUM ::= "enum"
KWFLOAT ::= "float"
KWFREE_LIST ::= "free_list"
KWHASHED ::= "hashed"
KWHEAP ::= "heap"
KIMPORT ::= "import"
KWLINKED_LIST ::= "linked_list"
KWMANDATORY ::= "mandatory"
KWMODULE ::= "module"
KWORDERED_LIST ::= "ordered_list"
KWPARENT_ONLY ::= "parent_only"
KWPERSISTENT ::= "persistent"
KWREFERENCE_SIZE ::= "reference_size"
KWRELATIONSHIP ::= "relationship"
KWSCHEMA ::= "schema"
KWSPARSE ::= "sparse"
KWSYM ::= "sym"
KWTAIL_LINKED ::= "tail_linked"
KWTYPEDEF ::= "typedef"
KWUNDO_REDO ::= "undo_redo"
KWUNION ::= "union"
KWUNORDERED ::= "unordered"
KWVIEW ::= "view"
KWVOLATILE ::= "volatile"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions