I'd like to know if a tool like ANTLR would be appropiate for parsing these rules or it's overkill and I should make my own parser.
This is for parsing someone else's format, so I can't change it. It's for fun and to practice, so don't fret too much. These are rules to describe phonetic changes in languages. I'll quote the original author:
Sound change format
Hopefully the format of the rules will be familiar to any linguist. For instance, here's one sound change:
c/g/V_V
This rule says to change c to g between vowels. (We'll see how to generalize this rule below.)
More generally, a sound change looks like this:
x/y/z
where x is the thing to be changed, y is what it changes to, and z is the environment.
The z part must always contain an underline _, representing the part that changes. That can be all there is, as in
gn/nh/_
which tells the program to replace gn with nh unconditionally.
The character # represents the beginning or end of the word. So
u/o/_#
means to replace u with o, but only at the end of the word.
The middle (y) part can be blank, as in
s//_#
This means that s is deleted when it ends a word.
Variables
The environment (the z part) can contain variables, like V above. These are defined at the top of the file. I use capital letters for this, though this is not a requirement. Variables can only be one character long. You can define any variables needed to state your sound changes. E.g. you could define S to be any stop, or K for any coronal, or whatever.
So the variable definition and rule
F=ie
c/i/F_t
means that c changes to i after a front vowel and before a t.
You can use variables in the first two parts as well. For instance, suppose you've defined
S=ptc
Z=bdg
S/Z/V_V
This means that the stops ptc change to their voiced equivalents bdg between vowels. In this usage, the variables must correspond one for one-- p goes to b, t goes to d, etc. Each character in the replacement variable (here Z) gives the transformed value of each character in the input variable (here S). Make sure the two variable definitions are the same length!
A variable can also be set to a fixed value, or deleted. E.g.
Z//V_V
says to delete voiced stops between vowels.
Rule order
Rules apply in the order they're listed. So, with the word opera and the rules
p/b/V_V
e//C_rV
the first rule voices the p, resulting in obera; the second deletes an e between a consonant and an intervocalic r, resulting in obra.
The -p command line parameter can assist in debugging rules, since it causes the output to show exactly what rules applied to each word.
Optional elements in the environment
One or more elements in the environment can be marked as optional with parentheses. E.g.
u/ü/_C(C)F
says to change u to ü when it's followed by one or two consonants and then a front vowel.