diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index f0852d91..ede02426 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -105,8 +105,8 @@ GetDrivenFunctions { } OptSwitch { - OptDrive = &DriveSentence; - OptInline = &InlineSentence + OptDrive = Drive; + OptInline = Inline; } /* Осуществляет прогонку или оптимизацию в зависимости от ключа */ @@ -203,7 +203,7 @@ IsLexpr-Aux { /* Осуществляет попытку прогонки или встраивания в функции - == t.Function* + == t.Function* Возвращает модифицированную функцию и порожденные из прогонки или встраивания @@ -211,13 +211,14 @@ IsLexpr-Aux { OptimizeF { (Function s.ScopeClass (e.Name) Sentences e.Sentences) - ((e.OptNames) e.OptFunctions) s.OptSentence + ((e.OptNames) e.OptFunctions) s.Mode = : (e.NewFunctions) e.NewSentences = ((e.SntAcc e.NewSentences) (e.FunAcc e.NewFunctions)); @@ -231,59 +232,17 @@ OptimizeF { } /* - Осуществляет попытку встраивания отдельного предложения - + == (t.Func?) t.Sentence* */ -InlineSentence { - ((e.Left) (e.Right)) t.InlineInfo - , : t.Res e.Right^ +OptSentence { + ((e.Left) (e.Right)) t.DriveInfo s.Mode + , : t.Res e.Right^ , : False - = ; + = ; - t.Sentence ((e.OptNames) e.Left) = () t.Sentence -} - -/* Осуществляет попытку прогонки отдельного предложения вида pattern = expr - - == (t.Func?) t.Sentence* -*/ - -DriveSentence { - ((e.Left) (e.Right)) t.DriveInfo - , : t.Res e.Right^ - , : False - = ; - - ((e.Left) (e.Right)) t.InlineInfo - , : t.Res e.Right^ - , : False - = ; - - t.Sentence ((e.OptNames) e.Left) = () t.Sentence -} - -/* - - = (t.Func?) t.Sentence -*/ - -InlineSentence-Aux { - /* Встраивание */ - ((e.Left) (e.Right)) t.Res t.DriveInfo - = ; -} - -/* - - = (t.Func?) t.Sentence* -*/ - -DriveSentence-Aux { - /* Прогонка */ - ((e.Left) (e.Right)) t.Res t.DriveInfo - = ; + t.Sentence ((e.OptNames) e.Left) s.Mode = () t.Sentence } OptSentence-Aux { @@ -424,23 +383,10 @@ DropLeft { } /* - == Success t.Function | Failure + t.Function := (Drive s.ScopeClass (e.Name) e.Body) */ -FindInlineInfo { - t.InlineInfo e.Name = ; -} - -/* - == Success t.DriveInfo | Failure - t.DriveInfo := (Drive s.ScopeClass (e.Name) e.Body) -*/ - -FindDriveInfo { - t.DriveInfo e.Name = -} - FindOptInfo { t.DriveInfo e.Name , e.Name : e.Prefix '*' s.N @@ -472,62 +418,48 @@ CutSUF { e.Prefix = e.Prefix; } - -/* - == t.Found e.Expr - - t.Found ::= None | (CallBrackets e.Arg) -*/ - -FindDriveCall { - t.DriveInfo e.Expr - = - : (t.DriveInfo^ t.Found) e.Expr^ - = t.Found e.Expr -} - /* - == t.Found e.Expr + == t.Found e.Expr t.Found ::= None | (CallBrackets e.Arg) */ -FindInlineCall { +FindOptCall { t.InlineInfo e.Expr - = + = : (t.InlineInfo^ t.Found) e.Expr^ = t.Found e.Expr } FindOptimizedCall { - s.Filter t.DriveInfo e.Expr - = ; + t.DriveInfo e.Expr + = ; } FindOptimizedCall-Term { - s.Filter (t.DriveInfo None) (Brackets e.Expr) - = + (t.DriveInfo None) (Brackets e.Expr) + = : (t.DriveInfo^ t.Found) e.Expr^ = (t.DriveInfo t.Found) (Brackets e.Expr); - s.Filter (t.DriveInfo None) (ADT-Brackets (e.Name) e.Expr) - = + (t.DriveInfo None) (ADT-Brackets (e.Name) e.Expr) + = : (t.DriveInfo^ t.Found) e.Expr^ = (t.DriveInfo t.Found) (ADT-Brackets (e.Name) e.Expr); - s.Filter (t.DriveInfo None) (CallBrackets (Symbol Name e.Name) e.Expr) + (t.DriveInfo None) (CallBrackets (Symbol Name e.Name) e.Expr) , : True - , : Success t.Info + , : Success t.Info = (t.DriveInfo (CallBrackets (Symbol Name e.Name) e.Expr)) (TkVariable 'e' DRIVEN 0); * TODO: раскомментировать код ниже, когда будет реализовываться поддрежка * TODO: активных аргументов функций /* - s.Filter (t.DriveInfo None) (CallBrackets (Symbol Name e.Name) e.Expr) - , : Success t.Info - = + (t.DriveInfo None) (CallBrackets (Symbol Name e.Name) e.Expr) + , : Success t.Info + = : { (t.DriveInfo^ None) e.Expr^ = (t.DriveInfo (CallBrackets (Symbol Name e.Name) e.Expr)) @@ -538,12 +470,12 @@ FindOptimizedCall-Term { }; */ - s.Filter (t.DriveInfo None) (CallBrackets t.F e.Expr) - = + (t.DriveInfo None) (CallBrackets t.F e.Expr) + = : (t.DriveInfo^ t.Found) e.Expr^ = (t.DriveInfo t.Found) (CallBrackets t.F e.Expr); - s.Filter (t.DriveInfo t.Found) t.AnyTerm + (t.DriveInfo t.Found) t.AnyTerm = (t.DriveInfo t.Found) t.AnyTerm; }