Can somebody help in creating a grammar for following structure to generate a parse tree?
kinds
name test_val_1
length ten test_val_2
uses
use1 testcase_1
use2 testcase_2
kinds
should be the root node under which the child nodes arename
,length
anduses
name
should have another child node having the value separated by a space aftername
, in the example that will betest_val_1
length
node should have two child nodes, that areten
andtest_val_2
in the above exampleuses
should have two child nodes, that areuse1
anduse2
which in turn will have the child nodestestcase_1
andtestcase_2
respectively.
I am a newbie to ANTLR grammar and any help would be appreciated.
You need to sign in to view this answers
Leave feedback about this