SCAHA

Help Harmann's Sound Change Applier
List of special characters:
/→_#∅-[]\+.;{}|()+?^~…`=+<>0123456789*$


In sc, run an sc from another file using $<name of file>


In inp: space, tab, and newline are word boundaries.
In cat, sc: spaces, tabs and newlines are ignored.
Lines beginning with * and portions of lines following * are considered comments and are ignored.


Simultaneous SC:
Simultaneous scs are separated by ;


Joiners:
If sc is +n where n is a number, combines words separated by ' +n '


A sound change is in the format
  target/replacement/environment/exception
Environment and exception are optional, so valid are:
  tar/rep
  tar/rep/env
  tar/rep/env/exc
If env is omitted it will replace unconditionally.

The tar and rep may be blank.
The env and exc must always contain a _, representing the part that changes.

The character # represents the beginning or end of the word.



Categories

If a set of chars if enclosed by [ ], it will match if any of the enclosed chars match.
If [ ] are nested, this is ignored e.g. [a[bc]] → [abc]
Thus, cat brackets can contain defined cats.
A [ ] can also contain #

The tar, env, and exc can contain categories.
Cats cannot be used in rep. (Note though, {C} is allowed)

Cats are defined in the cat box. A cat definition is
  nameOfCat=listOfChars
nameOfCat can be any string, but is encouraged to be in one of the following forms:
  V
  <vowel>
listOfChars can also include cats, e.g.
  <vowel>=<long><short>

A defined category is replaced by the list of chars, in [ ].
If followed by . , or if it is the only thing in a [ ] or { } bracket, then will not have [ ]
  C → [abc]
  [C] → [abc]
  [Cd] → [abcd]
  C. → abc
  {C} → {abc}
  {C.} → {abc}
  {C.d} → {abcd}
  {Cd} →{[abc]d}
(Note this doesn't work yet: {1C} ; Use {1C.} instead)

Additionally, can use + and \.
[X+Y+Z] is intersection of X, Y, and Z. Can have as many +
[X\Y] is all of X except those in Y. Can have only one \, which must come after all +
Valid:
  [ab\ef]
  [ab+cd\ef]
  [ab+cd+ef\gh]
Illegal: [+ab], [ab\cd+ef]

Shorthands

Defined in the cat box by:
  <<nameOfShorthand>>=replacementString
Shorthands are the first thing replaced in the sc.



Iterators

Can be used in any part of sc.

If a sc contains a { }, items within { } are iterated over and executed simultaneously.
Each { } must contain the same number of items.
To have multiple sets of iterators, number them by {1 }, {2 } etc.
Examples: (using A=ab and X=xy)
  {ab}/{xy} → a/x;b/y
  {ab}/{x} is illegal.
  {A}/{X} → a/x;b/y
  {[ab]c}/{xy} → [ab]/x;c/y
  {Ac}/{xy} → [ab]/x;c/y
  {A.c}/{xyz} → a/x;b/y;c/z
  {ab}/{pq}/{xy}_ → a/p/x_;b/q/y_
  {1ab}{2pq}/{1xy}{2rs} → a{2pq}/x{2rs};b{2pq}/y{2rs} → ap/xr;aq/xs;bp/yr;bq/ys
  {1{2ab}{2cd}}/{1xy} → a/x;b/x;c/y;d/y
Additionally, if can do {a|b} instead of {ab}. This allows e.g. {ts|dz}



Optionals

Only applies to env and exc
An optional char or set of chars are enclosed by ( ). Can also put ? after. (So equivalent are X?, (X), (X)?)
At least one char X: X+ or (X)+
Any number of char X: X^ or (X)^
To apply + and ^ to sequence of char, enclose sequence with ( )
Any single char: ~
Any number of chars: … (this is equivalent to ~^)



Other Characters

- can be used in rep, and will be deleted after sc takes place
All → are replaced by /, and all ∅ are removed
` is an escape character. The following character is treated like a letter.
Digits are treated as diacritics.