OiO.lk Blog java ANTLR grammar creation for a custom file structure
java

ANTLR grammar creation for a custom file structure


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
  1. kinds should be the root node under which the child nodes are name, length and uses
  2. name should have another child node having the value separated by a space after name, in the example that will be test_val_1
  3. length node should have two child nodes, that are ten and test_val_2 in the above example
  4. uses should have two child nodes, that are use1 and use2 which in turn will have the child nodes testcase_1 and testcase_2 respectively.

I am a newbie to ANTLR grammar and any help would be appreciated.



You need to sign in to view this answers

Exit mobile version