+
    hj                    *   R t ^ RIHt ^ RIHtHt  ! R R4      t ! R R]4      t] ! R R]4      4       t] ! R	 R
]4      4       t	] ! R R]4      4       t
] ! R R]4      4       t] ! R R]4      4       t] ! R R]4      4       t] ! R R]4      4       t] ! R R]4      4       t ! R R]4      t] ! R R]4      4       t] ! R R]4      4       t] ! R R]4      4       t] ! R R ]4      4       t] ! R! R"]4      4       t] ! R# R$]4      4       t] ! R% R&]4      4       t] ! R' R(]4      4       t] ! R) R*]4      4       t] ! R+ R,]4      4       t] ! R- R.]4      4       t] ! R/ R0]4      4       t] ! R1 R2]4      4       t] ! R3 R4]4      4       t]t ] ! R5 R6]4      4       t!] ! R7 R8]4      4       t"] ! R9 R:]4      4       t#] ! R; R<]4      4       t$] ! R= R>]4      4       t%] ! R? R@]4      4       t&] ! RA RB]4      4       t'] ! RC RD]4      4       t(RE# )FaU  AST node definitions for MicroBasic.

Shape follows the confirmed grammar in docs/reverse_engineering.md plus the
manual's documented syntax for constructs whose bytecode we didn't need to
special-case at the AST level (e.g. compound assignment desugars to a plain
AssignStmt at parse time -- see parser.py -- so there's no AugAssign node).
)annotations)	dataclassfieldc                      ] tR t^tRtRtR# )NodezBase class for all AST nodes. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       o\\thalassa.shore.mbari.org\ProjectLibrary\ESP\FIDO\PumpController\compiler\src\microbasic_compiler\ast_nodes.pyr   r      s    'r   r   c                      ] tR t^tRtR# )Exprr   Nr	   r
   r   r   r   r   r   r   r   r          r   r   c                  "    ] tR t^t$ R]R&   RtR# )
IntLiteralintvaluer   Nr	   r
   r   r   __annotations__r   r   r   r   r   r          Jr   r   c                  "    ] tR t^t$ R]R&   RtR# )BoolLiteralboolr   r   Nr   r   r   r   r   r      s    Kr   r   c                  "    ] tR t^"t$ R]R&   RtR# )StringLiteralstrr   r   Nr   r   r   r   r    r    "   r   r   r    c                  0    ] tR t^'t$ R]R&   RtR]R&   RtR# )VarRefr!   nameNExpr | Noneindexr   )r	   r
   r   r   r   r&   r   r   r   r   r#   r#   '   s    
IE;r   r#   c                  ,    ] tR t^-t$ R]R&   R]R&   RtR# )UnaryOpr!   opr   operandr   Nr   r   r   r   r(   r(   -   s    GMr   r(   c                  6    ] tR t^3t$ R]R&   R]R&   R]R&   RtR# )BinaryOpr!   r)   r   leftrightr   Nr   r   r   r   r,   r,   3   s    G
JKr   r,   c                  B    ] tR t^:t$ RtR]R&   ]! ]R7      tR]R&   Rt	R# )	CallzA function call used as an expression, e.g. GetValue(_TEMP, 1).

Also doubles as a statement (SetCommand(...), SetConfig(...), Wait(...))
when wrapped in ExprStmt -- see below.
r!   r$   default_factory
list[Expr]argsr   N)
r	   r
   r   r   r   r   r   listr4   r   r   r   r   r0   r0   :   s    
 IT2D*2r   r0   c                  :    ] tR t^Et$ RtR]R&   R]R&   R]R&   RtR# )	
IncDecExprz8++x / --x / x++ / x-- used where the result is consumed.r!   varr)   r   prefixr   Nr	   r
   r   r   r   r   r   r   r   r   r7   r7   E   s    B	HGLr   r7   c                      ] tR t^OtRtR# )Stmtr   Nr   r   r   r   r<   r<   O   r   r   r<   c                  4    ] tR t^St$ ]! ]R7      tR]R&   RtR# )Programr1   
list[Stmt]
statementsr   N)	r	   r
   r   r   r   r5   r@   r   r   r   r   r   r>   r>   S   s    "48J
8r   r>   c                  "    ] tR t^Xt$ R]R&   RtR# )Labelr!   r$   r   Nr   r   r   r   rB   rB   X   s    
Ir   rB   c                  :    ] tR t^]t$ R]R&   R]R&   RtR]R&   RtR# )DimStmtr!   r$   var_typeNz
int | None	array_lenr   )r	   r
   r   r   r   rF   r   r   r   r   rD   rD   ]   s    
IM Iz r   rD   c                      ] tR t^dtRtRtR# )OptionExplicitStmtzt`Option Explicit` directive. Accepted and currently a no-op --
codegen doesn't yet enforce declare-before-use. TODO.r   Nr   r   r   r   rH   rH   d   s    =r   rH   c                  0    ] tR t^jt$ RtR]R&   R]R&   RtR# )
AssignStmta   Always a plain '=' by the time this reaches codegen -- compound
assignment operators (+=, -=, *=, /=, <<=, >>=) are desugared into this
(target = target op value) during parsing, since that's confirmed to be
exactly how the real compiler treats them (see reverse_engineering.md,
batch 3).r#   targetr   r   r   Nr:   r   r   r   rJ   rJ   j   s    
 NKr   rJ   c                  V    ] tR t^ut$ R]R&   R]R&   ]! ]R7      tR]R&   RtR	]R
&   Rt	R# )IfStmtr   	conditionr?   
then_blockr1   zlist[tuple[Expr, list[Stmt]]]elseif_clausesNzlist[Stmt] | None
else_blockr   )
r	   r
   r   r   r   r   r5   rP   rQ   r   r   r   r   rM   rM   u   s(    O49$4ON1O$(J!(r   rM   c                  "    ] tR t^}t$ R]R&   RtR# )GotoStmtr!   labelr   Nr   r   r   r   rS   rS   }   r   r   rS   c                  "    ] tR t^t$ R]R&   RtR# )	GosubStmtr!   rT   r   Nr   r   r   r   rV   rV      r   r   rV   c                      ] tR t^tRtR# )
ReturnStmtr   Nr   r   r   r   rX   rX          r   rX   c                      ] tR t^tRtR# )TerminateStmtr   Nr   r   r   r   r[   r[      rY   r   r[   c                  "    ] tR t^t$ R]R&   RtR# )WaitStmtr   millisecondsr   Nr   r   r   r   r]   r]      s    r   r]   c                  4    ] tR t^t$ ]! ]R7      tR]R&   RtR# )	PrintStmtr1   r3   r4   r   N)	r	   r
   r   r   r   r5   r4   r   r   r   r   r   r`   r`      s    T2D*2r   r`   c                  &    ] tR t^t$ RtR]R&   RtR# )ExprStmtzHA bare call used for side effects, e.g. SetCommand(...), SetConfig(...).r0   callr   Nr:   r   r   r   rb   rb      s
    R
Jr   rb   c                  0    ] tR t^t$ RtR]R&   R]R&   RtR# )
IncDecStmtzBare x++ / x-- / ++x / --x as a full statement (result discarded).
Compiles to the compact 3-instruction form (LOAD, INC/DEC, STORE)
rather than IncDecExpr's 4-instruction consumed form.r!   r8   r)   r   Nr:   r   r   r   re   re      s    = 
HGr   re   c                  "    ] tR t^t$ R]R&   RtR# )ExitStmtLoopKindkindr   Nr   r   r   r   rg   rg          
Nr   rg   c                  "    ] tR t^t$ R]R&   RtR# )ContinueStmtrh   ri   r   Nr   r   r   r   rl   rl      rj   r   rl   c                  B    ] tR t^t$ RtR]R&   ]! ]R7      tR]R&   Rt	R# )		WhileStmtzCovers both `While...End While` and `Do While...Loop` -- confirmed
byte-identical, so the parser normalizes both source forms to this node.r   rN   r1   r?   bodyr   N
r	   r
   r   r   r   r   r   r5   ro   r   r   r   r   rn   rn      s    POT2D*2r   rn   c                  B    ] tR t^t$ RtR]R&   ]! ]R7      tR]R&   Rt	R# )	DoUntilStmtz`Do Until <cond> ... Loop` -- pre-test, exits when condition becomes
true (mirror image of WhileStmt, which exits when condition is false).r   rN   r1   r?   ro   r   Nrp   r   r   r   rr   rr      s    NOT2D*2r   rr   c                  0    ] tR t^t$ RtR]R&   R]R&   RtR# )DoLoopWhileStmtzh`Do ... Loop While <cond>` -- post-test, body always runs >= 1 time,
loops back while condition is true.r?   ro   r   rN   r   Nr:   r   r   r   rt   rt      s    +
Or   rt   c                  0    ] tR t^t$ RtR]R&   R]R&   RtR# )DoLoopUntilStmtz{`Do ... Loop Until <cond>` -- post-test, body always runs >= 1 time,
loops back while condition is false (exits once true).r?   ro   r   rN   r   Nr:   r   r   r   rv   rv      s    >
Or   rv   c                  `    ] tR t^t$ RtR]R&   R]R&   R]R&   R]R&   ]! ]R	7      tR
]R&   Rt	R# )ForTraditionalStmtzTraditional `For var = init To limit [Step step] ... Next`.
Confirmed to allocate two hidden Integer slots (limit, step) and use a
step-sign-generic exit test -- see codegen.py.r!   r8   r   initlimitr%   stepr1   r?   ro   r   Nrp   r   r   r   rx   rx      s-    6 
H
JK
T2D*2r   rx   c                  `    ] tR t^t$ RtR]R&   R]R&   R]R&   R]R&   ]! ]R	7      tR
]R&   Rt	R# )ForCStyleStmtz`For var = init AndWhile cond [Evaluate stmt] ... Next`. Confirmed:
if no Evaluate clause is given, the compiler auto-increments var by 1
each iteration (reverse_engineering.md, batch 3).r!   r8   r   ry   rN   zStmt | Noneevaluater1   r?   ro   r   Nrp   r   r   r   r}   r}      s-    9 
H
JOT2D*2r   r}   N))r   
__future__r   dataclassesr   r   r   r   r   r   r    r#   r(   r,   r0   r7   r<   r>   rB   rD   rH   rJ   rM   rS   rV   rX   r[   r]   r`   rb   re   r!   rh   rg   rl   rn   rr   rt   rv   rx   r}   r   r   r   <module>r      se   # (( (	4 	    $   D   T  
 d  
 t   34 3 3   	4 	 9d 9 9 D   !d ! ! = = =
    )T ) ) t      	 	 	 	D 	 	 t   3 3 3 t  
     t   4   3 3 3 3$ 3 3 d   d   3 3 3 3D 3 3r   