Lexurgy Sound Changer Cheat Sheet
This is a quick reference for Lexurgy syntax. Check the linked sections of the tutorial for more explanation and interactive examples.
Basics
Name | Example | Explanation |
---|---|---|
Comment | # This is a comment | Everything after the # is ignored by Lexurgy. Use them to remind yourself what a rule is for. |
Simple change | ɔ => ɑ | Every time the sound on the left of the arrow appears in a word, it gets replaced with the sound on the right. |
Condition | k => ʃ / a _ a | The change only happens when certain other sounds are adjacent. |
Exception | k => ʃ // a _ a | The change only happens when certain other sounds are NOT adjacent. |
Condition and exception | k => ʃ / _ a // a _ | The change only happens when the sounds after / are adjacent AND the sounds after // are NOT adjacent. |
Word beginning | k => kʰ / $ _ | The change only happens at the beginning of a word. |
Word end | a => ə / _ $ | The change only happens at the end of a word. |
Insertion | * => e / $ _ s | The sound on the right of the arrow is inserted between the specified sounds. |
Deletion | h => * | The sound on the left of the arrow is deleted. |
Collapsing alternatives | {p, t, k} => ʔ | Each of the sounds on the left changes into the sound on the right. |
Corresponding alternatives | {p, t, k} => {b, d, ɡ} | Each of the sounds on the left changes into the corresponding sound on the right. |
Alternative environments | k => ʃ / {_ a, a _} | The change happens when nearby sounds match any of the conditions. |
Sound class | class stop {p, t, k} rule: @stop => ʔ | References to the class are replaced with the declared list of sounds. |
Corresponding sound classes | class stop {p, t, k} class fricative {f, θ, x} rule: @stop => @fricative | Each sound in the left class turns into the corresponding sound in the right class. |
Wildcard | [] => x | The [] matches any single sound |
Multi-character symbol | Symbol ts, dz | These character sequences are treated as single sounds. |
Escape | \* | The character after the \ is treated as a sound, not part of Lexurgy syntax. |
Combining Elements
Name | Example | Explanation |
---|---|---|
Sequence | n k => ŋ ɡ | The sequences of adjacent sounds on the left change into the sounds on the right. |
Optional element | a => ə / _ @consonant? $ | The rule applies whether the element marked with ? is present or not. |
Grouping | (@consonant @vowel)? | The operator applies to all the elements in parentheses as a whole. |
Repeated element, any number | @consonant* | This matches any number of copies of the specified element, including zero. |
Repeated element, one or more | @consonant+ | This matches any number of copies of the specified element, but at least one copy must be present. |
Repeated element, exact number | @consonant*2 | This matches exactly the specified number of copies, no more, no less. |
Repeated element, range | @consonant*(2-4) | This matches any number of copies within the specified range, inclusive. |
Repeated element, maximum number | @consonant*(-4) | This matches any number of copies up to and including the specified maximum |
Repeated element, minimum number | @consonant*(2-) | This matches any number of copies at or above the specified minimum. |
Capture | @consonant$1 => * / _ $1 | The sounds matched by the element before $ are saved and can be referenced elsewhere in the rule using the same number. |
Negation | !@consonant | The rule doesn't apply if the element after ! is present. |
Intersection | @stop&@alveolar | Sounds must match both criteria at the same time. |
Negated intersection | @stop&!@alveolar | Sounds must match the first element but not the second element. |
Unchanged | rule: unchanged | This expression does nothing. Use this if the syntax requires an expression—e.g. before a then block with modifiers—but there are no actual changes to make. |
Word boundary | $$ => * | The $$ matches the space between words. |
Control Flow
Name | Example | Explanation |
---|---|---|
Simultaneous expression | rule: ɔ => ɑ ɑ => a | The expressions apply simultaneously rather than one by one from top to bottom. Later expressions can't see the output of earlier ones. |
Simultaneous expression precedence | rule: k => s / _ {e, i} k => h / $ _ | Earlier expressions take precedence over later ones if they try to change the same sounds. |
Sequential block | rule: ɔ => ɑ then: ɑ => a | The expressions apply one by one from top to bottom, as if they were written in separate rules. |
Hierarchical block | rule: @vowel => [+hightone] / {p, t, k} _ else: @vowel => [+hightone] / $ @consonant _ | Later expressions apply only if all earlier expressions fail to match anything in the word at all. |
Propagating rule | rule propagate: aa => a | The rule repeatedly applies until the word stops changing. |
Left-to-right rule | rule ltr: ea => e | The rule tries to apply once at each character, from the beginning of the word to the end, with later applications seeing the effects of earlier ones. |
Right-to-left rule | rule rtl: ae => e | The rule tries to apply once at each character, from the end of the word to the beginning, with later applications seeing the effects of earlier ones. |
Filter | rule @vowel: a => e / _ i | The rule pretends that only sounds that match the filter exist. Adjacency passes through non-matching sounds. |
Reusable element | element scluster s @stop rule: * => e / _ @scluster | References to the element are replaced with the specified expression structure. |
Deferred rule | assim: @nasal => m / _ {p, b} rule: :assim | The rule doesn't apply when declared, but can be applied later as part of other rules |
Cleanup rule | assim cleanup: @nasal => m / _ {p, b} | The rule applies once when declared, then again after every subsequent rule |
Cleanup off | assim: off | The specified cleanup rule no longer runs after subsequent rules. It runs for the last time immediately before the cleanup-off rule. |
Deromanizer | deromanizer: kh => x | This rule converts the romanization system into phonetic notation before any rules are applied. |
Literal deromanizer | deromanizer literal: ʼ => ʔ then: k => kʼ | Any expressions before the first then: operate on literal text characters, ignoring all declarations. Use this if the romanization system uses characters in a way that conflicts with the declarations. |
Romanizer | romanizer: x => kh | This rule converts phonetic notation into the romanization system after all rules are applied. |
Literal romanizer | romanizer literal: kʼ => k then: ʔ => ʼ | Any expressions after the last then: operate on literal text characters, ignoring all declarations. Use this if the romanization system uses characters in a way that conflicts with the declarations. |
Intermediate romanizer | romanizer-some-name: x => kh | This rule preserves an intermediate stage of the language's evolution after applying the specified changes. Subsequent rules don't see those changes. |
Features
Name | Example | Explanation |
---|---|---|
Binary feature | feature low, high rule: [-low -high] => [+high] / _ $ | These features can either be plus (+ ), minus (- ), or absent (* ), and are absent by default. |
Univalent feature | feature +lateral rule: [+lateral] => [-lateral] / _ $ | These features can either be plus (+ ) or minus (- ), and are minus by default. |
Multivalent feature | feature place(labial, alveolar, velar) rule: [labial] => [alveolar] / _ $ | These features can have any number of named values. |
Feature variable | [stop] => [$voicing] / _ [stop $voicing] | The value of the specified feature is saved and can be referenced elsewhere in the rule using the same feature name. |
Named absent value | feature tone(*lowtone, hightone) | The default value of the feature can be referenced using the name marked with * |
Negated value | [!labial] | The feature matrix matches only sounds that don't have the specified feature value. |
Diacritic | Diacritic ˈ [+ejective] | The specified symbol is treated as part of the sound immediately before it, and adds the specified feature values to it. |
Diacritic, before | Diacritic ⁿ [+prenasalized] | This diacritic is written before the sound it modifies. |
Diacritic, after first | Diacritic ́ (first) [+hightone] | This diacritic is written after the first character of the sound it modifies. |
Floating diacritic | Diacritic ́ (floating) [+hightone] | Sound matchers without the diacritic match sounds with it, and automatically carry it over to the output sound. |
Exact match | e! | This sound must match exactly, with no exception for floating diacritics. |
Inexact capture reference | ~$1 | This matches copies of `$1` that differ only by having different floating diacritics. |
Syllables
Name | Example | Explanation |
---|---|---|
Explicit syllables | syllables: explicit | In subsequent rules, any . characters are treated as syllable breaks rather than sounds. |
Syllable boundary | n => * / _ . | The rule only applies if there is a syllable break at the . |
Negated syllable boundary | i => j / _ !. @vowel | The rule only applies if there is no syllable break at the !. . |
Syllable element | <syl> => * / _ <syl> $ | The <syl> matches an entire syllable. |
Simple automatic syllables | syllables: @cons? @vowel @cons? | Words are automatically split into syllables matching the specified patterns, immediately and after each subsequent rule. Ambiguity is resolved by making syllables as short as possible. |
Structured automatic syllables | syllables: @cons? :: @vowel :: @cons? | Words are automatically split into syllables matching the specified onset, nucleus, and (optionally) coda patterns, immediately and after each subsequent rule. Ambiguity is resolved by making nuclei as long as possible and codas as short as possible. |
Reluctant onset | syllables: @cons? ?: @cons? :: @vowel :: @cons? | The reluctant onset matches as little as possible, even if it makes the coda of the preceding syllable longer. |
Clearing syllables | syllables: clear | All syllable information is removed, and any automatic syllable rules no longer apply. |
Syllable-level feature | feature (syllable) +stress | This feature is assigned to an entire syllable, not just a single sound. |
Automatic feature assignment | syllables: @cons? :: @vowel :: @cons => [+heavy] | Syllables matching this pattern are automatically assigned the specified syllable-level feature. |