-
I have some files which are in some format which has to be validated.
example, a. first 4 characters are numeric b. first word begins at 0. c. It is the result of 3rd and 4th characters. -
These rules change from files to files. That is, in future some new file with different rules will be written.
-
I am planning to write these rules/syntax in a language like xml. I am using java for programming. Java should read the syntax file and validate the necessary files.
-
My question: is there any language for writing custom syntax which is easy to read and apply? – i think, xml is not for rules/syntax writing language
I have some files which are in some format which has to be validated.
Share
Take a look into the ANTLR parser generator. You can specify a grammar for which ANTLR generates a parser. You can then use that parser to parse the input file.
Of course you will have to have the grammars for each recognized file format so you can select at runtime based on the file (extension?) which parser to use