Initial conditionsComments
Initial conditions
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. * * vacana=eka <!--Captured by A3.4.78-->
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf

Any idea of how many possible initial conditions there are?

Pala=sattA is not referenced by any rule in the derivation. What is it's purpose?

kAraka=kartf is not referenced by any rule in the derivation. What is it's purpose?


Add phone "BU"Comments
BU
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. * * vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [BU] saYjYA=DAtu
Why isn't [BU] saYjYA=DAtu an initial condition?

After applying A3.2.123Comments
When the action refers to the present time (kAla=vartamAna) 
l-substitutes of law 'Present Tense' are introduced 
[after 1.2 a verbal stem 1.93].

<rule n="A3.2.123" s="vartamAne law" type="viDi">
  <pUrva saYjYA="DAtu">
    <arTa kAla="vartamAna"/>
  </pUrva>
  <AdeSa phone='l' saYjYA="pratyaya[slp=la~w, upadeSa=law, bare=l]"/>
</rule>

BUl
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. * * vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [BU]l saYjYA=DAtu
 8. BU[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l]

The AdeSa element for this rule in rules.xml does not have the phone attribute. However 1.3.78 mentions phone="^l$" in its uddeSya element. Please advise.

l is added after BU because the rule condition has a pUrva element whose range is [BU] but no sTAnin or uddeSya elements

When is the range of * * kAla=vartamAna going to be captured?


After applying A1.4.13Comments
In a unit after which (yásmāt) an affix is introduced 
(pratyaya-vidhíḥ), the unit beginning with that is 
denoted by the t.t. áṅga before that affix (pratyayé).

<rule n="A1.4.13" type="saYjYA">
  <triggers>
    <trigger element="AdeSa" class="saYjYA" value="pratyaya"/>
  </triggers>
  <params>
    <param type="attribute">stem</param>
    <param type="pattern">phone</param>
    <param type="attribute">affix</param>
  </params>
  <uddeSya param="@(stem)"/>
  <para param="@(affix)"/>
  <AdeSa saYjYA="aNga[ref=@(affix)]"/>
</rule>

BUl	
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. * * vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [BU] saYjYA=DAtu
 8. BU[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l]
 9. [BU]l saYjYA=aNga[ref=-->8]

This was triggered by A3.2.123 adding the property saYjYA="pratyaya[slp=la~w, upadeSa=law, bare=l] to the current state.

@(stem) is the DAtu or prAtipadika that was the pUrva in the rule that just taught the pratyaya. In this case it was BU. We have to add a property that indicates what it is an aNga of, i.e. the pratyaya to which it is related, add a property r=x.

@(affix) is one just taught, in this case saYjYA="pratyaya[slp=la~w, upadeSa=law, bare=l]


After applying A1.3.78Comments
After the remaining verbal stems (śéṣāt), when the agent (kartári) 
is to be denoted, Parasmaipadá l-substitutes are introduced.

<rule n="A1.3.78">
   <pUrva saYjYA="DAtu"/>
   <uddeSya saYjYA="pratyaya[bare=^l$]" phone="^l$">
    <arTa prayoga="kartf"/>
   </uddeSya>
   <AdeSa pada="parasmE"/>
</rule>
  
BUl
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. * * vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [BU] saYjYA=DAtu
 8. BU[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l]
 9. [BU]l saYjYA=aNga[ref=-->8], 
10. BU[l] pada=parasmE

When is the range of * * prayoga=kartf going to be captured?

Since it is not captured why is it a child of <uddeSya>?

Re phone="^l$": See first comment for A3.2.123 above.


After applying A1.4.108Comments
Prathamá (third person) triplets are introduced (after a verbal stem) 
when (a pronominal stem) other than (śeṣe) [yuṣmád 105 and asmád 107] 
co-occurs as a complementary word (upapadá) either expressed or implied 
and denotes the same thing [= or is in grammatical agreement 105].

<rule n="A1.4.108" s="Seze praTamaH" type="niyama" 
    niyata="A3.4.78" SezaTo="A1.4.105 A1.4.107">
  <pUrva saYjYA="DAtu"/>
  <uddeSya saYjYA="pratyaya[bare=^l$]" phone="^l$"/>
  <arTa syntax="samAnADikaraRa.3rdperson"/>
  <AdeSa puruza="praTama"/>
</rule>

BUl	
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. * * vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [BU] saYjYA=DAtu
 8. BU[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l]
 9. [BU]l saYjYA=aNga[ref=-->8], 
10. BU[l] pada=parasmE, 
11. BU[l] puruza=praTama
When is the range of * * syntax=samAnADikaraRa.3rdperson going to be captured?

After applying A1.4.22Comments
[The t.tt. 1] dvi-vacaná `dual' and eka-vacaná `singular' 
respectively (1.3.10) denote duality and singularity of 
units [functioning as subjects or objects].

<rule n="A1.4.22" type="niyama" 
    niyata="A3.4.78 A4.1.2">
  <cases>
    <case>
      <or>
        <uddeSya saYjYA="sup" phone=""/>
        <uddeSya saYjYA="pratyaya[bare=^l$]" phone="^l$"/>
      </or>
      <arTa vacana="dvi"/>
      <AdeSa vAcya="vacana=dvi"/>
    </case>
    <case>
      <or>
        <uddeSya saYjYA="sup" phone=""/>
        <uddeSya saYjYA="pratyaya[bare=^l$]" phone="^l$"/>
      </or>
      <arTa vacana="eka"/>
      <AdeSa vAcya="vacana=eka"/>
    </case>
  </cases>
</rule>

BUl	
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. BU[l] vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [BU]l saYjYA=DAtu
 8. BU[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l] 
 9. [BU]l saYjYA=aNga[ref=-->8], 
10. [BU]l pada=parasmE, 
11. [BU]l puruza=praTama, 
Since when this rule begins execution the range of vacana=eka is pending, <arTa vacana="eka"/> can appear anywhere in the condition.


After applying A3.1.68 [try1]Comments
[The affix 1] ŚaP is introduced [after 2 a verbal stem before sārvadhātuka 
l-substitutes 67] to denote the agent (kartár-i).

<rule n="A3.1.68" s="kartari Sap" type="viDi" apodita="A3.1.67">
  <pUrva saYjYA="DAtu"/>
  <para saYjYA="pratyaya[bare=^l$]">
    <arTa prayoga="kartf"/>
  </para>
  <AdeSa saYjYA="pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]" phone="a"/>
    <try after="tiN-viDi">
      <para saYjYA="sArvaDAtuka" sTAnin="pratyaya[bare=^l$]">
        <arTa prayoga="kartf"/>
      </para>
      <AdeSa keep="yes"/><!-- keep the provisional AdeSa -->
    </try>
    <otherwise>
      <AdeSa keep="no" comment="return to apodita"/>
    </otherwise>
  </AdeSa>
</rule>

BUal	
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. BUa[l] vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [BU]al saYjYA=DAtu
 8. BUa[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l]
 9. [BU]al saYjYA=aNga[ref=-->8], 
10. BUa[l] pada=parasmE, 
11. BUa[l] puruza=praTama, 
12. BU[a]l saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]

Note that the ranges of attributes 7 and 9 did not have to be changed.


After applying A3.4.113Comments
The t.t. sārvadhātuka denotes the l-substitute [affixes 1,1] implied by the 
siglum tiṄ (78) and those marked with Ś as IT.

<rule n="A3.4.113" s="tiNSitsArvaDAtukam" type="saYjYA">
  <pUrva saYjYA="DAtu"/>
  <or>
    <uddeSya saYjYA="tiN"/>
    <uddeSya saYjYA="pratyaya[it=^S$]"/>
  </or>
  <AdeSa saYjYA="sArvaDAtuka"/>
</rule>

BUal	
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. BUa[l] vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [BU]al saYjYA=DAtu
 8. BUa[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l]
 9. [BU]al saYjYA=aNga[ref=-->8], 
10. BUa[l] pada=parasmE, 
11. BUa[l] puruza=praTama, 
12. BU[a]l saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]
13. BU[a]l saYjYA=sArvaDAtuka

After applying A1.4.13Comments

In a unit after which (yásmāt) an affix is introduced (pratyaya-vidhíḥ), 
the unit beginning with that is denoted by the t.t. áṅga before that 
affix (pratyayé).

<rule n="A1.4.13" type="saYjYA">
  <triggers>
    <trigger element="AdeSa" class="saYjYA" value="pratyaya"/>
  </triggers>
  <params>
    <param type="attribute">stem</param>
    <param type="pattern">phone</param>
    <param type="attribute">affix</param>
  </params>
  <uddeSya param="@(stem)"/>
  <para param="@(affix)"/>
  <AdeSa saYjYA="aNga[ref=@(affix)]"/>
</rule>

BUal	
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. BUa[l] vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [BU]al saYjYA=DAtu
 8. BUa[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l], 
 9. [BU]al saYjYA=aNga[ref=-->8], 
10. BUa[l] pada=parasmE, 
11. BUa[l] puruza=praTama, 
12. BU[a]l saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]
13. BU[a]l saYjYA=sArvaDAtuka, 
14. [BU]al saYjYA=aNga[ref=-->12]

This was triggered by A3.4.113 adding the property saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p] to the current state.

@(stem) is the DAtu or prAtipadika that was the pUrva in the rule that just taught the pratyaya. In this case it was BU. We have to add a property that indicates what it is an aNga of, i.e. the pratyaya to which it is related, add a property r=x.

@(affix) is one just taught, in this case saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]


After applying A7.3.84Comments
[A substitute Guṇá vowel (= a, e, o 1.1.2) 82 replaces the 
áṅga 6.4.1 final 1.1.52 of verbal stems (ending in 1.1.72 a vowel 
denoted by the siglum iK = i, u, r̥, l̥ 1.1.3) before 1.1.66] 
sārva-dhātu-ka (3.4.113) and ārdha-dhātu-ka (3.4.114) [affixes 3.1.1].

<rule n="A7.3.84" s="sArvaDAtukArDaDAtukayoH" type="viDi">
  <avayavin saYjYA="aNga">
    <sTAnin phone="[@(ik)]" locus="anta"/>
  </avayavin>
  <or>
    <para saYjYA="sArvaDAtuka"/>
    <para saYjYA="ArDaDAtuka"/>
  </or>
  <AdeSa execute="guRa"/>
</rule>
Boal
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. Boa[l] vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [Bo]al saYjYA=DAtu
 8. Boa[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l], 
 9. [Bo]al saYjYA=aNga[ref=-->8], 
10. Boa[l] pada=parasmE, 
11. Boa[l] puruza=praTama, 
12. Bo[a]l saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]
13. Bo[a]l saYjYA=sArvaDAtuka
14. [Bo]al saYjYA=aNga[ref=-->12]
	

[@(ik)] = [iIuUfFxX]

The guRa function works on the substring of BUal defined by the sTAnin range B[U]al. The U is replaced by o because the guRa of U is o.

No ranges were changed by this rule.


After applying A6.1.78Comments
The substitute elements ay, av, āy and āv [respectively 1.3.10] replace 
the vowels denoted by the siglum eC (= e, o, ai, au) 
[before 1.1.66 a vowel phoneme 77 in continuous utterance 72].

<rule n="A6.1.78" s="eco 'yavAyAvaH" type="viDi">
  <cases>
    <case>
      <sTAnin phone="e"/>
      <para phone="[@(ac)]"/>
      <AdeSa phone="ay"/>
    </case>
    <case>
      <sTAnin phone="o"/>
      <para phone="[@(ac)]"/>
      <AdeSa phone="av"/>
    </case>
    <case>
      <sTAnin phone="E"/>
      <para phone="[@(ac)]"/>
      <AdeSa phone="Ay"/>
    </case>
    <case>
      <sTAnin phone="O"/>
      <para phone="[@(ac)]"/>
      <AdeSa phone="Av"/>
    </case>
  </cases>
</rule>

Boal --> Baval	
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. Bava[l] vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [Bav]al saYjYA=DAtu
 8. Bava[l] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l], 
 9. [Bav]al saYjYA=aNga[ref=-->8], 
10. Bava[l] pada=parasmE, 
11. Bava[l] puruza=praTama, 
12. Bav[a]l saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]
13. Bav[a]l saYjYA=sArvaDAtuka, 
14. [Bav]al saYjYA=aNga[ref=-->12]

[@(ac)] = all vowels

Since the sTAnin does not have the attribute flags="g", exactly one match must be found.


After applying A3.4.78Comments
[The eighteen substitute affixes 1.1] beginning with tiP and ending 
with mahiṄ replace [the l-members 77 introduced after 1.2 a verbal stem 1.91].

<rule n="A3.4.78" type="viDi">
  <!-- Select from table the termination with the appropriate attributes. -->
  <sTAnin  pada="*" puruza="*" vacana="*">
    <attribute refid="1" saYjYA="pratyaya[bare=^l$]"/>
  </sTAnin>
  <AdeSa execute="table-tiN(@(sTAnin.pada), 
                     @(sTAnin.puruza), 
                     @(sTAnin.vacana))" 
            sTAnin="@refid=1" saYjYA="tiN"/>
</rule>

Baval --> Bavati
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. BUa[ti] vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [Bav]ati saYjYA=DAtu
 8. Bava[ti] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l]
 9. [Bav]al saYjYA=aNga[ref=-->8], 
10. Bava[ti] pada=parasmE
11. Bava[ti] puruza=praTama, 
12. Bav[a]ti saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]
13. Bav[a]ti saYjYA=sArvaDAtuka, 
14. [Bav]ati saYjYA=aNga[ref=-->12]
15. Bava[ti] sTAnin=-->8
16. Bava[ti] saYjYA=tiN

Initial conditions must tell that the number of {s BAva} in {se BAvaprayoga} is {se eka}.

The table-tiN function updates the substring of the phone defined by sTAnin range Bava[l] replacing l with ti

Execution of this rule will trigger the try in A3.1.68

Compare A3.4.78 in rules.xml. I like using refid because it is more precise. You had sTAnin="pratyaya"; what if there is more than one pratyaya attribute? Also I did not see which rule added saYjYA="tiN" and A1.4.14 references it so I added it here.


A3.1.68 try executedComments
[The affix 1] ŚaP is introduced [after 2 a verbal stem before sārvadhātuka 
l-substitutes 67] to denote the agent (kartár-i).

<rule n="A3.1.68" s="kartari Sap" type="viDi" apodita="A3.1.67">
  <pUrva saYjYA="DAtu"/>
  <para saYjYA="pratyaya[bare=^l$]">
    <arTa prayoga="kartf"/>
  </para>
  <AdeSa saYjYA="pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]" phone="a"/>
    <try after="tiN-viDi">
      <para saYjYA="sArvaDAtuka" sTAnin="pratyaya[bare=^l$]">
        <arTa prayoga="kartf"/>
      </para>
      <AdeSa keep="yes"/><!-- keep the provisional AdeSa -->
    </try>
    <otherwise>
      <AdeSa keep="no" comment="return to apodita"/>
    </otherwise>
  </AdeSa>
</rule>

Bavati
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. Bava[ti] vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [Bav]ati saYjYA=DAtu
 8. Bava[ti] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l]
 9. [Bav]al saYjYA=aNga[ref=-->8], 
10. Bava[ti] pada=parasmE
11. Bava[ti] puruza=praTama, 
12. Bav[a]ti saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]
13. Bav[a]ti saYjYA=sArvaDAtuka, 
14. [Bav]ati saYjYA=aNga[ref=-->12]
15. Bava[ti] sTAnin=-->8
16. Bava[ti] saYjYA=tiN

<constant name="tiN-viDi" value="A3.4.78"/> is defined in constants section.

Note that the sTAnin attribute is a pointer to attribute 8 which matches the sTAnin attribute in the para (why para?)

Had <AdeSa keep="no"> been executed, state would have been rolled to where?


After applying A1.4.14Comments
[The t.t. 1] padá denotes an item terminating in (°-antam) (nominal ending) 
sUP or (l-substitute) tiṄ triplet.Bavati	

<rule n="A1.4.14" s="suptiNantaM padam" type="saYjYA">
  <!-- put in ruleset or trigger at the time of the introduction of sup or tiN -->
  <uddeSya>
    <or>
      <avayava saYjYA="sup" locus="anta"/>
      <avayava saYjYA="tiN" locus="anta"/>
    </or>
  </uddeSya>
  <AdeSa saYjYA="pada"/>
</rule>

Bavati
 1. * * Pala=sattA
 2. * * kAla=vartamAna  (the present tense)
 3. Bava[ti] vacana=eka
 4. * * syntax=samAnADikaraRa.3rdperson
 5. * * prayoga=kartf
 6. * * kAraka=kartf
 7. [Bav]ati saYjYA=DAtu
 8. Bava[ti] saYjYA=pratyaya[slp=la~w, upadeSa=law, bare=l]
 9. [Bav]al saYjYA=aNga[ref=-->8], 
10. Bava[ti] pada=parasmE
11. Bava[ti] puruza=praTama, 
12. Bav[a]ti saYjYA=pratyaya[slp=Sap, upadeSa=Sap, bare=a, it=S, it=p]
13. Bav[a]ti saYjYA=sArvaDAtuka, 
14. [Bav]ati saYjYA=aNga[ref=-->12]
15. Bava[ti] sTAnin=-->8
16. Bava[ti] saYjYA=tiN
17. [Bavati] saYjYA=pada

Final Output of the Derivation

The final output of the derivation is an XML representation of the final state, e.g.

<derivation form="Bavati">
  <attribute id="1" offset="-1" length="-1" name="Pala", value="sattA"/>
  <attribute id="2" offset="-1" length="-1" name="kAla" value="vartamAna"/>
  <attribute id="3" offset="4" length="2" name="vacana" value="eka"/>
  <attribute id="4" offset="-1" length="-1" name="syntax" value="samAnADikaraRa.3rdperson"/>
  <attribute id="5" offset="-1" length="-1" name="prayoga" value="kartf"/>
  <attribute id="6" offset="-1" length="-1" name="kAraka" value="kartf"/>
  <attribute id="7" offset="0" length="3" name="saYjYA" value="DAtu"/>
  <attribute id="8" offset="4" length="2" name="saYjYA" value="pratyaya">
    <property name="slp" value="la~w"/>
    <property name="upadeSa" value="law"/>
    <property name="bare" value="l"/>
  </attribute>
  <attribute id="9" offset="0" length="3" name="saYjYA" value="aNga">
    <property ref="8"/>
  </attribute>
  <attribute id="10" offset="4" length="2" name="pada" value="parasmE"/>
  <attribute id="11" offset="4" length="2" name="puruza" value="praTama"/>
  <attribute id="12" offset="3" length="1" name="saYjYA" value="pratyaya">
    <property name="slp" value="Sap"/>
    <property name="upadeSa" value="Sap"/>
    <property name="bare" value="a"/>
    <property name="it" value="S"/>
    <property name="it" value="p"/>
  </attribute>
  <attribute id="13" offset="3" length="1" name="saYjYA" value="sArvaDAtuka"/>
  <attribute id="14" offset="0" length="3" name="saYjYA" value="aNga">
   <property name="ref" value="12"/>
  </attribute>
  <attribute id="15" offset="4" length="2" name="sTAnin" value="8"/>
  <attribute id="16" offset="4" length="2" name="saYjYA" value="tiN"/>
  <attribute id="17" offset="0" length="6" name="saYjYA" value="pada"/>
</derivation>