Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 499397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:58:52+00:00 2026-05-13T05:58:52+00:00

I’d like to know if a tool like ANTLR would be appropiate for parsing

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:58:53+00:00Added an answer on May 13, 2026 at 5:58 am

    While your language is simple, using ANTLR has a lot of advantages.

    1. Speed. The generated code is VERY fast.

    2. Simplicity. Since you’re working in a higher-level language, small grammar changes are less costly and complex.

    3. Extensibility. Since you’re working in a higher-level language, adding features is a lower-cost activity.

    Yes, you need to learn ANTLR. And if your grammar has ambiguities, you’ll need to learn about shift-reduce and reduce-reduce conflicts. This can be time well spent.

    Many problems are lexical scanning or parsing problems. Knowing how to create a lexical scanner and parser is a helpful skill.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 335k
  • Answers 335k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer wonde's comment above led me to the answer -- I… May 14, 2026 at 3:33 am
  • Editorial Team
    Editorial Team added an answer Q1: It is based on the result of the inner… May 14, 2026 at 3:33 am
  • Editorial Team
    Editorial Team added an answer First off, you don't need those <div>s. You can just… May 14, 2026 at 3:33 am

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.