In my current project, I have written grammar in Xtext with nice functionalities. For instance, code snippet of my grammar
Device:
deviceName = ID ':'
('region' ':' ( deviceRegions += DeviceRegions)+ )* ;
DeviceRegions:
regionLabel = [RegionLabel] ';'
// It stores a List of regionLabel functionalities
;
RegionLabel: name = ID ;
Using the above grammar, I write the following high-level specification:
DeviceOne :
region :
Room ;
Floor ;
Building;
DeviceTwo:
region :
Room ;
Floor ;
Building;
I would like to see an equivalent BNF grammar of grammar written in xText. The Equivallent grammar would be the following for instance:
Device = ID ':'
( 'region' ':' (deviceRegions = DeviceRegions)+)* ;
DeviceRegions :
regionLabel = RegionLabel ';' ;
RegionLabel = 'room' | 'Floor' | 'Building' ;
ID = 'A'..'Z' ('a' ..'z' | 'A' ..'Z')* ;
My question is that "Is there any way to convert xText written grammar into equivaluent BNF grammar or Should I do it manually ?
I know that xText grammar is very easy to learn and write. However, I have a requirement of having BNF grammar.