@@ -7,26 +7,30 @@ from typing_extensions import final
77__all__ = [
88 "ActionCommand" ,
99 "AddRuleset" ,
10- "Best" ,
1110 "BiRewriteCommand" ,
1211 "Bool" ,
12+ "CSVPrintFunctionMode" ,
1313 "Call" ,
1414 "Change" ,
1515 "Check" ,
1616 "Constructor" ,
1717 "Datatype" ,
1818 "Datatypes" ,
19+ "DefaultPrintFunctionMode" ,
1920 "Delete" ,
2021 "EGraph" ,
2122 "EggSmolError" ,
2223 "EgglogSpan" ,
2324 "Eq" ,
2425 "Expr_" ,
2526 "Extract" ,
27+ "ExtractBest" ,
28+ "ExtractVariants" ,
2629 "Fact" ,
2730 "Fail" ,
2831 "Float" ,
2932 "Function" ,
33+ "FunctionCommand" ,
3034 "IdentSort" ,
3135 "Include" ,
3236 "Input" ,
@@ -35,10 +39,14 @@ __all__ = [
3539 "Lit" ,
3640 "NewSort" ,
3741 "Output" ,
42+ "OverallStatistics" ,
3843 "Panic" ,
3944 "PanicSpan" ,
4045 "Pop" ,
46+ "PrintAllFunctionsSize" ,
4147 "PrintFunction" ,
48+ "PrintFunctionOutput" ,
49+ "PrintFunctionSize" ,
4250 "PrintOverallStatistics" ,
4351 "PrintSize" ,
4452 "Push" ,
@@ -53,13 +61,13 @@ __all__ = [
5361 "RunConfig" ,
5462 "RunReport" ,
5563 "RunSchedule" ,
64+ "RunScheduleOutput" ,
5665 "RustSpan" ,
5766 "Saturate" ,
5867 "Schema" ,
5968 "Sequence" ,
6069 "SerializedEGraph" ,
6170 "Set" ,
62- "SetOption" ,
6371 "Sort" ,
6472 "SrcFile" ,
6573 "String" ,
@@ -73,13 +81,18 @@ __all__ = [
7381 "Unit" ,
7482 "UnstableCombinedRuleset" ,
7583 "UserDefined" ,
84+ "UserDefinedCommandOutput" ,
85+ "UserDefinedOutput" ,
7686 "Var" ,
7787 "Variant" ,
78- "Variants" ,
7988]
8089
8190@final
8291class SerializedEGraph :
92+ @property
93+ def truncated_functions (self ) -> list [str ]: ...
94+ @property
95+ def discarded_functions (self ) -> list [str ]: ...
8396 def inline_leaves (self ) -> None : ...
8497 def saturate_inline_leaves (self ) -> None : ...
8598 def to_dot (self ) -> str : ...
@@ -106,9 +119,7 @@ class EGraph:
106119 ) -> None : ...
107120 def parse_program (self , __input : str , / , filename : str | None = None ) -> list [_Command ]: ...
108121 def commands (self ) -> str | None : ...
109- def run_program (self , * commands : _Command ) -> list [str ]: ...
110- def extract_report (self ) -> _ExtractReport | None : ...
111- def run_report (self ) -> RunReport | None : ...
122+ def run_program (self , * commands : _Command ) -> list [_CommandOutput ]: ...
112123 def serialize (
113124 self ,
114125 root_eclasses : list [_Expr ],
@@ -356,6 +367,13 @@ class IdentSort:
356367 sort : str
357368 def __init__ (self , ident : str , sort : str ) -> None : ...
358369
370+ @final
371+ class UserDefinedCommandOutput : ...
372+
373+ @final
374+ class Function :
375+ name : str
376+
359377@final
360378class RunReport :
361379 updated : bool
@@ -375,20 +393,80 @@ class RunReport:
375393 rebuild_time_per_ruleset : dict [str , timedelta ],
376394 ) -> None : ...
377395
396+ ##
397+ # Command Outputs
398+ ##
399+
400+ @final
401+ class PrintFunctionSize :
402+ size : int
403+ def __init__ (self , size : int ) -> None : ...
404+
405+ @final
406+ class PrintAllFunctionsSize :
407+ sizes : list [tuple [str , int ]]
408+ def __init__ (self , sizes : list [tuple [str , int ]]) -> None : ...
409+
378410@final
379- class Variants :
411+ class ExtractVariants :
380412 termdag : TermDag
381413 terms : list [_Term ]
382414 def __init__ (self , termdag : TermDag , terms : list [_Term ]) -> None : ...
383415
384416@final
385- class Best :
417+ class ExtractBest :
386418 termdag : TermDag
387419 cost : int
388420 term : _Term
389421 def __init__ (self , termdag : TermDag , cost : int , term : _Term ) -> None : ...
390422
391- _ExtractReport : TypeAlias = Variants | Best
423+ @final
424+ class OverallStatistics :
425+ report : RunReport
426+ def __init__ (self , report : RunReport ) -> None : ...
427+
428+ @final
429+ class RunScheduleOutput :
430+ report : RunReport
431+ def __init__ (self , report : RunReport ) -> None : ...
432+
433+ @final
434+ class PrintFunctionOutput :
435+ function : Function
436+ termdag : TermDag
437+ terms : list [tuple [_Term , _Term ]]
438+ mode : _PrintFunctionMode
439+ def __init__ (
440+ self , function : Function , termdag : TermDag , terms : list [tuple [_Term , _Term ]], mode : _PrintFunctionMode
441+ ) -> None : ...
442+
443+ @final
444+ class UserDefinedOutput :
445+ output : UserDefinedCommandOutput
446+ def __init__ (self , output : UserDefinedCommandOutput ) -> None : ...
447+
448+ _CommandOutput : TypeAlias = (
449+ PrintFunctionSize
450+ | PrintAllFunctionsSize
451+ | ExtractVariants
452+ | ExtractBest
453+ | OverallStatistics
454+ | RunScheduleOutput
455+ | PrintFunctionOutput
456+ | UserDefinedOutput
457+ )
458+
459+ ##
460+ # Print Function Modes
461+ ##
462+
463+ @final
464+ class DefaultPrintFunctionMode : ...
465+
466+ @final
467+ class CSVPrintFunctionMode : ...
468+
469+ _PrintFunctionMode : TypeAlias = DefaultPrintFunctionMode | CSVPrintFunctionMode
392470
393471##
394472# Schedules
@@ -442,12 +520,6 @@ _Subdatatypes: TypeAlias = SubVariants | NewSort
442520# Commands
443521##
444522
445- @final
446- class SetOption :
447- name : str
448- value : _Expr
449- def __init__ (self , name : str , value : _Expr ) -> None : ...
450-
451523@final
452524class Datatype :
453525 span : _Span
@@ -469,7 +541,7 @@ class Sort:
469541 def __init__ (self , span : _Span , name : str , presort_and_args : tuple [str , list [_Expr ]] | None = None ) -> None : ...
470542
471543@final
472- class Function :
544+ class FunctionCommand :
473545 span : _Span
474546 name : str
475547 schema : Schema
@@ -531,8 +603,12 @@ class Check:
531603class PrintFunction :
532604 span : _Span
533605 name : str
534- length : int
535- def __init__ (self , span : _Span , name : str , length : int ) -> None : ...
606+ length : int | None
607+ filename : str | None
608+ mode : _PrintFunctionMode
609+ def __init__ (
610+ self , span : _Span , name : str , length : int | None , filename : str | None , mode : _PrintFunctionMode
611+ ) -> None : ...
536612
537613@final
538614class PrintSize :
@@ -613,11 +689,10 @@ class UnstableCombinedRuleset:
613689 def __init__ (self , span : _Span , name : str , rulesets : list [str ]) -> None : ...
614690
615691_Command : TypeAlias = (
616- SetOption
617- | Datatype
692+ Datatype
618693 | Datatypes
619694 | Sort
620- | Function
695+ | FunctionCommand
621696 | AddRuleset
622697 | RuleCommand
623698 | RewriteCommand
0 commit comments