From b73aa8fc69962740a10a23683604c479b47dabfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 26 Jun 2021 17:32:41 +0300 Subject: [PATCH 001/208] =?UTF-8?q?FIXED:=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB?= =?UTF-8?q?=D0=B5=D0=BC=D0=B0=20=D1=81=D0=BE=C2=A0=D1=81=D0=BF=D0=B5=D1=86?= =?UTF-8?q?=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B5=D0=B9=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BC=D1=8B=D0=BA=D0=B0=D0=BD=D0=B8=D0=B9=20(#251,?= =?UTF-8?q?=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ранее специализация замыкания {{ &F CONTENT }} осуществлялась как специализация фиктивного вызова . Оптимизатор строил новый вызов , из которого восстанавливалось замыкание {{ &F@1 CONTENT′ }}. Добавлять и удалять фиктивную переменную e.@ было безопасно, т.к. она была в позиции динамического параметра, позиция параметра не менялась (оставалась последней) и во внутрь функции она не протекала. Теперь же при специализации это имя может протечь внутрь экземпляра, внутри экземпляра может оказаться другое замыкание, в контексте которого будет переменная e.@. Добавление e.@ в конец вызовет конфликт имён. ---- В коде есть некоторый костыль, который проистекает из отсутствия поддержки подавления предупреждений. Исходники намеренно собираются с -Werror, а в данном коде было бы разумно явно добавить «подозрительную» (#290) повторную переменную. Пришлось достигать эту проверку более громоздким куском исходного кода. --- autotests/opt-tree-spec15.ref | 27 +++++++++++++++++++++++++++ src/compiler/OptTree-Spec.ref | 19 +++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 autotests/opt-tree-spec15.ref diff --git a/autotests/opt-tree-spec15.ref b/autotests/opt-tree-spec15.ref new file mode 100644 index 00000000..a83a28d3 --- /dev/null +++ b/autotests/opt-tree-spec15.ref @@ -0,0 +1,27 @@ +* TREE + +$ENTRY Go { + /* empty */ + = : (R5 (Config) 'srcname.ref') + = <> : s.Fn + = : (R5 (Config) 'srcname-decompiled.ref') + = : (FileRowCol (1 1) 'srcname-decompiled.ref') + = /* empty */; +} + +LoadAST { + t.Config R5 e.SrcName = (R5 t.Config e.SrcName); + + t.Config RSL e.SrcName + = e.SrcName : e.BaseName '.rsl' + = e.BaseName '-decompiled.ref' : e.DecompiledName + = (FileRowCol (1 1) e.DecompiledName) : t.ErrorPos + = { + /* empty */ + = : t.AST + = { + True = t.AST; + False = t.ErrorPos; + }; + } +} diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 0d2ecab0..b32be7a3 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -427,12 +427,27 @@ SpecTerm { } : s.TrySpecCall + = : e.UsedVars + = : (e._) e.eClosureArg = : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) - (CallBrackets e.ClosureContent^ (Var 'e@')) + (CallBrackets e.ClosureContent^ (Var e.eClosureArgOut)) + + /* + Проверка на то, что e.eClosureArg и e.eClosureArgOut равны. Проверить + через повторную переменную нельзя, т.к. стоит режим -Werror для + сборки исходников. + TODO: исправить при реализации подавления предупреждений. + */ + = e.eClosureArgOut + : { + e.eClosureArg = /* пусто */; + e._ = <{}> + } + : /* пусто */ = e.ClosureContent : { From 3354acf7864aed8e18935ef278486e2ee52f5972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 26 Jun 2021 22:09:26 +0300 Subject: [PATCH 002/208] =?UTF-8?q?=D0=9F=D0=BE=D0=B2=D1=8B=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B0?= =?UTF-8?q?=20=D1=87=D0=B8=D1=81=D0=BB=D0=B0=20=D1=88=D0=B0=D0=B3=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=B0=D0=BC=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=BF=D0=B8=D0=BB=D1=8F=D1=82=D0=BE=D1=80=D0=B0=20?= =?UTF-8?q?(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Самоприменение выполняется в режиме set RLMAKE_FLAGS=-X-OiDPRS --- src/compiler/@refal-5-lambda-diagnostics.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/@refal-5-lambda-diagnostics.ini b/src/compiler/@refal-5-lambda-diagnostics.ini index d2d8c2b7..2f749f27 100644 --- a/src/compiler/@refal-5-lambda-diagnostics.ini +++ b/src/compiler/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ memory-limit = 70000000 -step-limit = 1000000000 +step-limit = 2000000000 idents-limit = 5000 enable-debugger = false From 6b38015c377db5239f8d263a03f4b6982ce0cfd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 26 Jun 2021 22:10:30 +0300 Subject: [PATCH 003/208] =?UTF-8?q?FIXED:=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=D0=BD=D0=BA=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9?= =?UTF-8?q?=20=D1=81=C2=A0=D0=BF=D1=83=D1=81=D1=82=D1=8B=D0=BC=20=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D0=BE=D0=BC=20=D0=BF=D1=80=D0=B8=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D0=BB=D0=B0=20=D0=BA=C2=A0=D0=BF=D0=B0=D0=B4=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8E=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ошибка была внесена в коммите 204265358888 в рамках задачи #303. --- autotests/opt-tree-drive4-empty.ref | 9 +++++++++ src/compiler/OptTree-Drive.ref | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 autotests/opt-tree-drive4-empty.ref diff --git a/autotests/opt-tree-drive4-empty.ref b/autotests/opt-tree-drive4-empty.ref new file mode 100644 index 00000000..7d42c553 --- /dev/null +++ b/autotests/opt-tree-drive4-empty.ref @@ -0,0 +1,9 @@ +* TREE + +$ENTRY Go { + /* empty */ = /* empty */; + ZZ = ; +} + +$DRIVE D; +D {} diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index d1a64780..e46dba7c 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -270,6 +270,9 @@ FormatOptFunctions { (Function s.ScopeClass (e.Name) Sentences e.Sentences) = (e.Names-B e.Names-E) (s.Label (e.Name) Sentences e.Sentences); + + (e.Names) (Function s._ (e._) Sentences /* пусто */) + = (e.Names) /* функции без предложений пропускаем */; } () e.Functions > From 12c3f015ac8e20c815fea9686c2d9b5e3c8e99c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 27 Jun 2021 11:31:18 +0300 Subject: [PATCH 004/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B5=D0=B8=D1=81=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=B7=D1=83=D0=B5=D0=BC=D1=8B=D0=B5=20=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D0=B8=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 3 +- src/compiler/OptTree-StopRelation.ref | 41 +++------------------------ 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index b32be7a3..41175138 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -16,8 +16,7 @@ $EXTERN DisplayName; $EXTERN GlobalGen; *$FROM OptTree-StopRelation -$EXTERN OptTree-CanonizeTuple, OptTree-CanonizeExpr; -$EXTERN OptTree-CheckTupleStopRelation, OptTree-CheckExprStopRelation; +$EXTERN OptTree-CanonizeExpr, OptTree-CheckExprStopRelation; /** == e.AST^ diff --git a/src/compiler/OptTree-StopRelation.ref b/src/compiler/OptTree-StopRelation.ref index 6bc3be96..7cb911c4 100644 --- a/src/compiler/OptTree-StopRelation.ref +++ b/src/compiler/OptTree-StopRelation.ref @@ -5,16 +5,16 @@ $INCLUDE "LibraryEx"; */ /** - + == True == False - Проверяет выполнение отношения Хигмана-Крускала для двух кортежей. + Проверяет выполнение отношения Хигмана-Крускала для двух выражений. Возвращает True, если отношение выполняется, и False в ином случае. - Предполагается, что оба кортежа в канонической форме. + Предполагается, что оба выражения в канонической форме. - e.CurrentTuple, e.HistoryTuple ::= (e.CanonizedExpr)* + e.CurrentExpr, e.HistoryExpr ::= e.CanonizedExpr e.CanonizedExpr ::= t.CanonizedTerm* t.CanonizedTerm ::= (Symbol s.SymType e.SymInfo) @@ -26,30 +26,6 @@ $INCLUDE "LibraryEx"; | (ClosureBrackets t.CanonizedTerm*) | (CallBrackets t.Name t.CanonizedTerm*) */ -$ENTRY OptTree-CheckTupleStopRelation { - (/* пусто */) /* пусто */ = True; - - (e.CurrentTuple) e.HistoryTuple - , e.CurrentTuple : (e.CurrentExpr) e.CurrentTuple-Rest - , e.HistoryTuple : (e.HistoryExpr) e.HistoryTuple-Rest - , - : { - True - = ; - - False = False; - }; -} - -/** - - == True - == False - - e.CurrentExpr, e.HistoryExpr ::= e.CanonizedExpr -*/ $ENTRY OptTree-CheckExprStopRelation { (e.CurrentExpr) e.HistoryExpr /* Разделяем текущую сигнатуру на две части */ @@ -298,15 +274,6 @@ PartiallyContainsSignature { t.LastTerm; } -/** - == (e.CanonizedExpr)* - - * Убирает имена переменных в сигнатуре, оставляет их типы данных. -*/ -$ENTRY OptTree-CanonizeTuple { - e.Tuple = ) } e.Tuple> -} - /** == e.CanonizedExpr */ From c4c3e67ee523ca44f730b6531f492b75684d60d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 27 Jun 2021 12:25:10 +0300 Subject: [PATCH 005/208] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F:=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D0=BA=D0=B0=20=D0=BE=D1=82=D0=BD=D0=BE=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=A5=D0=B8=D0=B3=D0=BC=D0=B0=D0=BD=D0=B0?= =?UTF-8?q?-=D0=9A=D1=80=D1=83=D1=81=D0=BA=D0=B0=D0=BB=D0=B0=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit До оптимизации после самоприменения в режиме: set RLMAKE_FLAGS=-X-OiDPRS call makeself.bat set RLMAKE_FLAGS=-X-OiDS call makeself.bat со включённым профилем время работы составило 1590 секунд, где-то 50 % времени ушло на проверку отношения Хигмана-Крускала. В актуальной реализации время работы составило 575 секунд, отношение Хигмана-Крускала занимает где-то около процента. Подробности с логами профилировщика в issue. --- src/compiler/OptTree-StopRelation.ref | 256 +++----------------------- 1 file changed, 25 insertions(+), 231 deletions(-) diff --git a/src/compiler/OptTree-StopRelation.ref b/src/compiler/OptTree-StopRelation.ref index 7cb911c4..42a4738b 100644 --- a/src/compiler/OptTree-StopRelation.ref +++ b/src/compiler/OptTree-StopRelation.ref @@ -28,250 +28,44 @@ $INCLUDE "LibraryEx"; */ $ENTRY OptTree-CheckExprStopRelation { (e.CurrentExpr) e.HistoryExpr - /* Разделяем текущую сигнатуру на две части */ - , e.CurrentExpr : t.Term e.OtherPart - = ; - - (e.CurrentExpr) e.HistoryExpr - , e.CurrentExpr : /* пусто */ - = e.HistoryExpr - : { - /* пусто */ = True; - e._ = False; - }; + = ; } -/** - - == True - == False - - Одна итерация функции OptTree-CheckExprStopRelation. - - e.CurSig1 ::= t.Term* - e.CurSig2 ::= t.Term* - e.HistorySignature ::= t.Term* -*/ -DoCheckExprPairForRelation { - (e.CurSig1) (e.CurSig2) e.HistorySignature - - /* Проверяем, содержится ли полностью в e.CurSig1 */ - , : True - - = True; - - (e.CurSig1) (e.CurSig2) e.HistorySignature - - /* Проверяем, содержится ли полностью в e.CurSig2 */ - , : True - - = True; +CheckHKRelation { + e.CurrentExpr (/* пусто */) = True; + /* пусто */ (e.HistoryExpr) = False; - (e.CurSig1) (e.CurSig2) e.HistorySignature + t.Common e.CurrentExpr (t.Common e.HistoryExpr) + = ; - /* Проверяем, что часть e.HistorySignature содержится в e.CurSig1 */ - , - : True e.HistorySignature-Rest + t.CurrentTerm e.CurrentExpr (t.HistoryTerm e.HistoryExpr) + , : True + = ; - /* Проверяем, что оставшаяся часть содержится в e.CurSig2 */ - , - : True + (s.Brackets e.Inner) e.CurrentExpr (e.HistoryExpr) + , : e._ s.Brackets e._ + = ; - = True; + (ADT-Brackets (e.Name) e.Inner) e.CurrentExpr (e.HistoryExpr) + = ; - (e.CurSig1) (e.CurSig2) e.HistorySignature = False; + t.Skip e.CurrentExpr (e.HistoryExpr) + = ; } -/** - - == True - == False - - Проверяет, что выражение содержит сигнатуру. - - e.Expr ::= t.Term* - e.Signature ::= t.Term* -*/ -ContainsSignature { - (e.Expr-B e.Signature e.Expr-E) e.Signature - = True; - - /* - Если выражение и сигнатура из истории начинаются на одинаковый терм, - то выражение вкладывается в сигнатуру тогда и только тогда, когда - вкладываются их хвосты. - */ - (t.Common e.Expr) t.Common e.Signature - = ; - - /* - Оптимизация частнoго случая: аналогично можно поступить и с последним - общим термом. - */ - (e.Expr t.Common) e.Signature t.Common - = ; - - /* - Если первый токен у обеих сигнатур - скобки, - пытаемся их убрать у обеих сигнатур и посмотреть, - есть ли вложение без них - */ - ((s.TermType e.Inner) e.RestExpr) (s.TermType e.OtherInner) e.OtherRestExpr - , e.Inner : t.Inner-FirstTerm e.Inner-Rest - , e.OtherInner : t.OtherInner-FirstTerm e.OtherInner-Rest - - /* - Проверяем, что первый элемент - скобки, и - в зависимости от типа скобок определяем - её внутреннее выражение - */ - , s.TermType : - { - Brackets - = True e.Inner; - - ClosureBrackets - = True e.Inner; - - ADT-Brackets - , e.Inner - : (e.Name) e.ADT-Brackets-Inner-Rest - = True e.ADT-Brackets-Inner-Rest; - - CallBrackets - = True e.Inner; - - e.OtherTermType - = False; - } - : True e.Inner^ - - , e.Inner : - { - t.Inner-FirstTerm^ e.Inner-Rest^ - = ; - - e.Expr - = ; - } - : s.InnerCheckResult - - , s.InnerCheckResult - : True - - , e.RestExpr : - { - t.RestExpr-Term e.RestExpr-Rest - = ; - - e.Expr - = ; - } - : s.RestExprCheckResult - - , s.RestExprCheckResult - : True - - = True; - - ((s.TermType e.Inner) e.RestExpr) e.Signature - , e.Inner : t.Inner-FirstTerm e.Inner-Rest - = s.TermType - : { - Brackets - = ; - - ADT-Brackets - , e.Inner - : (e.Name) t.ADT-Brackets-Inner-FirstTerm e.ADT-Brackets-Inner-Rest - = ; - - CallBrackets - = ; - - ClosureBrackets - = ; - - Var - = ; - - Symbol - = ; - - s.OtherTermType - = False; - }; - - (e.Expr) e.Signature = False; +AllBrackets { + = Brackets CallBrackets ColdCallBrackets ClosureBrackets; } -/** - - == True e.SignaturePart - == False - - Проверяет, что выражение частично содержит сигнатуру. - Если была обнаружена часть сигнатуры, - содержащаяся в выражении, возвращает True, за которым - следует остальная часть сигнатуры. - Иначе возвращает False. - - e.Expr ::= t.Term* - e.Signature ::= t.Term* -*/ -PartiallyContainsSignature { - (e.Expr) e.Signature - /* Если выражение из истории пусто, возвращаем False */ - , e.Signature : /*пусто*/ - = False; - - (e.Expr) e.Signature - - /* Разделяем сигнатуру из истории на две части */ - , e.Signature : e.Signature-Part t.LastTerm - - /* Проверяем, что e.Signature-Part не пусто */ - , e.Signature-Part : t.FirstTerm e.OtherPart - - /* - Если текущая сигнатура содержит часть сигнатуры из истории, - возвращаем True и остальную часть, которую она не содержит. - */ - , - : True +CheckHKRelation-Term { + (s.Brackets e.CurrentExpr) (s.Brackets e.HistoryExpr) + , : e._ s.Brackets e._ + = ; - = True t.LastTerm; + (ADT-Brackets (e.Name) e.CurrentExpr) (ADT-Brackets (e.Name) e.HistoryExpr) + = ; - /* - Отщепляем последний терм от сигнатуры из истории и вызываем рекурсию, - в конце добавляем последний терм, который отщепили. - */ - (e.Expr) e.Signature-Part t.LastTerm - = - t.LastTerm; + t.CurrentTerm t.HistoryTerm = False; } /** From 4787b27d5fc6cc6122f52f5477b627b3a805d1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 27 Jun 2021 19:12:47 +0300 Subject: [PATCH 006/208] =?UTF-8?q?=D0=9C=D0=B8=D0=BA=D1=80=D0=BE=D0=BE?= =?UTF-8?q?=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?GrowDriveTree=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 7f7c4551..e459ed5a 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -156,6 +156,7 @@ GrowDriveTree { > : { (Generalize 1) e._DeletedTree + = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo^ = From 6bf1cb0d8f57c44b8fcfd2a188eb5f0f201c6394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 27 Jun 2021 19:35:01 +0300 Subject: [PATCH 007/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=D0=B8:=20=D1=80=D0=B0=D0=B7?= =?UTF-8?q?=D0=B1=D0=B8=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BB=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=BD=D0=B0=C2=A0=D0=BD=D0=B5=D1=81=D0=BA=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=BA=D0=BE=20=D0=BF=D1=80=D0=BE=D1=81=D1=82=D1=8B=D1=85=20(#3?= =?UTF-8?q?59)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Рекомендуется смотреть коммит с игнорированием пробельных символов. --- src/compiler/OptTree-Drive-Expr.ref | 83 +++++++------ src/compiler/OptTree-Spec.ref | 163 +++++++++++++++----------- src/compiler/OptTree-StopRelation.ref | 2 +- 3 files changed, 144 insertions(+), 104 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index e459ed5a..b4315b82 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -121,8 +121,7 @@ MakeDriveTree { GrowDriveTree { (s.CntNodes) (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr (s.TreeDepth e.canoninzedExprs) - = t.OptInfo - : ((e.OptFuncNames) e.OptFuncs) + = t.OptInfo : ((e.OptFuncNames) e.OptFuncs) = : { (e.OptFuncNames^ None) e.Expr^ @@ -130,42 +129,52 @@ GrowDriveTree { (/* нет сужений */ (e.Expr) (/* пустое дерево */)); (e.OptFuncNames^ t.Call) e.Expr^ - = - : (e.OptFuncs^) (e.NewFunctions) e.Branches - = e.UsedVars - : e.UsedVars^ - = - : { - ((s.CntNodes^) t.OptInfo^ (e.NewFunctions^)) e.Branches^ - = ((s.CntNodes) t.OptInfo (e.NewFunctionsAccum e.NewFunctions)) - (e.Contractions (e.DrivenRight) (e.Branches)); - Generalize s.Cnt - = (Generalize s.Cnt); - }; - (Generalize s.Cnt) (e.Contractions (e.DrivenRight)) + = ; + }; +} + +GrowDriveTree-Call { + (s.CntNodes) (e.UsedVars) (e.WholeVars) ((e.OptFuncNames) e.OptFuncs) e.Expr + (s.TreeDepth e.canoninzedExprs) t.Call + = + : (e.OptFuncs^) (e.NewFunctions) e.Branches + = e.UsedVars + : e.UsedVars^ + = + : { + ((s.CntNodes^) t.OptInfo^ (e.NewFunctions^)) e.Branches^ + = ((s.CntNodes) t.OptInfo (e.NewFunctionsAccum e.NewFunctions)) + (e.Contractions (e.DrivenRight) (e.Branches)); + Generalize s.Cnt = (Generalize s.Cnt); - } - ((s.CntNodes) ((e.OptFuncNames) e.OptFuncs) (e.NewFunctions)) - e.Branches - > - : { - (Generalize 1) e._DeletedTree - = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo^ - = - (s.TreeDepth e.canoninzedExprs) - >; - (Generalize s.Cnt) e._DeletedTree - = Generalize ; - e.Tree = e.Tree; - }; + }; + (Generalize s.Cnt) (e.Contractions (e.DrivenRight)) + = (Generalize s.Cnt); + } + ((s.CntNodes) ((e.OptFuncNames) e.OptFuncs) (e.NewFunctions)) + e.Branches + > + : { + (Generalize 1) e._DeletedTree + = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo + = + (s.TreeDepth e.canoninzedExprs) + >; + (Generalize s.Cnt) e._DeletedTree + = Generalize ; + e.Tree = e.Tree; }; } diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 41175138..807e0160 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -692,74 +692,105 @@ SpecCall-Aux { /* проверяем на зацикливание */ NotFound e.Signatures^ - = s.NeedRelationCheck - : { - True - = ) - e.History - >; + = ; + }; +} - False = False; - } - : { - True e.HistorySignature - /* Получает обобщённую сигнатуру для двух сигнатур */ - = : e.GenSignature - = : e.ArgVars - = - : t._ e.GenSignature^ - = : Clear e.NewSg - = - : { - /* - Если подстановка e.NewSg является тривиальной, - проверку отношения Хигмана-Крускала - в рекурсивном вызове не выполняем - */ - True = False; - - False = True; - } - : s.NeedRelationCheck^ - = ) - (/* пусто */) (/* пусто */) e.Body - > - : (e.NewArg^) (e.Sg^) (e.Solutions^) - = ; +SpecCall-NewSignature { + (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) + s.NeedRelationCheck (e.Signature) + = s.NeedRelationCheck + : { + True + = ) + e.History + >; - False - = - : e.NewSentences - = : e.InstanceName - = ( - (e.SpecPattern) (e.Body) - e.Signatures ((e.InstanceName) e.Signature) - ) - (CallBrackets - (Symbol Name e.InstanceName) - > - ) - (Function - GN-Local (e.InstanceName) - Sentences e.NewSentences - ) - ( - ( - (e.InstanceName) e.History - ((e.InstanceName) e.Signature) - ) - ); - } - }; + False = False; + } + : { + True e.HistorySignature + = ; + + False + = ; + } +} + +SpecCall-NewSignature-Generalize { + (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) + (e.Signature) (e.HistorySignature) + /* Получает обобщённую сигнатуру для двух сигнатур */ + = : e.GenSignature + = : e.ArgVars + = + : t._ e.GenSignature^ + = : Clear e.NewSg + = + : { + /* + Если подстановка e.NewSg является тривиальной, + проверку отношения Хигмана-Крускала + в рекурсивном вызове не выполняем + */ + True = False; + + False = True; + } + : s.NeedRelationCheck + = ) + (/* пусто */) (/* пусто */) e.Body + > + : (e.NewArg^) (e.Sg^) (e.Solutions^) + = ; +} + +SpecCall-NewSignature-MakeFunction { + (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) + = + : e.NewSentences + = : e.InstanceName + = ( + (e.SpecPattern) (e.Body) + e.Signatures ((e.InstanceName) e.Signature) + ) + (CallBrackets + (Symbol Name e.InstanceName) + > + ) + (Function + GN-Local (e.InstanceName) + Sentences e.NewSentences + ) + ( + ( + (e.InstanceName) e.History + ((e.InstanceName) e.Signature) + ) + ); } ExtractCalls-Expr { diff --git a/src/compiler/OptTree-StopRelation.ref b/src/compiler/OptTree-StopRelation.ref index 42a4738b..0d71c6cb 100644 --- a/src/compiler/OptTree-StopRelation.ref +++ b/src/compiler/OptTree-StopRelation.ref @@ -79,7 +79,7 @@ CanonizeExpr-Term { (Var s.Mode e.Index) = (Var s.Mode); (s.BracketsTag e.Expr) - , : True + , : e._ s.BracketsTag e._ = : e.Expr^ = (s.BracketsTag e.Expr); From a4d66f5ec35171d2dc6024850615c7d00744203a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 27 Jun 2021 19:46:34 +0300 Subject: [PATCH 008/208] =?UTF-8?q?=D0=A1=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8:=20=D1=84?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4=D0=B0=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 6 ++++-- src/compiler/OptTree-Drive-Expr.ref | 26 +++++++++++++++++++------- src/compiler/OptTree-Spec.ref | 18 ++++-------------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 053e754d..b9852e78 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -2182,7 +2182,8 @@ AddContraction-Spec { : { ((Var 'e' e._) ':' (Var 'e' e._) (Var 'e' e._)) = AfterOpen; - ((Var 'e' e._) ':' (Var 'e' e._) (Var 't' e._) (Var 'e' e._)) = AfterOpen; + ((Var 'e' e._) ':' (Var 'e' e._) (Var 't' e._) (Var 'e' e._)) + = AfterOpen; t._ = s.OpenFlag; } @@ -2203,7 +2204,8 @@ AddContraction-Spec-Symm { : { ((Var 'e' e._) ':' (Var 'e' e._) (Var 'e' e._)) = AfterOpen; - ((Var 'e' e._) ':' (Var 'e' e._) (Var 't' e._) (Var 'e' e._)) = AfterOpen; + ((Var 'e' e._) ':' (Var 'e' e._) (Var 't' e._) (Var 'e' e._)) + = AfterOpen; t._ = s.OpenFlag; } diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index b4315b82..34ad416e 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -84,8 +84,8 @@ MaxTreeDepth { = 20 } $DRIVE MaxTreeDepth; IncWithMax { - s.Cnt s.Max, : '+' - = ; + s.Cnt s.Max, : '+' = ; + s.Cnt s.Max = s.Max; } @@ -96,20 +96,25 @@ CheckExprsLength { } MakeDriveTree { - (s.CntNodes) (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr (s.TreeDepth e.canoninzedExprs) + (s.CntNodes) (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr + (s.TreeDepth e.canoninzedExprs) = () e.canoninzedExprs : e.canoninzedExprs^ - = > > + = > + > : s.CntNodes^ s.TreeDepth^ = : { True s.Cnt = Generalize s.Cnt; + s._ s._, : s.CntNodes = ((s.CntNodes) t.OptInfo (/* нет функций */)) (/* нет сужений */ (e.Expr) (/* пустое дерево */) ); + s._ s._, : s.TreeDepth = ((s.CntNodes) t.OptInfo (/* нет функций */)) (/* нет сужений */ (e.Expr) (/* пустое дерево */) ); + False s._Cnt = : { ((s.CntNodes^) t.OptInfo^ (e.NewFunctions^)) e.Branches^ - = ((s.CntNodes) t.OptInfo (e.NewFunctionsAccum e.NewFunctions)) + = ((s.CntNodes) t.OptInfo (e.NewFunctionsAccum e.NewFunctions)) (e.Contractions (e.DrivenRight) (e.Branches)); + Generalize s.Cnt = (Generalize s.Cnt); }; + (Generalize s.Cnt) (e.Contractions (e.DrivenRight)) = (Generalize s.Cnt); } @@ -172,8 +180,10 @@ GrowDriveTree-Call { (s.TreeDepth e.canoninzedExprs) >; + (Generalize s.Cnt) e._DeletedTree = Generalize ; + e.Tree = e.Tree; }; } @@ -241,7 +251,9 @@ FlatDriveTreeSingle { { (e.BrachContractions (e.BranchDrivenRight)) = ( - + (e.BranchDrivenRight) ) } diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 807e0160..3727f779 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -708,8 +708,7 @@ SpecCall-NewSignature { : { True = ) - e.History + (e.Name) () e.History >; False = False; @@ -767,10 +766,7 @@ SpecCall-NewSignature-Generalize { SpecCall-NewSignature-MakeFunction { (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) - = + = : e.NewSentences = : e.InstanceName = ( @@ -781,15 +777,9 @@ SpecCall-NewSignature-MakeFunction { (Symbol Name e.InstanceName) > ) - (Function - GN-Local (e.InstanceName) - Sentences e.NewSentences - ) + (Function GN-Local (e.InstanceName) Sentences e.NewSentences) ( - ( - (e.InstanceName) e.History - ((e.InstanceName) e.Signature) - ) + ((e.InstanceName) e.History ((e.InstanceName) e.Signature)) ); } From 09999a72a1494d49ba7eefc2714af1b1225530f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 27 Jun 2021 19:47:16 +0300 Subject: [PATCH 009/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D1=82=D0=BE=D1=87?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8,=20=D0=BB=D0=B8?= =?UTF-8?q?=D1=88=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=D1=80=D0=B8=D0=B8=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 3727f779..d01431a3 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -707,7 +707,7 @@ SpecCall-NewSignature { = s.NeedRelationCheck : { True - = ) e.History >; @@ -1018,26 +1018,13 @@ OrderUniqueVars { e.Variables = e.Variables; } -/* - Функции, относящиеся к проверке отношения Хигмана-Крускала -*/ - /** - + == True e.HistorySignature == False - - Функция проверяет, выполняется ли отношение Хигмана-Крускала - для одной из сигнатур в e.History и сигнатуры e.Signature, - то есть проверяется, можно ли вложить одну сигнатуру в другую, - удалив некоторые элементы. - В случае, если в истории сигнатур удаётся найти сигнатуру, - для которой выполняется указанное отношение, - функция возвращает True и соответствующий e.HistorySignature. - В ином случае возвращается False. */ -HasHigmanKruskalRelation { +HasStopRelation { (e.Name) (e.Signature) e.History ((e.InstanceName) e.HistorySignature) , : e.Name , ; + = ; (e.Name) (e.Signature) /* пустая история */ = False; } From ca5f0d1fa466f18e1f93068bc8f5db0f014189df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 27 Jun 2021 20:51:33 +0300 Subject: [PATCH 010/208] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20MakeDriveTree/GrowDriveTree=20?= =?UTF-8?q?(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 17 +++++++---------- .../rlc-core.exe@refal-5-lambda-diagnostics.ini | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 34ad416e..4c586421 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -104,8 +104,7 @@ MakeDriveTree { : s.CntNodes^ s.TreeDepth^ = : { - True s.Cnt - = Generalize s.Cnt; + True s.Cnt = Generalize t.OptInfo s.Cnt; s._ s._, : s.CntNodes = ((s.CntNodes) t.OptInfo (/* нет функций */)) @@ -162,27 +161,25 @@ GrowDriveTree-Call { = ((s.CntNodes) t.OptInfo (e.NewFunctionsAccum e.NewFunctions)) (e.Contractions (e.DrivenRight) (e.Branches)); - Generalize s.Cnt - = (Generalize s.Cnt); + Generalize t.OptInfo^ s.Cnt = (Generalize t.OptInfo s.Cnt); }; - (Generalize s.Cnt) (e.Contractions (e.DrivenRight)) - = (Generalize s.Cnt); + (Generalize t.OptInfo s.Cnt) (e.Contractions (e.DrivenRight)) + = (Generalize t.OptInfo s.Cnt); } ((s.CntNodes) ((e.OptFuncNames) e.OptFuncs) (e.NewFunctions)) e.Branches > : { - (Generalize 1) e._DeletedTree - = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo + (Generalize t.OptInfo 1) e._DeletedTree = (s.TreeDepth e.canoninzedExprs) >; - (Generalize s.Cnt) e._DeletedTree - = Generalize ; + (Generalize t.OptInfo s.Cnt) e._DeletedTree + = Generalize t.OptInfo ; e.Tree = e.Tree; }; diff --git a/src/compiler/rlc-core.exe@refal-5-lambda-diagnostics.ini b/src/compiler/rlc-core.exe@refal-5-lambda-diagnostics.ini index ff3a0c3b..ee3b6f4c 100644 --- a/src/compiler/rlc-core.exe@refal-5-lambda-diagnostics.ini +++ b/src/compiler/rlc-core.exe@refal-5-lambda-diagnostics.ini @@ -1,3 +1,3 @@ print-statistics = true -enable-profiler = false +enable-profiler = true dump-file = __srefc-core.dump.txt From 4a31dda6eeeb2fdec08d2da7135676ed05cb984d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 2 Jul 2021 07:38:25 +0300 Subject: [PATCH 011/208] =?UTF-8?q?FIXED:=20=D0=BF=D1=80=D0=B8=20=D1=81?= =?UTF-8?q?=D0=B1=D0=BE=D1=80=D0=BA=D0=B5=20=D0=B8=D1=81=D1=85=D0=BE=D0=B4?= =?UTF-8?q?=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=BE=D1=82=D0=BA=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D1=91=D0=BD=20=D0=B2=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D1=89=D0=B8=D0=BA=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Эта правка была закоммичена в предыдущем коммите по ошибке. --- src/compiler/rlc-core.exe@refal-5-lambda-diagnostics.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/rlc-core.exe@refal-5-lambda-diagnostics.ini b/src/compiler/rlc-core.exe@refal-5-lambda-diagnostics.ini index ee3b6f4c..ff3a0c3b 100644 --- a/src/compiler/rlc-core.exe@refal-5-lambda-diagnostics.ini +++ b/src/compiler/rlc-core.exe@refal-5-lambda-diagnostics.ini @@ -1,3 +1,3 @@ print-statistics = true -enable-profiler = true +enable-profiler = false dump-file = __srefc-core.dump.txt From e39e08458e1c353fc40849acd03e64996d4246e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 17 Jul 2021 20:48:23 +0300 Subject: [PATCH 012/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D0=B3=D0=B8,=20=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B2=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20(#322,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Переименования функций, • уточнения комментариев, • изменение типа результата функции Solve-Clashes, • удалена неиспользуемая функция IsFreeVariableSeq. --- src/compiler/GenericMatch.ref | 111 ++++++++++++++-------------------- 1 file changed, 46 insertions(+), 65 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index b9852e78..081d36c2 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -64,7 +64,7 @@ $ENTRY Solve-Drive { (/* пусто */) > : { - e.Begin Generalize (e.Intervals) e.End = Undefined; + e._ (Generalize (e.Intervals)) e._ = Undefined; /* пусто */ = Failure; @@ -73,7 +73,7 @@ $ENTRY Solve-Drive { : { True = Undefined; - False = Success ; + False = Success ; }; }; } @@ -81,13 +81,9 @@ $ENTRY Solve-Drive { /* Проверка на наличие поднятого флага в решениях */ IsFlagOpen { - Success AfterOpen (e.Contrs) (e.Assigns) e.Rest - = True; - - Success None (e.Contrs) (e.Assigns) e.Rest - = ; + e._ (Success AfterOpen (e.Contrs) (e.Assigns)) e._ = True; - /* пусто */ = False; + e._ = False; } /** @@ -102,14 +98,14 @@ IsFlagOpen { $ENTRY Solve-Spec { (e.UsedVars) (e.Left) (e.Right) = : e.Left^ - = ; } -Solve-Spec-Aux { +Solve-Spec-DoFindGeneralization { (e.UsedVars) ((e.L) ':' (e.R)) (e.GenAssigns) = : { - e.Begin Generalize (e.Intervals) e.End + e._ (Generalize (e.Intervals)) e._ = (e.L) (e.GenAssigns) > : (e.UsedVars^) (e.L^) (e.GenAssigns^) - = ; @@ -132,7 +128,7 @@ Solve-Spec-Aux { e.Success = Success - + (e.GenAssigns) (); } @@ -220,34 +216,29 @@ GetExtremum { /* Преобразует решения в нужный формат для Solve-Drive и Solve-Spec - == t.Sol* + == t.Sol* t.Sol ::= ((t.Contr*) (t.Assign*)) - e.RawSol ::= Success s.OpenFlag (t.Contr*) (t.Assign*) + e.RawSol ::= (Success s.OpenFlag (t.Contr*) (t.Assign*)) */ CombineResults { - (e.Solutions) - Success s.OpenFlag (e.Contrs) (e.Assigns) e.Rest - = ) - ( ':' t.Var) - } - e.Assigns - >) - ) - ) - e.Rest + e.RawSolutions + = : e.Contrs^ + = ':' t.Var) + } + e.Assigns + > + : e.Assigns^ + = ((e.Contrs) (e.Assigns)); + } + e.RawSolutions >; - - (e.Solutions) /* пусто */ - = e.Solutions; } /* @@ -334,6 +325,7 @@ GetVarType { e.Other = 'e'; } +* TODO: присваивания должны быть параллельными ApplyAssignments-toExpr { (t.Assign e.Rest) e.Expr = >; - /* {m} t.X {n} : [P] ↦ t.X → [e.NEW] */ + /* {m} t.X {n} : [X P] ↦ t.X → [X e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart ((('{'s.M'}') t.X ('{'s.N'}')) ':' (t.P)) e.ClashesEnd (e.Assigns) @@ -850,7 +841,7 @@ Solve-Clashes { , e.E : ('{'s.M'}') e.Inner ('{'s.N'}') , : False , s.OpenFlag : AfterOpen - = Generalize (('{' s.M s.N '}')); + = (Generalize (('{' s.M s.N '}'))); (e.UsedVars) (e.Contrs) ((('{'s.M'}') t.eVar ('{'s.N'}')) ':' (t.eX e.P t.eY)) @@ -859,7 +850,7 @@ Solve-Clashes { , t.eX : (Var 'e' e.XIndex) , t.eY : (Var 'e' e.YIndex) , : True - = Generalize (('{' s.M s.N '}')); + = (Generalize (('{' s.M s.N '}'))); (e.UsedVars) (e.Contrs) ((e.E) ':' (t.eX e.P t.eY)) @@ -1625,7 +1616,7 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) , t.tX : (Var 't' e._) , t.Closure : (ClosureBrackets e._) - = Generalize (('{' s.C s.D '}')); + = (Generalize (('{' s.C s.D '}'))); /* {c} {{ &F e.X }} {d} = {a} t.X {b} ↦ обобщаем {c−d} */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -1633,7 +1624,7 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) , t.tX : (Var 't' e._) , t.Closure : (ClosureBrackets e._) - = Generalize (('{' s.C s.D '}')); + = (Generalize (('{' s.C s.D '}'))); /* {a} s.X {b} = {c} {{ &F e.X }} {d} ↦ обобщаем {c−d} */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -1641,7 +1632,7 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) , t.sX : (Var 's' e._) , t.Closure : (ClosureBrackets e._) - = Generalize (('{' s.C s.D '}')); + = (Generalize (('{' s.C s.D '}'))); /* {c} {{ &F e.X }} {d} = {a} s.X {b} ↦ обобщаем {c−d} */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -1649,7 +1640,7 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) , t.sX : (Var 's' e._) , t.Closure : (ClosureBrackets e._) - = Generalize (('{' s.C s.D '}')); + = (Generalize (('{' s.C s.D '}'))); /* {a} X {b} = {c} {{ &F e.X }} {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -1683,7 +1674,7 @@ Solve-SymmClashes-Aux { , t.Closure : (ClosureBrackets e._) = /* решений нет */; - /* {a} [E] {b} = {c} {{ &F e.X }} {d} ↦ решений нет */ + /* {a} [X E] {b} = {c} {{ &F e.X }} {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.A'}') t.BrE ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) e.ClashesEnd (e.Assigns) @@ -1691,7 +1682,7 @@ Solve-SymmClashes-Aux { , t.Closure : (ClosureBrackets e._) = /* решений нет */; - /* {c} {{ &F e.X }} {d} = {a} [E] {b} ↦ решений нет */ + /* {c} {{ &F e.X }} {d} = {a} [X E] {b} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.BrE ('{'s.B'}')) e.ClashesEnd (e.Assigns) @@ -1699,7 +1690,7 @@ Solve-SymmClashes-Aux { , t.Closure : (ClosureBrackets e._) = /* решений нет */; - /* {a} [E1] {b} = {c} (E2) {d} ↦ решений нет */ + /* {a} [X E1] {b} = {c} (E2) {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.A'}') t.Br1 ('{'s.B'}') '=' ('{'s.C'}') t.Br2 ('{'s.D'}')) e.ClashesEnd (e.Assigns) @@ -1707,7 +1698,7 @@ Solve-SymmClashes-Aux { , t.Br2 : (Brackets e._) = /* решений нет */; - /* {c} (E2) {d} = {a} [E1] {b} ↦ решений нет */ + /* {c} (E2) {d} = {a} [X E1] {b} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.C'}') t.Br2 ('{'s.D'}') '=' ('{'s.A'}') t.Br1 ('{'s.B'}')) e.ClashesEnd (e.Assigns) @@ -1854,7 +1845,7 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) , t.Br : (Brackets e._) , t.tX : (Var 't' e._) - = Generalize (('{' s.A s.D '}') ('{' s.E s.F '}')); + = (Generalize (('{' s.A s.D '}') ('{' s.E s.F '}'))); /* {e} t.X {f} = {a} ({b} E {c}) {d} ↦ t.X → (e.NEW) */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -1879,7 +1870,7 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) , t.Br : (Brackets e._) , t.tX : (Var 't' e._) - = Generalize (('{' s.E s.F '}') ('{' s.A s.D '}')); + = (Generalize (('{' s.E s.F '}') ('{' s.A s.D '}'))); /* {a} [{b} E {c}] {d} = {e} t.X {f} ↦ t.X → [e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -1904,7 +1895,7 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) , t.Br : (ADT-Brackets (e.Name) e._) , t.tX : (Var 't' e._) - = Generalize (('{' s.A s.D '}') ('{' s.E s.F '}')); + = (Generalize (('{' s.A s.D '}') ('{' s.E s.F '}'))); /* {e} t.X {f} = {a} [{b} E {c}] {d} ↦ t.X → [e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -1929,7 +1920,7 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) , t.Br : (ADT-Brackets (e.Name) e._) , t.tX : (Var 't' e._) - = Generalize (('{' s.E s.F '}') ('{' s.A s.D '}')); + = (Generalize (('{' s.E s.F '}') ('{' s.A s.D '}'))); /* {a} (E) {b} = {c} Sym {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -2112,11 +2103,11 @@ Solve-SymmClashes-Aux { (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.A'}') e.E1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 ('{'s.D'}')) e.ClashesEnd (e.Assigns) - = Generalize (('{' s.A s.B '}') ('{' s.C s.D '}')); + = (Generalize (('{' s.A s.B '}') ('{' s.C s.D '}'))); * Если клэши кончились, возвращаем решение (e.UsedVars) (s.OpenFlag e.Contrs) (e.Assigns) - = Success s.OpenFlag (e.Contrs) (e.Assigns); + = (Success s.OpenFlag (e.Contrs) (e.Assigns)); } /* Проверка на эквивалентность */ @@ -2293,16 +2284,6 @@ ApplyContraction-toExpr { t.Contraction e.Expr = e.Expr } -/* Проверка на последовательность свободных переменных */ - -IsFreeVariableSeq { - /* пусто */ = True; - - (Var 'e' e.Idx) e.Rem = ; - - t.Other e.Rem = False -} - /* Проверка на то, что выражение содержит метки координат на верхнем уровне From 0ebdf3a30605ea31fcdcf1f1b4d1ea04958ed6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 17 Jul 2021 22:09:42 +0300 Subject: [PATCH 013/208] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D1=83=D0=B5=D0=BC=D1=8B=D1=85=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=BA=D0=B5=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ранее при построении дерева прогонки, из сужений для ветвей извлекались имена используемых переменных. Теперь эти имена возвращаются функцией Solve-Drive. На быстродействие это почти не повлияло. Ранее: ExtractVariables-Expr (0000) -> 11519.0 ms (2.64 %, += 21.06 %) rel step time 0.67 ExtractVariables-Expr (0000) -> 13593437 (3.92 %, += 8.41 %) rel step time 0.67 Теперь: ExtractVariables-Expr (0000) -> 11687.0 ms (2.73 %, += 21.22 %) rel step time 0.71 ExtractVariables-Expr (0000) -> 13442507 (3.87 %, += 8.34 %) rel step time 0.71 Число шагов уменьшилось на 0,05 % (3,92−3,87), а доля времени даже выросла. --- src/compiler/GenericMatch.ref | 51 +++++++++++++----- src/compiler/OptTree-Drive-Expr.ref | 80 ++++++++++++++--------------- 2 files changed, 77 insertions(+), 54 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 081d36c2..f803c8b4 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -36,7 +36,7 @@ $ENTRY GenericMatch { ((e.Pattern) ':' (e.LPattern)) > : { - Success (() (e.Assigns)) = Clear ; + Success (e._ () (e.Assigns)) = Clear ; Success e.Solutions = Contracted e.Solutions; Failure = Failure; Undefined = Undefined; @@ -50,7 +50,7 @@ $ENTRY GenericMatch { t.Contr ::= (t.Var ':' e.Val) t.Equation ::= ((e.Expr) ':' (e.LExpr)) t.Assign ::= (e.Val ':' t.Var) - t.Result ::= ((t.Contr*) (t.Assign*)) + t.Result ::= (e.UsedVars^ (t.Contr*) (t.Assign*)) */ $ENTRY Solve-Drive { @@ -73,7 +73,7 @@ $ENTRY Solve-Drive { : { True = Undefined; - False = Success ; + False = Success ; }; }; } @@ -81,11 +81,38 @@ $ENTRY Solve-Drive { /* Проверка на наличие поднятого флага в решениях */ IsFlagOpen { - e._ (Success AfterOpen (e.Contrs) (e.Assigns)) e._ = True; + e._ (Success (e._) AfterOpen (e._) (e._)) e._ = True; e._ = False; } +/* + Преобразует решения в нужный формат для Solve-Drive + + == t.Sol* + + t.Sol ::= (e.UsedVars (t.Contr*) (t.Assign*)) + e.RawSol ::= (Success (e.UsedVars) s.OpenFlag (t.Contr*) (t.Assign*)) +*/ +CombineResults-Drive { + e.RawSolutions + = : e.Contrs^ + = ':' t.Var) + } + e.Assigns + > + : e.Assigns^ + = (e.UsedVars (e.Contrs) (e.Assigns)); + } + e.RawSolutions + >; +} + /** == Success ((t.Contr*) (t.Assign*))* (t.Assign*) (e.Left^) @@ -128,7 +155,7 @@ Solve-Spec-DoFindGeneralization { e.Success = Success - + (e.GenAssigns) (); } @@ -214,19 +241,19 @@ GetExtremum { } /* - Преобразует решения в нужный формат для Solve-Drive и Solve-Spec + Преобразует решения в нужный формат для Solve-Spec - == t.Sol* + == t.Sol* t.Sol ::= ((t.Contr*) (t.Assign*)) - e.RawSol ::= (Success s.OpenFlag (t.Contr*) (t.Assign*)) + e.RawSol ::= (Success (e.UsedVars) s.OpenFlag (t.Contr*) (t.Assign*)) */ -CombineResults { +CombineResults-Spec { e.RawSolutions = : e.Contrs^ = : (e.OptFuncs^) (e.NewFunctions) e.Branches - = e.UsedVars - : e.UsedVars^ = - } - e.Branches - >; -} - -ContractionVars { - e.Contractions - = - } - e.Contractions - >; -} - FlatDriveTree { e.Branches = )); + ( + (e.UsedVars) + e.Contractions + () + ); } (/* new functions */) e.SubstitutionPacks @@ -307,17 +289,19 @@ OptExpr-Aux { } IntrinsicCall { - t.IntrinsicFunction t.Metatables (e.Args) '__Meta_Mu' + (e.UsedVars) t.IntrinsicFunction t.Metatables (e.Args) '__Meta_Mu' = : { t.Metatables^ Ok e.Result - = t.Metatables (( ':' e.Result) (/* нет новых функций */)); + = t.Metatables + ((e.UsedVars) ( ':' e.Result) (/* нет новых функций */)); t.Metatables^ MakeColdCall - = t.Metatables ; + = t.Metatables + ; }; - t.IntrinsicFunction t.Metatables (e.Args) e.BehaviorName + (e.UsedVars) t.IntrinsicFunction t.Metatables (e.Args) e.BehaviorName = e.BehaviorName : { 'Add' = &Intrinsic-Add; @@ -347,8 +331,11 @@ IntrinsicCall { : s.TransformFunction = : { - Ok e.Result = (( ':' e.Result) (/* нет новых функций */)); - MakeColdCall = ; + Ok e.Result + = ((e.UsedVars) ( ':' e.Result) (/* нет новых функций */)); + + MakeColdCall + = ; } : e.Substitutions = t.Metatables e.Substitutions; @@ -811,13 +798,15 @@ Intrinsic-Last { OptExpr-MakeSubstitutions { (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.IntrinsicFunction t.Metatables , t.IntrinsicFunction : (Intrinsic (e._) Intrinsic e.BehaviorName) - = ; + = ; (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.Function t.Metatables /* Активные вызовы игнорируем */ , : False - = t.Metatables ; + = t.Metatables ; (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) (s.FuncMode (e.Name) Sentences e.Body) t.Metatables @@ -837,19 +826,21 @@ OptExpr-MakeSubstitutions { >; (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.Function t.Metatables - = t.Metatables ; + = t.Metatables ; } MakeColdSolution { - (s.FuncMode (e.Name) s.BodyLabel e.Body) e.Args + (e.UsedVars) (s.FuncMode (e.Name) s.BodyLabel e.Body) e.Args , e.Name : e.Prefix '*' s.Num = ( + (e.UsedVars) ( ':' (ColdCallBrackets (Symbol Name e.Name) e.Args)) ((NewFunction GN-Local (e.Name) s.BodyLabel e.Body)) ); - (s.FuncMode (e.Name) s.BodyLabel e.Body) e.Args + (e.UsedVars) (s.FuncMode (e.Name) s.BodyLabel e.Body) e.Args = ( + (e.UsedVars) ( ':' (ColdCallBrackets (Symbol Name e.Name) e.Args)) (/* нет новых функций */) ); @@ -864,10 +855,14 @@ DoOptExpr-MakeSubstitutions { /* В случае решения без сужений просто применяем замены. */ - Success (() (e.Assigns)) + Success (e.UsedVars () (e.Assigns)) = : e.CallReplacer = e.Substitutions - (( ':' e.CallReplacer) (/* нет новых функций */)); + ( + (e.UsedVars) + ( ':' e.CallReplacer) + (/* нет новых функций */) + ); /* «Грязное» решение допускаем только в случае прогонки. @@ -876,10 +871,10 @@ DoOptExpr-MakeSubstitutions { , : True = : e.CallReplacer = e.Contrs ( ':' e.CallReplacer) : e.Contrs^ - = (e.Contrs (/* нет новых функций */)); + = ((e.UsedVars) e.Contrs (/* нет новых функций */)); } e.Solutions > @@ -907,13 +902,14 @@ DoOptExpr-MakeSubstitutions { e.Other = e.Substitutions ; }; (e.SentenceVars) (e.WholeVars) (e.Args) (e.Substitutions) t.RestFunction - = e.Substitutions ; + = e.Substitutions ; } Cleanup-Step-Drop { @@ -929,7 +925,7 @@ Cleanup-Step-Drop { SafeContractions { e.Solutions-B - ((e.Contrs-B ((Var s.Mode e.Index) ':' e._) e.Contrs-E) (e.Assigns)) + (e.UsedVars (e.Contrs-B ((Var s.Mode e.Index) ':' e._) e.Contrs-E) (e.Assigns)) e.Solutions-E (e.WholeVars-B (s.Mode e.Index) e.WholeVars-E) = False; From a9e16975da92c06d11231eacb11a033ff30424d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 17 Jul 2021 23:16:31 +0300 Subject: [PATCH 014/208] =?UTF-8?q?=D0=A3=D1=82=D0=BE=D1=87=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B5=D0=B2=20(#322,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index f803c8b4..9ac48f15 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -1899,7 +1899,7 @@ Solve-SymmClashes-Aux { , t.tX : (Var 't' e._) = (Generalize (('{' s.E s.F '}') ('{' s.A s.D '}'))); - /* {a} [{b} E {c}] {d} = {e} t.X {f} ↦ t.X → [e.NEW] */ + /* {a} [X {b} E {c}] {d} = {e} t.X {f} ↦ t.X → [e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.A'}') t.Br ('{'s.D'}') '=' ('{'s.E'}') t.tX ('{'s.F'}')) e.ClashesEnd (e.Assigns) @@ -1916,7 +1916,7 @@ Solve-SymmClashes-Aux { > >; - /* {a} [E] {d} = {e} t.X {f} ↦ обобщение */ + /* {a} [X E] {d} = {e} t.X {f} ↦ обобщение */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.A'}') t.Br ('{'s.D'}') '=' ('{'s.E'}') t.tX ('{'s.F'}')) e.ClashesEnd (e.Assigns) @@ -1924,7 +1924,7 @@ Solve-SymmClashes-Aux { , t.tX : (Var 't' e._) = (Generalize (('{' s.A s.D '}') ('{' s.E s.F '}'))); - /* {e} t.X {f} = {a} [{b} E {c}] {d} ↦ t.X → [e.NEW] */ + /* {e} t.X {f} = {a} [X {b} E {c}] {d} ↦ t.X → [e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) e.ClashesEnd (e.Assigns) @@ -1941,7 +1941,7 @@ Solve-SymmClashes-Aux { > >; - /* {e} t.X {f} = {a} [E] {d} ↦ обобщение */ + /* {e} t.X {f} = {a} [X E] {d} ↦ обобщение */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) e.ClashesEnd (e.Assigns) From 77172cdb3f58c75bf298d97b272a5c27522dcd0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 17 Jul 2021 23:57:22 +0300 Subject: [PATCH 015/208] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20SimplifyC?= =?UTF-8?q?oordinates-Expr-Inner=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Данная правка на время и число шагов функции SimplifyCoordinates-Expr, вопреки ожиданиям, никак не повлияла. Ранее: Total time: 427.50000 s SimplifyCoordinates-Expr (3646) -> 6957.0 ms (1.63 %, += 26.16 %) rel step time 0.90 SimplifyCoordinates-Expr (3646) -> 6259417 (1.80 %, += 24.36 %) rel step time 0.90 SimplifyCoordinates-Expr-Inner (3646) -> 6274.0 ms (1.47 %, += 29.18 %) rel step time 1.17 SimplifyCoordinates-Expr-Inner (3646) -> 4372638 (1.26 %, += 30.18 %) rel step time 1.17 Сейчас: Total time: 422.06200 s SimplifyCoordinates-Expr (5246) -> 6909.0 ms (1.64 %, += 28.27 %) rel step time 0.90 SimplifyCoordinates-Expr (5246) -> 6222848 (1.81 %, += 24.66 %) rel step time 0.90 Число шагов SimplifyCoordinates-Expr даже, почему-то, возросло. Но SimplifyCoordinates-Expr-Inner больше нет, программа ускорилась на сэкономленные ≈6 секунд. Понятно, что это однократный замер, просто интересно совпало. --- src/compiler/GenericMatch.ref | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 9ac48f15..050fc201 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -487,28 +487,9 @@ SimplifyCoordinates-Expr { ('{'s.M'}') ('{'s.N'}') = /* пусто */; - ('{'s.M'}') e.E ('{'s.N'}') - = ('{'s.M'}') ('{'s.N'}'); + ('{'s.M'}') e.E ('{'s.N'}') = ('{'s.M'}') e.E ('{'s.N'}'); - e.E = ; -} - -SimplifyCoordinates-Expr-Inner { - /* Ê1{k} {m} {n}Ê2 ↦ Ê1{k} {n}Ê2 */ - e.E1 ('{'s.K'}') ('{'s.M'}') ('{'s.N'}') e.E2 - = ; - - e.Begin (Brackets e.E) e.End - = - (Brackets ) - ; - - e.Begin (ADT-Brackets (e.Name) e.E) e.End - = - (ADT-Brackets (e.Name) ) - ; - - e.E = e.E; + /* пусто */ = /* пусто */; } /* From 40b525fe60164085c14a514ec67fb8ce6740e775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 18 Jul 2021 17:53:25 +0300 Subject: [PATCH 016/208] =?UTF-8?q?=D0=92=D1=81=D1=82=D1=80=D0=B0=D0=B8?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=83=D1=81=D0=BB=D0=BE=D0=B2?= =?UTF-8?q?=D0=B8=D0=B9-=D1=81=D1=83=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=B2=C2=A0Solve-Clashes=20(#322,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 161 +++++++++++++++------------------- 1 file changed, 69 insertions(+), 92 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 050fc201..4b7e0ae1 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -509,36 +509,32 @@ SimplifyCoordinates-Expr { Solve-Clashes { /* {m} T {n} : t.X ↦ {m} T {n} ← t.X */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.T ('{'s.N'}')) ':' (t.X)) + ((('{'s.M'}') t.T ('{'s.N'}')) ':' ((Var 't' e.Index))) e.ClashesEnd (e.Assigns) , : True - , t.X : (Var 't' e.Tindex) = ; /* {m} Sym {n} : s.X ↦ {m} Sym {n} ← s.X */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' (t.X)) + ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((Var 's' e.Index))) e.ClashesEnd (e.Assigns) , : True - , t.X : (Var 's' e.Sindex) = ; /* {m} (E) {n} : (P) ↦ {m} E {n} : P */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.L ('{'s.N'}')) ':' (t.R)) + ((('{'s.M'}') (Brackets e.LBody) ('{'s.N'}')) ':' ((Brackets e.RBody))) e.ClashesEnd (e.Assigns) - , t.L : (Brackets e.LBody) - , t.R : (Brackets e.RBody) = : True = /* нет решений */; - /* {m} [E] {n} : Psym ↦ нет решений */ + /* {m} [X E] {n} : Psym ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.L ('{'s.N'}')) ':' (t.Psym)) + ((('{'s.M'}') (ADT-Brackets e._) ('{'s.N'}')) ':' (t.Psym)) e.ClashesEnd (e.Assigns) - , t.L : (ADT-Brackets (e.LName) e.LBody) , : True = /* нет решений */; /* {m} Sym {n} : (P) ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' (t.R)) + ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((Brackets e._))) e.ClashesEnd (e.Assigns) , : True - , t.R : (Brackets e.RBody) = /* нет решений */; /* {m} Sym {n} : [P] ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' (t.R)) + ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((ADT-Brackets e._))) e.ClashesEnd (e.Assigns) , : True - , t.R : (ADT-Brackets (e.RName) e.RBody) = /* нет решений */; /* {m} t.X {n} : (P) ↦ t.X → (e.NEW) */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.X ('{'s.N'}')) ':' (t.P)) + ((('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) ':' ((Brackets e.PBody))) e.ClashesEnd (e.Assigns) - , t.X : (Var 't' e.Tindex) - , t.P : (Brackets e.PBody) - = : t.NewVars 'e' e.NewIndex + = : t.NewVars 'e' e.NewIndex = >; /* {m} t.X {n} : [X P] ↦ t.X → [X e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.X ('{'s.N'}')) ':' (t.P)) + ( + (('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) + ':' ((ADT-Brackets (e.Name) e.PBody)) + ) e.ClashesEnd (e.Assigns) - , t.X : (Var 't' e.Tindex) - , t.P : (ADT-Brackets (e.PName) e.PBody) - = : t.NewVars 'e' e.NewIndex + = : t.NewVars 'e' e.NewIndex = >; /* {m} t.X {n} : Psym ↦ t.X → s.NEW */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.X ('{'s.N'}')) ':' (t.Psym)) + ((('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) ':' (t.Psym)) e.ClashesEnd (e.Assigns) - , t.X : (Var 't' e.Tindex) , : True - = : t.NewVars 's' e.NewIndex + = : t.NewVars 's' e.NewIndex = >; /* {m} s.X {n} : X ↦ s.X → X */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.X ('{'s.N'}')) ':' (t.S)) + ((('{'s.M'}') (Var 's' e.Index) ('{'s.N'}')) ':' ((Symbol s.Type e.Info))) e.ClashesEnd (e.Assigns) - , t.X : (Var 's' e.Sindex) - , t.S : (Symbol e._) = >; /* {m} X {n} : X ↦ стираем */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.X ('{'s.N'}')) ':' (t.X)) + ((('{'s.M'}') (Symbol s.Type e.Info) ('{'s.N'}')) ':' ((Symbol s.Type e.Info))) e.ClashesEnd (e.Assigns) - , t.X : (Symbol e._) = ; /* {m} e.X E {n} : ε ↦ e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.X e.E ('{'s.N'}')) ':' (/* пусто */)) + ((('{'s.M'}') (Var 'e' e.Index) e.E ('{'s.N'}')) ':' (/* пусто */)) e.ClashesEnd (e.Assigns) - , t.X : (Var 'e' e.XIndex) = >; @@ -792,23 +777,22 @@ Solve-Clashes { /* {m} e.X E {n} : Pt P ↦ e.X → t.NEW1 e.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.X e.E ('{'s.N'}')) ':' (t.Pt e.P)) + ((('{'s.M'}') (Var 'e' e.Index) e.E ('{'s.N'}')) ':' (t.Pt e.P)) e.ClashesEnd (e.Assigns) - , t.X : (Var 'e' e.XIndex) , : True - = : t.NewVars1 't' e.New1 - = : t.NewVars2 'e' e.New2 + = : t.NewVars1 't' e.New1 + = : t.NewVars2 'e' e.New2 = : e.Branch1 = : e.Branch2 @@ -817,23 +801,22 @@ Solve-Clashes { /* {m} E e.X {n} : P Pt ↦ e.X → e.NEW1 t.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') e.E t.X ('{'s.N'}')) ':' (e.P t.Pt)) + ((('{'s.M'}') e.E (Var 'e' e.Index) ('{'s.N'}')) ':' (e.P t.Pt)) e.ClashesEnd (e.Assigns) - , t.X : (Var 'e' e.XIndex) , : True - = : t.NewVars1 'e' e.New1 - = : t.NewVars2 't' e.New2 + = : t.NewVars1 'e' e.New1 + = : t.NewVars2 't' e.New2 = : e.Branch1 = : e.Branch2 @@ -842,36 +825,30 @@ Solve-Clashes { /* могли остаться только клэши вида E : e.X P e.Y */ (e.UsedVars) (s.OpenFlag e.Contrs) - ((e.E) ':' (t.eX e.P t.eY)) + ((e.E) ':' ((Var 'e' e._) e.P (Var 'e' e._))) e.ClashesEnd (e.Assigns) - , t.eX : (Var 'e' e.XIndex) - , t.eY : (Var 'e' e.YIndex) , e.E : ('{'s.M'}') e.Inner ('{'s.N'}') , : False , s.OpenFlag : AfterOpen = (Generalize (('{' s.M s.N '}'))); (e.UsedVars) (e.Contrs) - ((('{'s.M'}') t.eVar ('{'s.N'}')) ':' (t.eX e.P t.eY)) + ((('{'s.M'}') t.eVar ('{'s.N'}')) ':' ((Var 'e' e._) e.P (Var 'e' e._))) e.ClashesEnd (e.Assigns) , t.eVar : (Var 'e' e.Index) - , t.eX : (Var 'e' e.XIndex) - , t.eY : (Var 'e' e.YIndex) , : True = (Generalize (('{' s.M s.N '}'))); (e.UsedVars) (e.Contrs) - ((e.E) ':' (t.eX e.P t.eY)) + ((e.E) ':' ((Var 'e' e.OpenIndex) e.P (Var 'e' e.ClosedIndex))) e.ClashesEnd (e.Assigns) - , t.eX : (Var 'e' e.XIndex) - , t.eY : (Var 'e' e.YIndex) = : (e.Parts) = } From 0e2164f017f2bf907cdadb2585c9481d99023221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 19 Jul 2021 19:30:07 +0300 Subject: [PATCH 017/208] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=82=D0=B5=D1=80=D0=BC=D0=BE=D0=B2?= =?UTF-8?q?=20(#322,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 50 +++++++++++++++-------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 4b7e0ae1..2202c1ac 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -748,9 +748,7 @@ Solve-Clashes { e.ClashesEnd (e.Assigns) , : True , : True - , : True - = - : (e.Left1) (e.Left2) + = : (e.Left1) (e.Left2) = : True , : True - , : True - = - : (e.Left1) (e.Left2) + = : (e.Left1) (e.Left2) = : True - = - : { - True = (('{'s.A'}') t.T ('{'s.B'}')) (/* пусто */); +* {a} T {b} ε ↦ {a} T {b}, ε + ('{'s.A'}') t.T ('{'s.B'}') /* пусто */ + = (('{'s.A'}') t.T ('{'s.B'}')) (/* пусто */); - False = (('{'s.A'}') t.T ('{'s.B'}')) (('{'s.B'}') e.E); - }; + ('{'s.A'}') t.T ('{'s.B'}') e.E + = (('{'s.A'}') t.T ('{'s.B'}')) (('{'s.B'}') e.E); * {a} T E1* {b} E2 ↦ {a} T {b}, {a} E1* {b} E2 ('{'s.A'}') t.T e.E1 ('{'s.B'}') e.E2 - , : True - , : False = (('{'s.A'}') t.T ('{'s.B'}')) (('{'s.A'}') e.E1 ('{'s.B'}') e.E2); } SeparateTermRight { +* ε {a} T {b} ↦ ε, {a} T {b} + /* пусто */ ('{'s.A'}') t.T ('{'s.B'}') + = (/* пусто */) (('{'s.A'}') t.T ('{'s.B'}')); + * E {a} T {b} ↦ E {a}, {a} T {b} e.E ('{'s.A'}') t.T ('{'s.B'}') - , : True - = - : { - True = (/* пусто */) (('{'s.A'}') t.T ('{'s.B'}')); - - False = (e.E ('{'s.A'}')) (('{'s.A'}') t.T ('{'s.B'}')); - }; + = (e.E ('{'s.A'}')) (('{'s.A'}') t.T ('{'s.B'}')); * E1 {a} E2* T {b} ↦ E1 {a} E2* {b}, {a} T {b} - e.E1 ('{'s.A'}') e.E2 t.T ('{'s.B'}') - , : False - , : True - = (e.E1 ('{'s.A'}') e.E2 ('{'s.B'}')) - (('{'s.A'}') t.T ('{'s.B'}')); + e.Expr t.T ('{'s.B'}') + = : e.Expr^ s.A + = (e.Expr ('{'s.B'}')) (('{'s.A'}') t.T ('{'s.B'}')); +} + +LastCoordinate { + ('{'s.A'}') e.Begin ('{'s.B'}') e.End + = ('{'s.A'}') e.Begin ; + + ('{'s.A'}') e.Expr = ('{'s.A'}') e.Expr s.A; } /* From 372f63145391be45f0322a75221568b17ecbddf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 20 Jul 2021 00:38:48 +0300 Subject: [PATCH 018/208] =?UTF-8?q?FIXED:=20=D0=B7=D0=B0=D1=86=D0=B8=D0=BA?= =?UTF-8?q?=D0=BB=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BB=D1=8D?= =?UTF-8?q?=D1=88=D0=B0=20=D1=81=C2=A0=D0=B7=D0=B0=D0=BC=D1=8B=D0=BA=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=D0=BC=20=D1=81=D0=BB=D0=B5=D0=B2=D0=B0=20(#3?= =?UTF-8?q?22,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/opt-tree-match1.ref | 12 ++++++++++++ src/compiler/GenericMatch.ref | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 autotests/opt-tree-match1.ref diff --git a/autotests/opt-tree-match1.ref b/autotests/opt-tree-match1.ref new file mode 100644 index 00000000..789dc4cb --- /dev/null +++ b/autotests/opt-tree-match1.ref @@ -0,0 +1,12 @@ +* TREE + +$ENTRY Go { + e.X + = { = e.X } + : { + X = False; + s._ = True; + } + : True + = /* empty */; +} diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 2202c1ac..f5deb967 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -693,6 +693,20 @@ Solve-Clashes { e.ClashesEnd (e.Assigns) = /* нет решений */; + /* + {m} {{ &F e.X }} {n} : Pt ↦ нет решений + + Случаи + — {m} {{ &F e.X }} {n} : t.X + — {m} {{ &F e.X }} {n} : s.X + перехватываются предложениями выше + */ + (e.UsedVars) (e.Contrs) e.ClashesStart + ((('{'s.M'}') (ClosureBrackets e._) ('{'s.N'}')) ':' (t.T)) + e.ClashesEnd (e.Assigns) + , : True + = /* решений нет */; + /* E : e.X ↦ E ← e.X */ (e.UsedVars) (e.Contrs) e.ClashesStart ((e.E) ':' ((Var 'e' e.Index))) From a9107ef895c7adc38b761dc4b3847e80afc2b962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 20 Jul 2021 01:32:35 +0300 Subject: [PATCH 019/208] =?UTF-8?q?=D0=9B=D0=B8=D0=BC=D0=B8=D1=82=20=D1=87?= =?UTF-8?q?=D0=B8=D1=81=D0=BB=D0=B0=20=D1=88=D0=B0=D0=B3=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BE=D0=B1=D1=8B=D1=87=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D0=B0=D0=B2=D1=82=D0=BE=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20=D1=81=D0=BD=D0=B8=D0=B6=D0=B5=D0=BD=20=D0=B4=D0=BE=C2=A060?= =?UTF-8?q?=C2=A0000=C2=A0000=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Этот лимит инкрементировался в рамках задач #251, #322, #340. --- autotests/@refal-5-lambda-diagnostics.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autotests/@refal-5-lambda-diagnostics.ini b/autotests/@refal-5-lambda-diagnostics.ini index 4dd0cdad..0e30eab1 100644 --- a/autotests/@refal-5-lambda-diagnostics.ini +++ b/autotests/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ memory-limit = 20000000 -step-limit = 1000000000 +step-limit = 60000000 idents-limit = 5000 enable-debugger = false From b3e056751fe36193dec2e5ae0768925849872317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 20 Jul 2021 11:03:51 +0300 Subject: [PATCH 020/208] =?UTF-8?q?FIXED:=20=D0=B2=D0=BD=D1=83=D1=82=D1=80?= =?UTF-8?q?=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BE=D0=B2=20=D0=B7=D0=B0=D0=BC=D1=8B=D0=BA=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9=20=D0=BD=D0=B5=C2=A0=D0=BF=D1=80=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=8F=D0=BB=D0=B8=D1=81=D1=8C=20=D1=81=D1=83=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20(#322,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/opt-tree-spec16-vars-in-closure.ref | 14 ++++++++++++++ src/compiler/GenericMatch.ref | 5 +++++ 2 files changed, 19 insertions(+) create mode 100644 autotests/opt-tree-spec16-vars-in-closure.ref diff --git a/autotests/opt-tree-spec16-vars-in-closure.ref b/autotests/opt-tree-spec16-vars-in-closure.ref new file mode 100644 index 00000000..77cdcd6b --- /dev/null +++ b/autotests/opt-tree-spec16-vars-in-closure.ref @@ -0,0 +1,14 @@ +* TREE + +$ENTRY Go { + e.A + = { A B C = e.A } e.A 1> : s.F + = : /* empty */ + = /* empty */ +} + +S { + s.X s.Y e.Z = s.X +} + +gen_e__ { e.X = e.X } diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index f5deb967..5dfd3aed 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -2274,6 +2274,11 @@ ApplyContraction-toExpr { (ADT-Brackets ) ; + t.Contraction e.B (ClosureBrackets e.M) e.E = + + (ClosureBrackets ) + ; + t.Contraction e.Expr = e.Expr } From 77662c57b9b9882539a4df68601dfd5b901bb9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 20 Jul 2021 11:04:44 +0300 Subject: [PATCH 021/208] =?UTF-8?q?=D0=A1=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0:=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE=D0=B5=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20ADT-Brackets=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 5dfd3aed..3d780905 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -2269,9 +2269,9 @@ ApplyContraction-toExpr { (Brackets ) ; - t.Contraction e.B (ADT-Brackets e.M) e.E = + t.Contraction e.B (ADT-Brackets (e.N) e.M) e.E = - (ADT-Brackets ) + (ADT-Brackets (e.N) ) ; t.Contraction e.B (ClosureBrackets e.M) e.E = From 65e816bdf1c2ff2048531ba3566bc14c094a013e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 08:35:55 +0300 Subject: [PATCH 022/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2=C2=A0GenericMatch.ref=20(#359?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 79 ++++++++++++++++------------------- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 3d780905..d9a16324 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -278,26 +278,20 @@ CombineResults-Spec { */ DoGeneralize { - (e.UsedVars) (t.Interval e.Intervals) - (e.Expr) (e.Assigns) - = : (e.UsedVars^) (e.Expr^) (e.Assigns^) - = ; + = ; - (e.UsedVars) () - (e.Expr) (e.Assigns) + (e.UsedVars) (/* кончились интервалы */) (e.Expr) (e.Assigns) = (e.UsedVars) (e.Expr) (e.Assigns); } -DoGeneralize-Aux { - (e.UsedVars) ('{' s.A s.B '}') (e.Begin) - (e.E1 ('{'s.A'}') e.Inner ('{'s.B'}') e.E2) (e.Assigns) +DoGeneralize-Rec { + (e.UsedVars) ('{' s.A s.B '}') + (e.Begin) (e.E1 ('{'s.A'}') e.Inner ('{'s.B'}') e.E2) (e.Assigns) = : s.VarType = @@ -305,42 +299,37 @@ DoGeneralize-Aux { : e.VarVal = : (e.UsedVars^) s.VarType^ e.New = (e.UsedVars) - (e.E1 ('{'s.A'}') (Var s.VarType e.New) ('{'s.B'}') e.E2) + (e.Begin e.E1 ('{'s.A'}') (Var s.VarType e.New) ('{'s.B'}') e.E2) (e.Assigns (e.VarVal ':' (s.VarType e.New))); - (e.UsedVars) t.Interval (e.Begin) - ((Brackets e.E) e.Rest) (e.Assigns) - = - : (e.UsedVars^) (e.E^) (e.Assigns^) - = ; (e.UsedVars) t.Interval (e.Begin) - ((ADT-Brackets (e.Name) e.E) e.Rest) (e.Assigns) - = - : (e.UsedVars^) (e.E^) (e.Assigns^) - = ; - (e.UsedVars) t.Interval (e.Begin) - (t.T e.Rest) (e.Assigns) - = ; - (e.UsedVars) t.Interval (e.Begin) - () (e.Assigns) + (e.UsedVars) t.Interval (e.Begin) () (e.Assigns) = (e.UsedVars) (e.Begin) (e.Assigns); } @@ -415,8 +404,10 @@ DoAddCoordinateLabels { >; ((Brackets e.Expr) e.Rest) s.CoordNumber - = (Brackets ('{'s.CoordNumber'}') - >) + = (Brackets + ('{'s.CoordNumber'}') + > + ) : { (Brackets e.Inner ('{'s.LastCoord'}')) = (Brackets e.Inner ('{'s.LastCoord'}')) @@ -425,8 +416,10 @@ DoAddCoordinateLabels { }; ((ADT-Brackets (e.Name) e.Expression) e.Rest) s.CoordNumber - = (ADT-Brackets (e.Name) ('{'s.CoordNumber'}') - >) + = (ADT-Brackets + (e.Name) ('{'s.CoordNumber'}') + > + ) : { (ADT-Brackets e.Inner ('{'s.LastCoord'}')) = (ADT-Brackets e.Inner ('{'s.LastCoord'}')) From c1de4f5643a926cb41234eb220cc7442a2b8adcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 10:36:47 +0300 Subject: [PATCH 023/208] =?UTF-8?q?=D0=A3=D1=82=D0=BE=D1=87=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D1=80=D0=B8=D0=B2=D0=B8=D0=B0=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D0=BE=D0=B9=20=D1=81=D0=B8=D0=B3=D0=BD=D0=B0=D1=82?= =?UTF-8?q?=D1=83=D1=80=D1=8B=20(#251,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 52 +++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index d01431a3..28176a95 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -669,7 +669,7 @@ SpecCall-Aux { (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) s.NeedRelationCheck - , : True + , : True = ((e.SpecPattern) (e.Body) s.NextNumber e.Signatures) (CallBrackets (Symbol Name e.Name) e.OldArg) /* пусто */ (/* пусто */); @@ -1006,9 +1006,55 @@ RemoveLastGhostBracket { } IsTrivialSignature { - e.Arg, e.Arg : (Var 'e' e._) = True; + e.Arg (e.Body), : False = False (e.Arg) (e.Body); + e.Arg (e.Body) = ; +} + +DoIsTrivialSignature { + e.Arg (e.ScannedSentences) (/* кончились предложения */) + = True (e.Arg) (e.ScannedSentences); + + e.Arg (e.ScannedSentences) (((e.Pattern) e.Tail) e.Sentences) + , : Clear e._ + = ; + + e.Arg (e.ScannedSentences) (e.Sentences) + = False (e.Arg) (e.ScannedSentences e.Sentences); +} + +IsHardExpr { + e.Expr + , + : { + e._ OpenE e._ = False; + e._ Closure e._ = False; + e._ (s.Mode e.Index) e._ (s.Mode e.Index) e._ = False; + e._ = True; + } +} - e.Arg = False; +/* + == t.IsHardExpr-Aux* + t.IsHardExpr-Aux ::= OpenE | (s.Mode e.Index) | Closure +*/ +IsHardExpr-Aux { + e.Expr-B (Var 'e' e.Index1) e.Expr-M (Var 'e' e.Index2) e.Expr-E = OpenE; + + e.Expr + = ; + (ADT-Brackets (e.Name) e.InBrackets) = ; + (ClosureBrackets e._) = Closure; + + t.Other = /* пропускаем */; + } + e.Expr + >; } OrderUniqueVars { From 286a098a9c62795859f2a32ea417fa96c807f1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 11:18:02 +0300 Subject: [PATCH 024/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=D0=BD=D0=BE=20=D0=B4=D1=83=D0=B1=D0=BB=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive.ref | 38 ++------------------ src/compiler/OptTree-Spec.ref | 36 ++----------------- src/compiler/TreeUtils.ref | 64 ++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 70 deletions(-) diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index e46dba7c..32d13a44 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -2,7 +2,7 @@ $INCLUDE "LibraryEx"; *$FROM TreeUtils -$EXTERN ExtractVariables, HashName; +$EXTERN ExtractVariables, HashName, IsLExpr; *$FROM Log $EXTERN Log-PutLine; @@ -382,40 +382,6 @@ DriveInlineOptimizerTick { = (DriveInfo (e.OptNames) e.OptInfo) e.AST e.NewFunctions; } -IsLexpr { - e.Expr - , - : { - e.Res-B OpenE e.Res-E = False; - e.Res-B (s.Mode e.Index) e.Res-M (s.Mode e.Index) e.Res-E = False; - e.Other = True; - } -} - -/* - == t.IsLexpr-Aux-Item* - - t.IsLexpr-Aux-Item ::= OpenE | ('e' e.Index) | ('t' e.Index) -*/ -IsLexpr-Aux { - e.Expr-B (Var 'e' e.Index1) e.Expr-M (Var 'e' e.Index2) e.Expr-E - = OpenE; - - e.Expr - = ; - (ADT-Brackets (e.Name) e.InBrackets) = ; - - t.Other = /* пропускаем */; - } - e.Expr - >; -} - /* Осуществляет попытку прогонки или встраивания в функции @@ -463,7 +429,7 @@ OptSentence { = : e.SentenceVars /* Если левая часть не L-выражение, сужения запрещаем */ - = + = : { True = /* пусто */; False = e.SentenceVars; diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 28176a95..41fb0b00 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -1,7 +1,8 @@ $INCLUDE "LibraryEx"; *$FROM TreeUtils -$EXTERN ExtractVariables, ExtractVariables-Expr, NewVarName, AddSuffix; +$EXTERN ExtractVariables, ExtractVariables-Expr, NewVarName, AddSuffix, + IsHardExpr; *$FROM GenericMatch $EXTERN GenericMatch, Solve-Spec; @@ -1024,39 +1025,6 @@ DoIsTrivialSignature { = False (e.Arg) (e.ScannedSentences e.Sentences); } -IsHardExpr { - e.Expr - , - : { - e._ OpenE e._ = False; - e._ Closure e._ = False; - e._ (s.Mode e.Index) e._ (s.Mode e.Index) e._ = False; - e._ = True; - } -} - -/* - == t.IsHardExpr-Aux* - t.IsHardExpr-Aux ::= OpenE | (s.Mode e.Index) | Closure -*/ -IsHardExpr-Aux { - e.Expr-B (Var 'e' e.Index1) e.Expr-M (Var 'e' e.Index2) e.Expr-E = OpenE; - - e.Expr - = ; - (ADT-Brackets (e.Name) e.InBrackets) = ; - (ClosureBrackets e._) = Closure; - - t.Other = /* пропускаем */; - } - e.Expr - >; -} - OrderUniqueVars { e.Vars-B t.Var e.Vars-M t.Var e.Vars-E = e.Vars-B ; diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index 1093a4c1..55493569 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -169,3 +169,67 @@ HashName-Suffix { /* empty */ = /* empty */; } + +/** + == HardPattern | LPattern | Pattern | Expr +*/ +$ENTRY ExprType { + e.Expr + = + : { + e._ OpenE e._ = Expr; + e._ Forbidden e._ = Expr; + e._ ('e' e.Index) e._ ('e' e.Index) e._ = Pattern; + e._ ('t' e.Index) e._ ('t' e.Index) e._ = Pattern; + e._ ('s' e.Index) e._ ('s' e.Index) e._ = LPattern; + e._ = HardPattern; + } +} + +/* + == t.ExprType* + t.ExprType ::= OpenE | (s.Mode e.Index) | Forbidden +*/ +ExprType-Rec { + e._ (Var 'e' e._) e._ (Var 'e' e._) e._ = OpenE; + + e.Expr + = ; + (ADT-Brackets (e.Name) e.InBrackets) = ; + + (s.Brackets e.InBrackets) + , ClosureBrackets CallBrackets ColdCallBrackets : e._ s.Brackets e._ + = Forbidden; + + t.Other = /* пропускаем */; + } + e.Expr + >; +} + +/* + == True | False + == True | False +*/ +$ENTRY IsLExpr { + e.Expr + = + : { + HardPattern = True; + LPattern = True; + s._ = False; + } +} + +$ENTRY IsHardExpr { + e.Expr + = + : { + HardPattern = True; + s._ = False; + } +} From afcf7188f38714209c0eac64d762c9b9ce36e53d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 19:55:22 +0300 Subject: [PATCH 025/208] =?UTF-8?q?$EXTERN=E2=80=99=D1=8B=20=D0=BE=D1=82?= =?UTF-8?q?=D1=81=D0=BE=D1=80=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=B2=C2=A0=D0=BF=D0=BE=D1=80=D1=8F=D0=B4=D0=BA=D0=B5?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 11 +++++------ src/compiler/OptTree-Drive.ref | 6 +++--- src/compiler/OptTree-Spec.ref | 19 ++++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 7110fa4f..59090764 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -1,16 +1,15 @@ $INCLUDE "LibraryEx"; -*$FROM TreeUtils -$EXTERN HashName; -$EXTERN ExtractVariables-Expr; +*$FROM OptTree-StopRelation +$EXTERN OptTree-CanonizeExpr, OptTree-CheckExprStopRelation; *$FROM GenericMatch $EXTERN Solve-Drive; -*$FROM OptTree-StopRelation -$EXTERN OptTree-CanonizeExpr; -$EXTERN OptTree-CheckExprStopRelation; +*$FROM TreeUtils +$EXTERN HashName; + IsPassiveCall { e.Expr diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index 32d13a44..dcb7474c 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -1,15 +1,15 @@ $INCLUDE "LibraryEx"; -*$FROM TreeUtils -$EXTERN ExtractVariables, HashName, IsLExpr; - *$FROM Log $EXTERN Log-PutLine; *$FROM DisplayName $EXTERN DisplayName; +*$FROM TreeUtils +$EXTERN HashName, ExtractVariables, IsLExpr; + *$FROM OptTree-Drive-Expr $EXTERN OptTree-Drive-Expr, ApplyContractions; diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 41fb0b00..0aa19b0e 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -1,24 +1,25 @@ $INCLUDE "LibraryEx"; -*$FROM TreeUtils -$EXTERN ExtractVariables, ExtractVariables-Expr, NewVarName, AddSuffix, - IsHardExpr; - -*$FROM GenericMatch -$EXTERN GenericMatch, Solve-Spec; - *$FROM Log $EXTERN Log-PutLine, Log-InlineExpr; *$FROM DisplayName $EXTERN DisplayName; -*$FROM GlobalGen -$EXTERN GlobalGen; +*$FROM TreeUtils +$EXTERN AddSuffix, ExtractVariables-Expr, NewVarName, ExtractVariables, + IsHardExpr; + +*$FROM GenericMatch +$EXTERN Solve-Spec, GenericMatch; *$FROM OptTree-StopRelation $EXTERN OptTree-CanonizeExpr, OptTree-CheckExprStopRelation; +*$FROM GlobalGen +$EXTERN GlobalGen; + + /** == e.AST^ From 2f85679eeafad521c03b54a5279a6e4bee365d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 20:04:34 +0300 Subject: [PATCH 026/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20ExpandClosures-Result=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B2=C2=A0TreeUtils.ref=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree.ref | 26 +++----------------------- src/compiler/TreeUtils.ref | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index ce79dc7a..3279744f 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -17,6 +17,9 @@ $EXTERN OptTree-Drive-Prepare, OptTree-Drive, OptTree-Drive-CleanupColdCalls; *$FROM OptTree-Spec $EXTERN OptTree-Spec-Prepare, OptTree-Spec; +*$FROM TreeUtils +$EXTERN ExpandClosures-Result; + *$FROM Log $EXTERN Log-AST; @@ -169,29 +172,6 @@ ExpandClosures-Sentence { ); } -ExpandClosures-Result { - e.Result = ; -} - -ExpandClosures-ResultTerm { - (Brackets e.Expr) = (Brackets ); - - (ADT-Brackets (e.Name) e.Expr) - = (ADT-Brackets (e.Name) ); - - (CallBrackets (ClosureBrackets e.Content) e.Expr) - = (CallBrackets ); - - (CallBrackets e.Expr) = (CallBrackets ); - - /* - Анализировать холодные вызовы (ColdCallBrackets …) не нужно, - поскольку они были проанализированы на предыдущих проходах - и с тех пор не менялись. - */ - - t.OtherTerm = t.OtherTerm; -} * Интерпретатор императивного кода оптимизаций diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index 55493569..f2652e45 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -233,3 +233,30 @@ $ENTRY IsHardExpr { s._ = False; } } + +/** + == e.Expr +*/ +$ENTRY ExpandClosures-Result { + e.Result = ; +} + +ExpandClosures-ResultTerm { + (Brackets e.Expr) = (Brackets ); + + (ADT-Brackets (e.Name) e.Expr) + = (ADT-Brackets (e.Name) ); + + (CallBrackets (ClosureBrackets e.Content) e.Expr) + = (CallBrackets ); + + (CallBrackets e.Expr) = (CallBrackets ); + + /* + Анализировать холодные вызовы (ColdCallBrackets …) не нужно, + поскольку они были проанализированы на предыдущих проходах + и с тех пор не менялись. + */ + + t.OtherTerm = t.OtherTerm; +} From 951aed0a7939732ff6065b59b685d88bdb16ae75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 20:10:34 +0300 Subject: [PATCH 027/208] =?UTF-8?q?FIXED:=20=D1=83=D1=82=D0=BE=D1=87=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B8=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B2=D1=8B=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В коммите 286a098a9 классификация была неточная, но к ошибкам это не приводило. --- src/compiler/TreeUtils.ref | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index f2652e45..ed63610b 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -171,14 +171,14 @@ HashName-Suffix { } /** - == HardPattern | LPattern | Pattern | Expr + == HardPattern | LPattern | Pattern | Result */ $ENTRY ExprType { e.Expr = : { - e._ OpenE e._ = Expr; - e._ Forbidden e._ = Expr; + e._ Forbidden e._ = Result; + e._ OpenE e._ = Pattern; e._ ('e' e.Index) e._ ('e' e.Index) e._ = Pattern; e._ ('t' e.Index) e._ ('t' e.Index) e._ = Pattern; e._ ('s' e.Index) e._ ('s' e.Index) e._ = LPattern; From add183e6724df9408a77748f1ec411fd0c639b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 20:17:31 +0300 Subject: [PATCH 028/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BA=D0=B8=20=D0=BD=D0=B0=C2=A0=D0=BF=D0=B0=D1=81=D1=81?= =?UTF-8?q?=D0=B8=D0=B2=D0=BD=D0=BE=D0=B5=20=D0=B2=D1=8B=D1=80=D0=B0=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 27 ++------------------------- src/compiler/TreeUtils.ref | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 59090764..002ff5d7 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -8,32 +8,9 @@ $EXTERN OptTree-CanonizeExpr, OptTree-CheckExprStopRelation; $EXTERN Solve-Drive; *$FROM TreeUtils -$EXTERN HashName; +$EXTERN IsPassiveExpr, HashName; -IsPassiveCall { - e.Expr - = ; - False t.Term = False; - } - True - e.Expr - > - -} - -IsPassiveCall-Aux { - (Brackets e.Expr) = ; - (ADT-Brackets e.Expr) = ; - - (CallBrackets e.Expr) = False; - (ColdCallBrackets e.Expr) = False; - - t.Other = True; -} - /** == t.OptInfo^ e.Branches (e.NewFunctions) @@ -803,7 +780,7 @@ OptExpr-MakeSubstitutions { (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.Function t.Metatables /* Активные вызовы игнорируем */ - , : False + , : False = t.Metatables ; diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index ed63610b..c32c56d6 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -171,13 +171,14 @@ HashName-Suffix { } /** - == HardPattern | LPattern | Pattern | Result + == HardPattern | LPattern | Pattern | Result | ActiveResut */ $ENTRY ExprType { e.Expr = : { - e._ Forbidden e._ = Result; + e._ CallBrackets e._ = ActiveResut; + e._ ClosureBrackets e._ = Result; e._ OpenE e._ = Pattern; e._ ('e' e.Index) e._ ('e' e.Index) e._ = Pattern; e._ ('t' e.Index) e._ ('t' e.Index) e._ = Pattern; @@ -201,9 +202,12 @@ ExprType-Rec { (Brackets e.InBrackets) = ; (ADT-Brackets (e.Name) e.InBrackets) = ; - (s.Brackets e.InBrackets) - , ClosureBrackets CallBrackets ColdCallBrackets : e._ s.Brackets e._ - = Forbidden; + (ClosureBrackets e.InBrackets) + = ClosureBrackets; + + (s.CallBrackets e.InBrackets) + , CallBrackets ColdCallBrackets : e._ s.CallBrackets e._ + = CallBrackets; t.Other = /* пропускаем */; } @@ -214,6 +218,7 @@ ExprType-Rec { /* == True | False == True | False + == True | False */ $ENTRY IsLExpr { e.Expr @@ -234,6 +239,15 @@ $ENTRY IsHardExpr { } } +$ENTRY IsPassiveExpr { + e.Expr + = + : { + ActiveResut = False; + s._ = True; + } +} + /** == e.Expr */ From 4b66d73bd4ac3d404f54d9415de8e56faed28ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 20:41:58 +0300 Subject: [PATCH 029/208] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=B8=D0=B5=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=D0=B8=20=D0=B2=C2=A0OptTree-Drive-Expr?= =?UTF-8?q?.ref=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 75 +++++++++++------------------ 1 file changed, 27 insertions(+), 48 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 002ff5d7..133a4a71 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -22,14 +22,10 @@ $ENTRY OptTree-Drive-Expr { (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr = : ((s._CntNodes) t.OptInfo^ (e.NewFunctions)) e.DriveTree - = t.OptInfo >> + = t.OptInfo > (e.NewFunctions); } -MapUnBracket { - e.Sequence = ; -} - ColdTree { e.Branches = ':' )) > + = ':' ))> } CheckExprsStopRelation { @@ -177,8 +173,7 @@ FlatDriveTree { e.Branches = ) + (e.Branch) = } e.Branches >; @@ -186,32 +181,24 @@ FlatDriveTree { FlatDriveTreeAux { (e.Contractions (e.DrivenRight) (e.Branches)) - = : e.BrachPacks - = ; + = : e.Branches^ + = ; } FlatDriveTreeSingle { - (e.Contractions (e.DrivenRight) (/* пустое дерево */)) + e.Contractions (e.DrivenRight) (/* пустое дерево */) = (e.Contractions (e.DrivenRight)); - (e.Contractions (e.DrivenRight) (e.BrachPacks)) + e.Contractions (e.DrivenRight) (e.Branches) = - (e.BranchDrivenRight) - ) - } - e.Branches - >; + (e.BrachContractions (e.BranchDrivenRight)) + = ( + + (e.BranchDrivenRight) + ) } - e.BrachPacks + e.Branches >; } @@ -232,7 +219,8 @@ ComposeContractions { ); } e.A - > e.B; + > + e.B; } OptExpr-Aux { @@ -266,16 +254,7 @@ OptExpr-Aux { IntrinsicCall { (e.UsedVars) t.IntrinsicFunction t.Metatables (e.Args) '__Meta_Mu' - = - : { - t.Metatables^ Ok e.Result - = t.Metatables - ((e.UsedVars) ( ':' e.Result) (/* нет новых функций */)); - - t.Metatables^ MakeColdCall - = t.Metatables - ; - }; + = ; (e.UsedVars) t.IntrinsicFunction t.Metatables (e.Args) e.BehaviorName = e.BehaviorName @@ -305,16 +284,7 @@ IntrinsicCall { e._ = { e._ = MakeColdCall }; } : s.TransformFunction - = - : { - Ok e.Result - = ((e.UsedVars) ( ':' e.Result) (/* нет новых функций */)); - - MakeColdCall - = ; - } - : e.Substitutions - = t.Metatables e.Substitutions; + = t.Metatables ; } eDRIVEN { @@ -776,7 +746,16 @@ OptExpr-MakeSubstitutions { , t.IntrinsicFunction : (Intrinsic (e._) Intrinsic e.BehaviorName) = ; + > + : { + t.Metatables^ Ok e.Result + = t.Metatables + ((e.UsedVars) ( ':' e.Result) (/* нет новых функций */)); + + t.Metatables^ MakeColdCall + = t.Metatables + ; + }; (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.Function t.Metatables /* Активные вызовы игнорируем */ From 849b24c7bebd2392e5bf50190ae241f8c4a6e7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 20:45:47 +0300 Subject: [PATCH 030/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D0=B2=D1=8B=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20OptTree-Drive-Intrinsic=20?= =?UTF-8?q?=D0=B2=C2=A0=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB,=20=D1=88=D0=B0=D0=B3=201=20(?= =?UTF-8?q?#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Файл OptTree-Drive-Expr.ref переименован для сохранения истории правок. --- .../{OptTree-Drive-Expr.ref => OptTree-Drive-Intrinsic.ref} | 0 src/compiler/OptTree-Drive.ref | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/compiler/{OptTree-Drive-Expr.ref => OptTree-Drive-Intrinsic.ref} (100%) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Intrinsic.ref similarity index 100% rename from src/compiler/OptTree-Drive-Expr.ref rename to src/compiler/OptTree-Drive-Intrinsic.ref diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index dcb7474c..1f1997f8 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -10,7 +10,7 @@ $EXTERN DisplayName; *$FROM TreeUtils $EXTERN HashName, ExtractVariables, IsLExpr; -*$FROM OptTree-Drive-Expr +*$FROM OptTree-Drive-Intrinsic $EXTERN OptTree-Drive-Expr, ApplyContractions; From 764a0cec1b5ff3155e48800254c90839aac7fec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 21:50:56 +0300 Subject: [PATCH 031/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D0=BF=D1=80=D0=BE=D1=8F?= =?UTF-8?q?=D1=81=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=BA=D0=B8?= =?UTF-8?q?=20(#340,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 114 ++++++++++++++-------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index f3a2550b..8c0b46b3 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -16,28 +16,16 @@ $EXTERN IsPassiveExpr, HashName; /** - == t.OptInfo^ e.Branches (e.NewFunctions) + == t.OptInfo^ e.FlatBranches (e.NewFunctions) - e.Branches ::= (e.Contractions (e.DrivenExpr))* + e.FlatBranches ::= (e.Contractions (e.DrivenExpr))* e.UsedVars, e.WholeVars ::= (s.Mode e.Index)* */ $ENTRY OptTree-Drive-Expr { (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr = : ((s._CntNodes) t.OptInfo^ (e.NewFunctions)) e.DriveTree - = t.OptInfo > - (e.NewFunctions); -} - -ColdTree { - e.Branches - = )) - } - e.Branches - >; + = t.OptInfo (e.NewFunctions); } ColdAll { @@ -64,12 +52,13 @@ IncWithMax { s.Cnt s.Max = s.Max; } -CheckExprsLength { - 0 e._ = TooMany; - s.Cnt t.Expr e.Exprs = e.Exprs>; - s.Cnt = OK; -} +/* + == t.DriveTreeState t.TreeBranch* + == t.DriveTreeState t.TreeBranch* + t.DriveTreeState ::= ((s.CntNodes) t.OptInfo (e.NewFunctions)) + t.TreeBranch ::= (e.Contractions (e.DrivenRight) (t.TreeBranch*)) +*/ MakeDriveTree { (s.CntNodes) (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr (s.TreeDepth e.canoninzedExprs) @@ -82,12 +71,10 @@ MakeDriveTree { True s.Cnt = Generalize t.OptInfo s.Cnt; s._ s._, : s.CntNodes - = ((s.CntNodes) t.OptInfo (/* нет функций */)) - (/* нет сужений */ (e.Expr) (/* пустое дерево */) ); + = >; s._ s._, : s.TreeDepth - = ((s.CntNodes) t.OptInfo (/* нет функций */)) - (/* нет сужений */ (e.Expr) (/* пустое дерево */) ); + = >; False s._Cnt = + == t.DriveTreeState t.TreeBranch -- one branch +*/ +DriveStateWithLeaf { + s.CntNodes t.OptInfo e.Expr + = ((s.CntNodes) t.OptInfo (/* нет функций */)) + (/* нет сужений */ (e.Expr) (/* пустое дерево */)); +} + GrowDriveTree { (s.CntNodes) (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr (s.TreeDepth e.canoninzedExprs) @@ -104,26 +101,39 @@ GrowDriveTree { = : { (e.OptFuncNames^ None) e.Expr^ - = ((s.CntNodes) ((e.OptFuncNames) e.OptFuncs) (/* нет функций */)) - (/* нет сужений */ (e.Expr) (/* пустое дерево */)); + = ; (e.OptFuncNames^ t.Call) e.Expr^ - = + : (e.OptFuncs^) (e.NewFunctions) e.Branches + + = ; + ((e.OptFuncNames) e.OptFuncs) + (s.TreeDepth e.canoninzedExprs) (e.NewFunctions) e.Branches + > + : { + Generalize t.OptInfo 1 + = + (s.TreeDepth e.canoninzedExprs) + >; + + Generalize t.OptInfo s.Cnt = Generalize t.OptInfo ; + + Tree t.DriveTreeState e.Branches^ = t.DriveTreeState e.Branches; + }; }; } -GrowDriveTree-Call { - (s.CntNodes) (e.UsedVars) (e.WholeVars) ((e.OptFuncNames) e.OptFuncs) e.Expr - (s.TreeDepth e.canoninzedExprs) t.Call - = - : (e.OptFuncs^) (e.NewFunctions) e.Branches +GrowDriveTree-DriveBranches { + (s.CntNodes) (e.UsedVars) (e.WholeVars) t.OptInfo + (s.TreeDepth e.canoninzedExprs) (e.NewFunctions) e.Branches = : { - (Generalize t.OptInfo 1) e._DeletedTree - = - (s.TreeDepth e.canoninzedExprs) - >; - - (Generalize t.OptInfo s.Cnt) e._DeletedTree - = Generalize t.OptInfo ; + (Generalize t.OptInfo s.Cnt) e._tree = Generalize t.OptInfo s.Cnt; - e.Tree = e.Tree; + t.DriveTreeState e.Tree = Tree t.DriveTreeState e.Tree; }; } @@ -176,23 +178,21 @@ FlatDriveTree { e.Branches = + (e.Contractions (e.DrivenRight) (e.Branches^)) + = : e.FlatBranches + = ; } e.Branches >; } -FlatDriveTreeAux { - (e.Contractions (e.DrivenRight) (e.Branches)) - = : e.Branches^ - = ; -} - FlatDriveTreeSingle { e.Contractions (e.DrivenRight) (/* пустое дерево */) = (e.Contractions (e.DrivenRight)); - e.Contractions (e.DrivenRight) (e.Branches) + e.Contractions (e.DrivenRight) (e.FlatBranches) = ; } From 8d1a41813aa92a607acb15a0596ad77864c6013e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 21:55:46 +0300 Subject: [PATCH 032/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D1=87=D1=91=D1=82=20?= =?UTF-8?q?=D1=82=D0=BE=D0=B3=D0=BE,=20=D1=87=D1=82=D0=BE=20=D1=81=D1=83?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=8F=D1=8E=D1=82=D1=81=D1=8F=20=D0=BF=D0=BE=D1=81=D0=BB?= =?UTF-8?q?=D0=B5=D0=B4=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 8c0b46b3..42d28de1 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -196,36 +196,12 @@ FlatDriveTreeSingle { = - (e.BranchDrivenRight) - ) + = (e.Contractions e.BrachContractions (e.BranchDrivenRight)) } e.FlatBranches >; } -ComposeContractions { - (e.A) (e.B) - = ; - } - e.ARight - > - ); - } - e.A - > - e.B; -} - OptExpr-Aux { (e.UsedVars) (e.WholeVars) (e.Expr) (CallBrackets (Symbol Name e.Name) e.Args) From b03864cc03ba4471036e127c4c4c16a4f8c22877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 22:07:03 +0300 Subject: [PATCH 033/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D1=84=D1=83=D0=BD=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20FlatDriveTree=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 31 ++++++++++++----------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 42d28de1..425b47e5 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -178,30 +178,25 @@ FlatDriveTree { e.Branches = : e.FlatBranches - = : e.FlatBranches + = ; } e.Branches >; } -FlatDriveTreeSingle { - e.Contractions (e.DrivenRight) (/* пустое дерево */) - = (e.Contractions (e.DrivenRight)); - - e.Contractions (e.DrivenRight) (e.FlatBranches) - = ; -} - OptExpr-Aux { (e.UsedVars) (e.WholeVars) (e.Expr) (CallBrackets (Symbol Name e.Name) e.Args) From de2a0d56aed8d42ca11529cdcb49c25a9162f9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 22:51:29 +0300 Subject: [PATCH 034/208] =?UTF-8?q?FIXED:=20=D1=80=D0=B0=D0=B7=D0=B2=D1=91?= =?UTF-8?q?=D1=80=D1=82=D0=BA=D0=B0=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B7=D0=B0=D0=BC=D1=8B=D0=BA=D0=B0=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=D1=85=20(#251,=20#340,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 11 +++++------ src/compiler/OptTree-Spec.ref | 7 +++++++ src/compiler/OptTree.ref | 1 - 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 425b47e5..48a4d8a4 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -11,7 +11,7 @@ $EXTERN OptTree-Drive-Intrinsic; $EXTERN Solve-Drive; *$FROM TreeUtils -$EXTERN IsPassiveExpr, HashName; +$EXTERN ExpandClosures-Result, IsPassiveExpr, HashName; /** @@ -23,6 +23,7 @@ $EXTERN IsPassiveExpr, HashName; */ $ENTRY OptTree-Drive-Expr { (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr + = : e.Expr^ = : ((s._CntNodes) t.OptInfo^ (e.NewFunctions)) e.DriveTree = t.OptInfo (e.NewFunctions); @@ -214,12 +215,10 @@ OptExpr-Aux { : e.DrivenRight + = : e.DrivenRight^ = (e.NewFunctions e.NewFunction) - ( - (e.UsedVars) - e.Contractions - () - ); + ((e.UsedVars) e.Contractions (e.DrivenRight)); } (/* new functions */) e.SubstitutionPacks diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 0aa19b0e..deae11a2 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -364,6 +364,13 @@ SpecResult-Pass { и пытается выполнить специализацию для него */ SpecTerm { + s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) + (CallBrackets (ClosureBrackets e.ClosureContent) e.Argument) + = ; + s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets (Symbol Name e.Name) e.Expression) , e.Name : e._ '@' 0 diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index 3279744f..9a8c0f19 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -84,7 +84,6 @@ $ENTRY OptTree { (loop-for-warm-functions (pass (trace 'before Drive') - (call &ExpandClosures) (call &OptTree-Drive))) (call &WarmColdFunctions DRIVE) (call &OptTree-Drive-CleanupColdCalls)) From 899604a1142b0a1ab3423ec697657cb226bdc743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 21 Jul 2021 23:56:39 +0300 Subject: [PATCH 035/208] =?UTF-8?q?FIXED:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=B2=D1=83=D1=85?= =?UTF-8?q?=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20(#322,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Первая ошибка в том, что функция расстановки координат не учитывала холодные скобки вызова, из-за чего координаты размечала неправильно. (Неправильно она размечала координаты из-за неправильного выхода из рекурсии). • Вторая ошибка, которая выявила первую ошибку, была допущена в коммите add183e6. В функции определения типов выражений для некоторых аргументов открытые переменные имели приоритет над наличием скобок вызова. --- autotests/opt-tree-match2.ref | 7 +++++++ src/compiler/GenericMatch.ref | 7 +++++-- src/compiler/TreeUtils.ref | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 autotests/opt-tree-match2.ref diff --git a/autotests/opt-tree-match2.ref b/autotests/opt-tree-match2.ref new file mode 100644 index 00000000..bee2aea0 --- /dev/null +++ b/autotests/opt-tree-match2.ref @@ -0,0 +1,7 @@ +* TREE + +$ENTRY Go { + e.X = e.X () e.X : e._ = /* empty */; +} + +gen_e__ { e.X = e.X } diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index d9a16324..0de7265b 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -403,6 +403,10 @@ DoAddCoordinateLabels { = (CallBrackets e.Inner) ('{'s.CoordNumber'}') >; + ((ColdCallBrackets e.Inner) e.Rest) s.CoordNumber + = (CallBrackets e.Inner) ('{'s.CoordNumber'}') + >; + ((Brackets e.Expr) e.Rest) s.CoordNumber = (Brackets ('{'s.CoordNumber'}') @@ -427,8 +431,7 @@ DoAddCoordinateLabels { > }; - (e.Other) s.CoordNumber - = e.Other; + (/* пусто */) s.CoordNumber = /* пусто */; } /* diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index c32c56d6..aadce2d0 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -192,7 +192,8 @@ $ENTRY ExprType { t.ExprType ::= OpenE | (s.Mode e.Index) | Forbidden */ ExprType-Rec { - e._ (Var 'e' e._) e._ (Var 'e' e._) e._ = OpenE; + e.Begin (Var 'e' e._) e.Middle (Var 'e' e._) e.End + = OpenE ; e.Expr = Date: Thu, 22 Jul 2021 00:03:57 +0300 Subject: [PATCH 036/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B9=20?= =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D0=B3=20ExprType-Rec=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/TreeUtils.ref | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index aadce2d0..7c7624f5 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -201,14 +201,12 @@ ExprType-Rec { (Var s.Mode e.Index) = (s.Mode e.Index); (Brackets e.InBrackets) = ; - (ADT-Brackets (e.Name) e.InBrackets) = ; + (ADT-Brackets (e._) e.InBrackets) = ; - (ClosureBrackets e.InBrackets) - = ClosureBrackets; + (ClosureBrackets e._) = ClosureBrackets; - (s.CallBrackets e.InBrackets) - , CallBrackets ColdCallBrackets : e._ s.CallBrackets e._ - = CallBrackets; + (CallBrackets e._) = CallBrackets; + (ColdCallBrackets e._) = CallBrackets; t.Other = /* пропускаем */; } From f5e3ade2eccc22607fa055b14daf6ac7e7eca7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Thu, 22 Jul 2021 01:37:00 +0300 Subject: [PATCH 037/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=89=D1=91=D0=BD=20=D0=B8=C2=A0=D0=B4=D0=BE=D0=BA=D1=83=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=20=D1=82?= =?UTF-8?q?=D0=B8=D0=BF=20OptTree-Drive-Intrinsic=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 4 +--- src/compiler/OptTree-Drive-Intrinsic.ref | 12 ++++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 48a4d8a4..a8343bd9 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -242,9 +242,7 @@ eDRIVEN { OptExpr-MakeSubstitutions { (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.IntrinsicFunction t.Metatables , t.IntrinsicFunction : (Intrinsic (e._) Intrinsic e.BehaviorName) - = + = : { t.Metatables^ Ok e.Result = t.Metatables diff --git a/src/compiler/OptTree-Drive-Intrinsic.ref b/src/compiler/OptTree-Drive-Intrinsic.ref index e52a40cb..3a16dcfc 100644 --- a/src/compiler/OptTree-Drive-Intrinsic.ref +++ b/src/compiler/OptTree-Drive-Intrinsic.ref @@ -1,11 +1,19 @@ $INCLUDE "LibraryEx"; +/** + + == t.Metatables Ok e.Result + == t.Metatables MakeColdCall + + t.Metatables ::= (t.Metatable*) + e.Args, e.Result ::= e.ReducedExpression +*/ $ENTRY OptTree-Drive-Intrinsic { - (e.UsedVars) t.IntrinsicFunction t.Metatables (e.Args) '__Meta_Mu' + t.Metatables (e.Args) '__Meta_Mu' = ; - (e.UsedVars) t.IntrinsicFunction t.Metatables (e.Args) e.BehaviorName + t.Metatables (e.Args) e.BehaviorName = e.BehaviorName : { 'Add' = &Intrinsic-Add; From f9df2acb7b449cbf988d2d8189311b64f614d6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Thu, 22 Jul 2021 02:26:29 +0300 Subject: [PATCH 038/208] =?UTF-8?q?=D0=98=D0=B7=D0=B1=D1=8B=D1=82=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D1=8B=D0=B5=20=D0=BA=D0=BE=D0=BF=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D1=8B=D1=85,=20=D0=BF=D1=80=D0=BE=D0=BF?= =?UTF-8?q?=D1=83=D1=89=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20#290=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Формально, данные повторные переменные не подходят под критерий #290: однозначное вхождение в последнем предложении. Но в случае второго предложения здесь: : { Generalize t.OptInfo^ 1 = … Generalize t.OptInfo^ s.Cnt = … Tree t.DriveTreeState e.Branches^ = … } можно выдать предупреждение на t.OptInfo по следующему критерию — последующие предложения не способны поглотить аргумент, совпадающий с данным. И поэтому переменная подозрительная. Так что, возможно, критерий стоит уточнить. --- src/compiler/OptTree-Drive-Expr.ref | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index a8343bd9..93fd807d 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -115,14 +115,14 @@ GrowDriveTree { (s.TreeDepth e.canoninzedExprs) (e.NewFunctions) e.Branches > : { - Generalize t.OptInfo 1 + Generalize t.OptInfo^ 1 = (s.TreeDepth e.canoninzedExprs) >; - Generalize t.OptInfo s.Cnt = Generalize t.OptInfo ; + Generalize t.OptInfo^ s.Cnt = Generalize t.OptInfo ; Tree t.DriveTreeState e.Branches^ = t.DriveTreeState e.Branches; }; @@ -155,7 +155,7 @@ GrowDriveTree-DriveBranches { e.Branches > : { - (Generalize t.OptInfo s.Cnt) e._tree = Generalize t.OptInfo s.Cnt; + (Generalize t.OptInfo^ s.Cnt) e._tree = Generalize t.OptInfo s.Cnt; t.DriveTreeState e.Tree = Tree t.DriveTreeState e.Tree; }; From 49c506138304131862ae0b8d266c28dc9a419069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 23 Jul 2021 08:31:39 +0300 Subject: [PATCH 039/208] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BA=D0=BE=D0=BF=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=B0=20-OAiDS=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 48 ++++++++++++++++------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 93fd807d..ca88d073 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -102,9 +102,11 @@ GrowDriveTree { = : { (e.OptFuncNames^ None) e.Expr^ + = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo^ = ; (e.OptFuncNames^ t.Call) e.Expr^ + = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo^ = : (e.OptFuncs^) (e.NewFunctions) e.Branches @@ -531,41 +533,45 @@ ApplyAssigns-Term { */ $ENTRY ApplyContractions { e.Expr (e.Contrs) - = - } - e.Expr - >; + = : (e._) e.Expr^ + = e.Expr; +} + +ApplyContractions-Expr { + (e.Contrs) e.Expr = ; } ApplyContractions-Term { - (Brackets e.Expr) (e.Contrs) - = (Brackets ); + (e.Contrs) (Brackets e.Expr) + = : (e.Contrs^) e.Expr^ + = (e.Contrs) (Brackets e.Expr); - (CallBrackets e.Args) (e.Contrs) - = (CallBrackets ); + (e.Contrs) (CallBrackets e.Expr) + = : (e.Contrs^) e.Expr^ + = (e.Contrs) (CallBrackets e.Expr); - (ColdCallBrackets e.OriginArgs) (e.Contrs) - = + (e.Contrs) (ColdCallBrackets e.OriginArgs) + = : { * Содержимое холодных скобок не изменилось, оставляем их холодными - e.OriginArgs = (ColdCallBrackets e.OriginArgs); + (e.Contrs^) e.OriginArgs = (e.Contrs) (ColdCallBrackets e.OriginArgs); * Содержимое обновилось, оттаиваем скобки - e.ChangedArgs = (CallBrackets e.ChangedArgs); + (e.Contrs^) e.ChangedArgs = (e.Contrs) (CallBrackets e.ChangedArgs); }; - (ClosureBrackets e.Args) (e.Contrs) - = (ClosureBrackets ); + (e.Contrs) (ClosureBrackets e.Expr) + = : (e.Contrs^) e.Expr^ + = (e.Contrs) (ClosureBrackets e.Expr); - (ADT-Brackets (e.Name) e.Expr) (e.Contrs) - = (ADT-Brackets (e.Name) ); + (e.Contrs) (ADT-Brackets (e.Name) e.Expr) + = : (e.Contrs^) e.Expr^ + = (e.Contrs) (ADT-Brackets (e.Name) e.Expr); - t.Term (e.B (t.Term ':' e.Contr) e.E) - = ; + (e.B (t.Term ':' e.Contr) e.E) t.Term + = ; - t.T (e.Contrs) = t.T + (e.Contrs) t.T = (e.Contrs) t.T; } /* From de1f1ccc5e21c81ede51dd7759363a88751406c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 23 Jul 2021 21:07:15 +0300 Subject: [PATCH 040/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B9=20?= =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D0=B3=20=D0=BA=C2=A0=D0=BF=D1=80=D0=B5=D0=B4=D1=8B=D0=B4=D1=83?= =?UTF-8?q?=D1=89=D0=B5=D0=BC=D1=83=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B8=D1=82?= =?UTF-8?q?=D1=83=2049c50613=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index ca88d073..aaea17a6 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -112,8 +112,7 @@ GrowDriveTree { : (e.OptFuncs^) (e.NewFunctions) e.Branches = : { From ba534445eb9bea8a8c4949910cc676ded8442a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 23 Jul 2021 21:08:35 +0300 Subject: [PATCH 041/208] =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=B4=D0=B2=D0=B0?= =?UTF-8?q?=D1=80=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0=20=D0=BF=D0=BE=C2=A0?= =?UTF-8?q?=D0=BE=D1=82=D0=BD=D0=BE=D1=88=D0=B5=D0=BD=D0=B8=D1=8E=20=D0=A5?= =?UTF-8?q?=D0=B8=D0=B3=D0=BC=D0=B0=D0=BD=D0=B0=20=D0=B2=C2=A0=D1=83=D1=81?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=D0=B8=D0=B8=20=D0=BE=D1=81=D1=82=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BA=D0=B8=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Подавляющее большинство проверок на отношение Хигмана-Крускала даёт отрицательный ответ, поэтому имеет смысл предварительно проверять более быстрое отношение Хигмана, являющее необходимым условием для отншения Хигмана-Крускала. В коммит включена возможность включить отладочный код, выводящий статистику успешности отношений Х. и Х.-К. --- src/compiler/OptTree-StopRelation.ref | 42 ++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/compiler/OptTree-StopRelation.ref b/src/compiler/OptTree-StopRelation.ref index 0d71c6cb..55d4572a 100644 --- a/src/compiler/OptTree-StopRelation.ref +++ b/src/compiler/OptTree-StopRelation.ref @@ -28,7 +28,47 @@ $INCLUDE "LibraryEx"; */ $ENTRY OptTree-CheckExprStopRelation { (e.CurrentExpr) e.HistoryExpr - = ; + , () + > + : True + = >; + + (e.CurrentExpr) e.HistoryExpr = ; +} + +*$DRIVE Trace; + +Trace { +*/* + s.SubseqRes e.HKRes = e.HKRes; +/*/ + s.SubseqRes e.HKRes = e.HKRes; +*/ +} + +CheckSubsequenceRelation { + e._ t.Common e.CurrentExpr (t.Common e.HistoryExpr) + = ; + + e.CurrentExpr (/* пусто */) = True; + e.CurrentExpr (e.HistoryExpr) = False; +} + +Tokenize { + e.Expression + = (')'); + (ADT-Brackets (e.Name) e.Inner) = ('[' e.Name) (']'); + (CallBrackets e.Inner) = ('<') ('>'); + (ColdCallBrackets e.Inner) = ('<*') ('*>'); + (ClosureBrackets e.Inner) = ('{{') ('}}'); + + t.Other = t.Other; + } + e.Expression + > } CheckHKRelation { From 3f7d6dc1ed8e2ca1fee4397bcb2285e7d1040b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 23 Jul 2021 22:27:01 +0300 Subject: [PATCH 042/208] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BA=D0=BE=D0=BF=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=B0=20-OAiDS=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index aaea17a6..9a9d90d6 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -106,11 +106,11 @@ GrowDriveTree { = ; (e.OptFuncNames^ t.Call) e.Expr^ - = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo^ - = : (e.OptFuncs^) (e.NewFunctions) e.Branches + = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo^ + = Date: Fri, 23 Jul 2021 22:43:18 +0300 Subject: [PATCH 043/208] =?UTF-8?q?=D0=A1=D0=BF=D0=B5=D1=86=D0=B8=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B2=D1=8B=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=BE=D0=B2=20=D0=B8=C2=A0=D0=B7=D0=B0=D0=BC=D1=8B?= =?UTF-8?q?=D0=BA=D0=B0=D0=BD=D0=B8=D0=B9=20=D1=81=D0=BD=D0=B0=D1=80=D1=83?= =?UTF-8?q?=D0=B6=D0=B8=20=D0=B2=D0=BE=D0=B2=D0=BD=D1=83=D1=82=D1=80=D1=8C?= =?UTF-8?q?=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Во-первых, исправляется проблема со специализацией замыканий вида {{ &F\1 … {{ &G\1 … }} … }} когда наружнее &F\1 специализируется по специализированному внутреннему &G\1: {{ &F\1 … {{ &G\1 … }} … }} ↓ {{ &F\1 … {{ &G\1@1 … }} … }} ↓ {{ &F\1@1 … {{ &G\1@1 … }} … }} Во-вторых, устраняются два прохода: сначала функции, потом замыкания. Два прохода, фактически, были костылём. --- src/compiler/OptTree-Spec.ref | 54 ++++++++++++----------------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index deae11a2..9ee2cb43 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -333,11 +333,6 @@ SpecResult { = - : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) e.Result^ - = ; } @@ -391,23 +386,21 @@ SpecTerm { s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets (Symbol Name e.Name) e.Expression) + = + : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) + (CallBrackets (Symbol Name e.Name^) e.Expression^) /* SAME */ + = : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) e.Expression^ - = s.Pass - : { - Functions = &TrySpecCall; - Closures = &SkipSpecCall; - } - : s.TrySpecCall - - = ; + = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) + (CallBrackets (Symbol Name e.Name) e.Expression); s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets e.Expression) @@ -416,28 +409,15 @@ SpecTerm { e.Expression > : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) e.Expression^ + = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets e.Expression); s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (ClosureBrackets e.ClosureContent) - = - : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) - e.ClosureContent^ - - = s.Pass - : { - Functions = &SkipSpecCall; - Closures = &TrySpecCall; - } - : s.TrySpecCall - = : e.UsedVars = : (e._) e.eClosureArg - = @@ -464,6 +444,13 @@ SpecTerm { (Symbol Name e.OptName); e.ClosureContent^ + = + : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) + e.ClosureContent^ + = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (ClosureBrackets e.ClosureContent); }; @@ -540,11 +527,6 @@ TrySpecCall { (CallBrackets (Symbol Name e.Name) e.Expression); } -SkipSpecCall { - (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) t.CallTerm - = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) t.CallTerm; -} - /** Date: Fri, 23 Jul 2021 22:51:28 +0300 Subject: [PATCH 044/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B0=D1=80=D1=82=D0=B5?= =?UTF-8?q?=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D0=B2=20=D0=B4=D0=B2=D1=83=D1=85?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=85=D0=BE=D0=B4=D0=BD=D0=BE=D0=B9=20=D1=81?= =?UTF-8?q?=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 58 ++++++++++++----------------------- 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 9ee2cb43..61bbad17 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -330,22 +330,8 @@ SpecSentence { */ SpecResult { (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) e.Result - = ; -} - -SpecResult-Pass { - s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) e.Result = ; - } + &SpecTerm (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) e.Result >; @@ -359,14 +345,14 @@ SpecResult-Pass { и пытается выполнить специализацию для него */ SpecTerm { - s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) + (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets (ClosureBrackets e.ClosureContent) e.Argument) = ; - s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) + (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets (Symbol Name e.Name) e.Expression) , e.Name : e._ '@' 0 /* @@ -384,7 +370,7 @@ SpecTerm { = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets (Symbol Name e.Name) ); - s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) + (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets (Symbol Name e.Name) e.Expression) = : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) e.Expression^ = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets (Symbol Name e.Name) e.Expression); - s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) + (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets e.Expression) - = : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) e.Expression^ = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (CallBrackets e.Expression); - s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) + (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (ClosureBrackets e.ClosureContent) = : e.UsedVars = : (e._) e.eClosureArg @@ -444,8 +428,8 @@ SpecTerm { (Symbol Name e.OptName); e.ClosureContent^ - = : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) @@ -456,27 +440,25 @@ SpecTerm { }; - s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) + (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (Brackets e.Expression) - = : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) e.Expression^ = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (Brackets e.Expression); - s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) + (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (ADT-Brackets (e.Name) e.Expression) - = : (e.SpecInfo^ (e.Histories^) (e.History^) (e.NewFunctions^)) e.Expression^ = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) (ADT-Brackets (e.Name) e.Expression); - s.Pass (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) t.Other + (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) t.Other = (e.SpecInfo (e.Histories) (e.History) (e.NewFunctions)) t.Other; } From 06e182263f1add3dbc269e737f7f7c49dd0921bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 23 Jul 2021 23:06:27 +0300 Subject: [PATCH 045/208] $INLINE Map, Reduce, DoMapAccum (#359) --- src/lib/common/LibraryEx.refi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/common/LibraryEx.refi b/src/lib/common/LibraryEx.refi index 5f68f57a..84324a23 100644 --- a/src/lib/common/LibraryEx.refi +++ b/src/lib/common/LibraryEx.refi @@ -29,6 +29,7 @@ Map { t.Fn /* пусто */ = /* пусто */; } +$INLINE Map; $SPEC Map t.FUNC e.items; @@ -46,6 +47,7 @@ Reduce { t.Fn t.Acc /* пусто */ = t.Acc; } +$INLINE Reduce; $SPEC Reduce t.FUNC t.accum e.items; @@ -80,6 +82,7 @@ DoMapAccum { t.Fn t.Acc (e.Scanned) /* пусто */ = t.Acc e.Scanned; } +$INLINE DoMapAccum; $SPEC DoMapAccum t.FUNC t.acc (e.scanned) e.items; From 67a293a1e76edb5c31a5ffdb1beba28c4e1586ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 23 Jul 2021 23:09:51 +0300 Subject: [PATCH 046/208] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BD=D1=83=D0=B4?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D0=B5=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B0=D0=BA=D0=BA?= =?UTF-8?q?=D1=83=D0=BC=D1=83=D0=BB=D1=8F=D1=82=D0=BE=D1=80=D0=B0=20=D0=B2?= =?UTF-8?q?=C2=A0DoUnEscapeString-SR=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/Escape.ref | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/Escape.ref b/src/common/Escape.ref index 2b50548e..281f21f7 100644 --- a/src/common/Escape.ref +++ b/src/common/Escape.ref @@ -48,7 +48,7 @@ $ENTRY CharFromNum { { s.Accum s.Next = s.Next>; } - 0 + 0 > > >; } @@ -83,22 +83,22 @@ gen_e__ { e.Arg = e.Arg } DoUnEscapeString-SR { (e.Scanned) '\\x' e.HexAndTail = ) (/* scanned number */) e.HexAndTail + (e.Scanned) () () e.HexAndTail >; (e.Scanned) '\\X' e.HexAndTail = ) (/* scanned number */) e.HexAndTail + (e.Scanned) () () e.HexAndTail >; (e.Scanned) '\\d' e.DecAndTail = ) (/* scanned number */) e.DecAndTail + (e.Scanned) (10 ) () e.DecAndTail >; (e.Scanned) '\\D' e.DecAndTail = ) (/* scanned number */) e.DecAndTail + (e.Scanned) (10 ) () e.DecAndTail >; (e.Scanned) '\\' e.EscapedAndTail @@ -156,7 +156,7 @@ DoUnEscapeString-SR-DecOct { DoUnEscapeString-SR-Escape { (e.Scanned) (e.Octs-B s.Oct e.Octs-E) s.Oct e.Tail = ) e.Tail >; (e.Scanned) (e.Octs) s.Next e.Tail From a0aeae587ef982647dd0269e04e4714215d56d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 23 Jul 2021 23:27:39 +0300 Subject: [PATCH 047/208] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4=D1=80=D0=B5=D0=B2=D0=B5=D1=81?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B2=C2=A0rl-lexgen=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D0=B8=20gen=5Fe=5F=5F?= =?UTF-8?q?=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ранее древенсая оптимизация в lexgen’е подавлялась при помощи объявления функций как $SPEC State (e.acc) e.text; До реализации #251 «Специализация без шаблона» эта строчка подавляла специализацию функции-состояния в режиме -OA+. Сейчас эта строчка наоборот, форсирует специализацию этой функции даже в режиме -OA-. Избыточная прогонка подавлена при помощи организации автомата так, чтобы авторазметка (#251) рассматривала некоторые «опасные» функции как базисные, см. 0cda99e2d. В текущей версии 3.3 реализована поддержка функции обобщения gen_e__ (#331), которая предназначена для подавления специализации. Теперь все аккумуляторы принудительно обобщаются при помощи gen_e__. Прогонка подавляется за счёт того, что в актуальной версии не реализована прогонка функций с активным аргументом (#230). Потеря быстродействия не страшна, т.к. Простой Рефал уже deprecated (#318, DSL, который растворяется во время компиляции (#50). Потеря быстродей --- src/compiler/SR-Lexer.sref | 1168 +++++++++++++++++------------------- src/lexgen/DFA-Lexer.ref | 778 ++++++++++++------------ src/lexgen/Flex-Lexer.ref | 756 +++++++++++------------ src/lexgen/Generator.ref | 8 +- 4 files changed, 1296 insertions(+), 1414 deletions(-) diff --git a/src/compiler/SR-Lexer.sref b/src/compiler/SR-Lexer.sref index cd551f7d..49398aaf 100644 --- a/src/compiler/SR-Lexer.sref +++ b/src/compiler/SR-Lexer.sref @@ -429,721 +429,657 @@ $ENUM TokenError; Native . GEN:END*/ -$SPEC Root (e.acc) e.text; - Root { - (e.Accum) '%' e.Text = ; - (e.Accum) e.Text =
; + (e.Accum) '%' e.Text = ) e.Text>; + (e.Accum) e.Text =
) e.Text>; } -$SPEC StartNative-Percent (e.acc) e.text; - StartNative-Percent { - (e.Accum) '%' e.Text = ; - (e.Accum) e.Text = (TokenError 'Native inlines expects two percents')
; + (e.Accum) '%' e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Native inlines expects two percents')
) e.Text>; } -$SPEC Main (e.acc) e.text; - Main { - (e.Accum) ' ' e.Text =
; - (e.Accum) '\t' e.Text =
; - (e.Accum) '\r' e.Text =
; - (e.Accum) '<' e.Text = (#TkPunctuation e.Accum '<')
; - (e.Accum) '>' e.Text = (#TkPunctuation e.Accum '>')
; - (e.Accum) '(' e.Text = (#TkPunctuation e.Accum '(')
; - (e.Accum) ')' e.Text = (#TkPunctuation e.Accum ')')
; - (e.Accum) '{' e.Text = (#TkPunctuation e.Accum '{')
; - (e.Accum) '}' e.Text = (#TkPunctuation e.Accum '}')
; - (e.Accum) '[' e.Text = (#TkPunctuation e.Accum '[')
; - (e.Accum) ']' e.Text = (#TkPunctuation e.Accum ']')
; - (e.Accum) '=' e.Text = (#TkPunctuation e.Accum '=')
; - (e.Accum) ';' e.Text = (#TkPunctuation e.Accum ';')
; - (e.Accum) ':' e.Text = (#TkPunctuation e.Accum ':')
; - (e.Accum) ',' e.Text = (#TkPunctuation e.Accum ',')
; - (e.Accum) '#' e.Text = (#TkPunctuation e.Accum '#')
; - (e.Accum) '^' e.Text = (#TkPunctuation e.Accum '^')
; - (e.Accum) 's' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '_' e.Text = ; - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) '$' e.Text = ; - (e.Accum) '\'' e.Text = ; - (e.Accum) '\"' e.Text = ; - (e.Accum) '/' e.Text = ; - (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n') ; + (e.Accum) ' ' e.Text =
) e.Text>; + (e.Accum) '\t' e.Text =
) e.Text>; + (e.Accum) '\r' e.Text =
) e.Text>; + (e.Accum) '<' e.Text = (#TkPunctuation e.Accum '<')
) e.Text>; + (e.Accum) '>' e.Text = (#TkPunctuation e.Accum '>')
) e.Text>; + (e.Accum) '(' e.Text = (#TkPunctuation e.Accum '(')
) e.Text>; + (e.Accum) ')' e.Text = (#TkPunctuation e.Accum ')')
) e.Text>; + (e.Accum) '{' e.Text = (#TkPunctuation e.Accum '{')
) e.Text>; + (e.Accum) '}' e.Text = (#TkPunctuation e.Accum '}')
) e.Text>; + (e.Accum) '[' e.Text = (#TkPunctuation e.Accum '[')
) e.Text>; + (e.Accum) ']' e.Text = (#TkPunctuation e.Accum ']')
) e.Text>; + (e.Accum) '=' e.Text = (#TkPunctuation e.Accum '=')
) e.Text>; + (e.Accum) ';' e.Text = (#TkPunctuation e.Accum ';')
) e.Text>; + (e.Accum) ':' e.Text = (#TkPunctuation e.Accum ':')
) e.Text>; + (e.Accum) ',' e.Text = (#TkPunctuation e.Accum ',')
) e.Text>; + (e.Accum) '#' e.Text = (#TkPunctuation e.Accum '#')
) e.Text>; + (e.Accum) '^' e.Text = (#TkPunctuation e.Accum '^')
) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '_' e.Text = ) e.Text>; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) '$' e.Text = ) e.Text>; + (e.Accum) '\'' e.Text = ) e.Text>; + (e.Accum) '\"' e.Text = ) e.Text>; + (e.Accum) '/' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n') ) e.Text>; (e.Accum) = (#TkEOF e.Accum); - (e.Accum) s.Any e.Text = (#TkUnexpected e.Accum s.Any)
; + (e.Accum) s.Any e.Text = (#TkUnexpected e.Accum s.Any)
) e.Text>; } -$SPEC StartNative-NewLine (e.acc) e.text; - StartNative-NewLine { - (e.Accum) '\r' e.Text = ; - (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n') ; - (e.Accum) e.Text = (TokenError 'Native inlines expects new line after two percents')
; + (e.Accum) '\r' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n') ) e.Text>; + (e.Accum) e.Text = (TokenError 'Native inlines expects new line after two percents')
) e.Text>; } -$SPEC VariableStart (e.acc) e.text; - VariableStart { - (e.Accum) '.' e.Text = ; - (e.Accum) e.Text = ; + (e.Accum) '.' e.Text = ) e.Text>; + (e.Accum) e.Text = ) e.Text>; } -$SPEC Name (e.acc) e.text; - Name { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 's' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '_' e.Text = ; - (e.Accum) '-' e.Text = ; - (e.Accum) e.Text = (#TkName e.Accum)
; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '_' e.Text = ) e.Text>; + (e.Accum) '-' e.Text = ) e.Text>; + (e.Accum) e.Text = (#TkName e.Accum)
) e.Text>; } -$SPEC Number (e.acc) e.text; - Number { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) e.Text = (#TkNumber e.Accum)
; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) e.Text = (#TkNumber e.Accum)
) e.Text>; } -$SPEC Directive (e.acc) e.text; - Directive { - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) e.Text = (TokenError 'Expected directive name')
; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Expected directive name')
) e.Text>; } -$SPEC StringLiteral-Start (e.acc) e.text; - StringLiteral-Start { - (e.Accum) '\'' e.Text = (#TkLiteral-Char e.Accum '\'')
; - (e.Accum) e.Text = ; + (e.Accum) '\'' e.Text = (#TkLiteral-Char e.Accum '\'')
) e.Text>; + (e.Accum) e.Text = ) e.Text>; } -$SPEC CompoundSymbol (e.acc) e.text; - CompoundSymbol { - (e.Accum) '\"' e.Text = (#TkCompound e.Accum '\"')
; - (e.Accum) '\\' e.Text = ; - (e.Accum) '\n' e.Text = (TokenError 'Unclosed quote')
; + (e.Accum) '\"' e.Text = (#TkCompound e.Accum '\"')
) e.Text>; + (e.Accum) '\\' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (TokenError 'Unclosed quote')
) e.Text>; (e.Accum) = (TokenError 'Unexpected EOF in compound symbol'); - (e.Accum) s.Any e.Text = ; + (e.Accum) s.Any e.Text = ) e.Text>; } -$SPEC StartComment (e.acc) e.text; - StartComment { - (e.Accum) '*' e.Text = ; - (e.Accum) '/' e.Text = ; - (e.Accum) e.Text = (#TkUnexpected e.Accum)
; + (e.Accum) '*' e.Text = ) e.Text>; + (e.Accum) '/' e.Text = ) e.Text>; + (e.Accum) e.Text = (#TkUnexpected e.Accum)
) e.Text>; } -$SPEC Native-Begin (e.acc) e.text; - Native-Begin { - (e.Accum) '%' e.Text = ; - (e.Accum) e.Text = ; + (e.Accum) '%' e.Text = ) e.Text>; + (e.Accum) e.Text = ) e.Text>; } -$SPEC VariableIndex (e.acc) e.text; - VariableIndex { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 's' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '_' e.Text = ; - (e.Accum) '-' e.Text = ; - (e.Accum) e.Text = (TokenError 'Expected variable name')
; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '_' e.Text = ) e.Text>; + (e.Accum) '-' e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Expected variable name')
) e.Text>; } -$SPEC DirectiveTail (e.acc) e.text; - DirectiveTail { - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) e.Text = (#TkDirective e.Accum)
; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) e.Text = (#TkDirective e.Accum)
) e.Text>; } -$SPEC StringLiteral (e.acc) e.text; - StringLiteral { - (e.Accum) '\\' e.Text = ; - (e.Accum) '\'' e.Text = ; - (e.Accum) '\n' e.Text = (TokenError 'Unclosed quote')
; + (e.Accum) '\\' e.Text = ) e.Text>; + (e.Accum) '\'' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (TokenError 'Unclosed quote')
) e.Text>; (e.Accum) = (TokenError 'Unexpected EOF in string literal'); - (e.Accum) s.Any e.Text = (#TkLiteral-Char e.Accum s.Any) ; + (e.Accum) s.Any e.Text = (#TkLiteral-Char e.Accum s.Any) ) e.Text>; } -$SPEC Compound-Escape (e.acc) e.text; - Compound-Escape { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) '\\' e.Text = ; - (e.Accum) '\'' e.Text = ; - (e.Accum) '\"' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) '\n' e.Text = (TokenError 'Unclosed quote')
; - (e.Accum) e.Text = (TokenError 'Unexpected escape sequence') ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) '\\' e.Text = ) e.Text>; + (e.Accum) '\'' e.Text = ) e.Text>; + (e.Accum) '\"' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (TokenError 'Unclosed quote')
) e.Text>; + (e.Accum) e.Text = (TokenError 'Unexpected escape sequence') ) e.Text>; } -$SPEC CComment (e.acc) e.text; - CComment { - (e.Accum) '/' e.Text = ; - (e.Accum) '*' e.Text = ; - (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n') ; - (e.Accum) s.Any e.Text = ; - (e.Accum) e.Text = (TokenError 'Unexpected EOF: unclosed comment')
; + (e.Accum) '/' e.Text = ) e.Text>; + (e.Accum) '*' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n') ) e.Text>; + (e.Accum) s.Any e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Unexpected EOF: unclosed comment')
) e.Text>; } -$SPEC CppComment (e.acc) e.text; - CppComment { - (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n') ; + (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n') ) e.Text>; (e.Accum) = (#TkEOF e.Accum); - (e.Accum) s.Any e.Text = ; + (e.Accum) s.Any e.Text = ) e.Text>; } -$SPEC Native-CheckEnd (e.acc) e.text; - Native-CheckEnd { - (e.Accum) '%' e.Text = ; - (e.Accum) e.Text = ; + (e.Accum) '%' e.Text = ) e.Text>; + (e.Accum) e.Text = ) e.Text>; } -$SPEC Native (e.acc) e.text; - Native { - (e.Accum) '\n' e.Text = (#TkNativeLine e.Accum '\n') ; - (e.Accum) s.Any e.Text = ; - (e.Accum) e.Text = (TokenError 'Unexpected EOF: unclosed native insertion')
; + (e.Accum) '\n' e.Text = (#TkNativeLine e.Accum '\n') ) e.Text>; + (e.Accum) s.Any e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Unexpected EOF: unclosed native insertion')
) e.Text>; } -$SPEC VariableIndexTail (e.acc) e.text; - VariableIndexTail { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 's' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '_' e.Text = ; - (e.Accum) '-' e.Text = ; - (e.Accum) e.Text = (#TkVariable e.Accum)
; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '_' e.Text = ) e.Text>; + (e.Accum) '-' e.Text = ) e.Text>; + (e.Accum) e.Text = (#TkVariable e.Accum)
) e.Text>; } -$SPEC StringLiteral-Escape (e.acc) e.text; - StringLiteral-Escape { - (e.Accum) 'n' e.Text = (#TkLiteral-NewLine e.Accum 'n') ; - (e.Accum) 'r' e.Text = (#TkLiteral-CarriageReturn e.Accum 'r') ; - (e.Accum) 't' e.Text = (#TkLiteral-Tab e.Accum 't') ; - (e.Accum) 'a' e.Text = (#TkLiteral-Bell e.Accum 'a') ; - (e.Accum) 'b' e.Text = (#TkLiteral-BS e.Accum 'b') ; - (e.Accum) 'f' e.Text = (#TkLiteral-FF e.Accum 'f') ; - (e.Accum) 'v' e.Text = (#TkLiteral-VT e.Accum 'v') ; - (e.Accum) '\\' e.Text = (#TkLiteral-Char e.Accum '\\') ; - (e.Accum) '\'' e.Text = (#TkLiteral-Char e.Accum '\'') ; - (e.Accum) '\"' e.Text = (#TkLiteral-Char e.Accum '\"') ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) '\n' e.Text = (TokenError 'Unclosed quote')
; - (e.Accum) e.Text = (TokenError 'Unexpected escape sequence') ; + (e.Accum) 'n' e.Text = (#TkLiteral-NewLine e.Accum 'n') ) e.Text>; + (e.Accum) 'r' e.Text = (#TkLiteral-CarriageReturn e.Accum 'r') ) e.Text>; + (e.Accum) 't' e.Text = (#TkLiteral-Tab e.Accum 't') ) e.Text>; + (e.Accum) 'a' e.Text = (#TkLiteral-Bell e.Accum 'a') ) e.Text>; + (e.Accum) 'b' e.Text = (#TkLiteral-BS e.Accum 'b') ) e.Text>; + (e.Accum) 'f' e.Text = (#TkLiteral-FF e.Accum 'f') ) e.Text>; + (e.Accum) 'v' e.Text = (#TkLiteral-VT e.Accum 'v') ) e.Text>; + (e.Accum) '\\' e.Text = (#TkLiteral-Char e.Accum '\\') ) e.Text>; + (e.Accum) '\'' e.Text = (#TkLiteral-Char e.Accum '\'') ) e.Text>; + (e.Accum) '\"' e.Text = (#TkLiteral-Char e.Accum '\"') ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (TokenError 'Unclosed quote')
) e.Text>; + (e.Accum) e.Text = (TokenError 'Unexpected escape sequence') ) e.Text>; } -$SPEC StringLiteral-Quote (e.acc) e.text; - StringLiteral-Quote { - (e.Accum) '\'' e.Text = (#TkLiteral-Char e.Accum '\'') ; - (e.Accum) e.Text =
; + (e.Accum) '\'' e.Text = (#TkLiteral-Char e.Accum '\'') ) e.Text>; + (e.Accum) e.Text =
) e.Text>; } -$SPEC Compound-Escape-Dec (e.acc) e.text; - Compound-Escape-Dec { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) e.Text = (TokenError 'Expected decimal digit') ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Expected decimal digit') ) e.Text>; } -$SPEC Compound-Escape-Hex (e.acc) e.text; - Compound-Escape-Hex { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) e.Text = (TokenError 'Expected hexadecimal digit') ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Expected hexadecimal digit') ) e.Text>; } -$SPEC CComment-CheckNested (e.acc) e.text; - CComment-CheckNested { - (e.Accum) '*' e.Text = (TokenError 'Nested comments is disabled') ; - (e.Accum) e.Text = ; + (e.Accum) '*' e.Text = (TokenError 'Nested comments is disabled') ) e.Text>; + (e.Accum) e.Text = ) e.Text>; } -$SPEC CComment-CheckEnd (e.acc) e.text; - CComment-CheckEnd { - (e.Accum) '/' e.Text =
; - (e.Accum) e.Text = ; + (e.Accum) '/' e.Text =
) e.Text>; + (e.Accum) e.Text = ) e.Text>; } -$SPEC Native-CheckEnd2 (e.acc) e.text; - Native-CheckEnd2 { - (e.Accum) '\r' e.Text = ; - (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n')
; - (e.Accum) e.Text = ; + (e.Accum) '\r' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (#TkNewLine e.Accum '\n')
) e.Text>; + (e.Accum) e.Text = ) e.Text>; } -$SPEC StringLiteral-Escape-DCode (e.acc) e.text; - StringLiteral-Escape-DCode { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) e.Text = (TokenError 'Expected decimal digit') ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Expected decimal digit') ) e.Text>; } -$SPEC StringLiteral-Escape-OCode (e.acc) e.text; - StringLiteral-Escape-OCode { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) e.Text = (#TkLiteral-OCode e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) e.Text = (#TkLiteral-OCode e.Accum) ) e.Text>; } -$SPEC StringLiteral-Escape-XCode (e.acc) e.text; - StringLiteral-Escape-XCode { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) e.Text = (TokenError 'Expected hexadecimal digit') ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Expected hexadecimal digit') ) e.Text>; } -$SPEC StringLiteral-Escape-DNext (e.acc) e.text; - StringLiteral-Escape-DNext { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) e.Text = (#TkLiteral-Code e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) e.Text = (#TkLiteral-Code e.Accum) ) e.Text>; } -$SPEC StringLiteral-Escape-Xnext (e.acc) e.text; - StringLiteral-Escape-Xnext { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) e.Text = (#TkLiteral-XCode e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) e.Text = (#TkLiteral-XCode e.Accum) ) e.Text>; } + +gen_e__ { e.any = e.any; } diff --git a/src/lexgen/DFA-Lexer.ref b/src/lexgen/DFA-Lexer.ref index 1bfb33bc..76f7221d 100644 --- a/src/lexgen/DFA-Lexer.ref +++ b/src/lexgen/DFA-Lexer.ref @@ -202,438 +202,418 @@ CollectDigits { GEN:END*/ -$SPEC Root (e.acc) e.text; - Root { - (e.Accum) ' ' e.Text = ; - (e.Accum) '\t' e.Text = ; - (e.Accum) '\r' e.Text = ; - (e.Accum) '\n' e.Text = (TNewLine e.Accum '\n') ; - (e.Accum) ':' e.Text = ; - (e.Accum) '!' e.Text = ; - (e.Accum) '\'' e.Text = ; - (e.Accum) '=' e.Text = (TPunctuation e.Accum '=') ; - (e.Accum) '.' e.Text = (TPunctuation e.Accum '.') ; - (e.Accum) '|' e.Text = (TPunctuation e.Accum '|') ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) s.Any e.Text = (TUnexpectedChar e.Accum s.Any) ; + (e.Accum) ' ' e.Text = ) e.Text>; + (e.Accum) '\t' e.Text = ) e.Text>; + (e.Accum) '\r' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (TNewLine e.Accum '\n') ) e.Text>; + (e.Accum) ':' e.Text = ) e.Text>; + (e.Accum) '!' e.Text = ) e.Text>; + (e.Accum) '\'' e.Text = ) e.Text>; + (e.Accum) '=' e.Text = (TPunctuation e.Accum '=') ) e.Text>; + (e.Accum) '.' e.Text = (TPunctuation e.Accum '.') ) e.Text>; + (e.Accum) '|' e.Text = (TPunctuation e.Accum '|') ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) s.Any e.Text = (TUnexpectedChar e.Accum s.Any) ) e.Text>; (e.Accum) = (TEOF e.Accum); } -$SPEC SetName (e.acc) e.text; - SetName { - (e.Accum) ':' e.Text = (TSetName e.Accum ':') ; - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 's' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '-' e.Text = ; - (e.Accum) '_' e.Text = ; + (e.Accum) ':' e.Text = (TSetName e.Accum ':') ) e.Text>; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '-' e.Text = ) e.Text>; + (e.Accum) '_' e.Text = ) e.Text>; (e.Accum) = (TokenError 'expected end of set name, got EOF'); - (e.Accum) e.Text = (TokenError 'expected end of set name') ; + (e.Accum) e.Text = (TokenError 'expected end of set name') ) e.Text>; } -$SPEC Flush (e.acc) e.text; - Flush { - (e.Accum) '-' e.Text = (TFlush e.Accum '-') ; - (e.Accum) '\"' e.Text = ; - (e.Accum) '#' e.Text = ; - (e.Accum) e.Text = ; + (e.Accum) '-' e.Text = (TFlush e.Accum '-') ) e.Text>; + (e.Accum) '\"' e.Text = ) e.Text>; + (e.Accum) '#' e.Text = ) e.Text>; + (e.Accum) e.Text = ) e.Text>; } -$SPEC Literal (e.acc) e.text; - Literal { - (e.Accum) '\\' e.Text = ; - (e.Accum) '\'' e.Text = ; - (e.Accum) '\n' e.Text = (TokenError 'Unexpected end of line at literal') ; + (e.Accum) '\\' e.Text = ) e.Text>; + (e.Accum) '\'' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (TokenError 'Unexpected end of line at literal') ) e.Text>; (e.Accum) = (TokenError 'Unexpected end of file at literal'); - (e.Accum) s.Any e.Text = ; + (e.Accum) s.Any e.Text = ) e.Text>; } -$SPEC Name (e.acc) e.text; - Name { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 's' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '-' e.Text = ; - (e.Accum) '_' e.Text = ; - (e.Accum) e.Text = (TName e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '-' e.Text = ) e.Text>; + (e.Accum) '_' e.Text = ) e.Text>; + (e.Accum) e.Text = (TName e.Accum) ) e.Text>; } -$SPEC ErrorFlush (e.acc) e.text; - ErrorFlush { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 's' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '-' e.Text = ; - (e.Accum) '_' e.Text = ; - (e.Accum) ' ' e.Text = ; - (e.Accum) '\t' e.Text = ; - (e.Accum) ',' e.Text = ; - (e.Accum) '.' e.Text = ; - (e.Accum) ':' e.Text = ; - (e.Accum) ';' e.Text = ; - (e.Accum) '(' e.Text = ; - (e.Accum) ')' e.Text = ; - (e.Accum) '{' e.Text = ; - (e.Accum) '}' e.Text = ; - (e.Accum) '[' e.Text = ; - (e.Accum) ']' e.Text = ; - (e.Accum) '*' e.Text = ; - (e.Accum) '&' e.Text = ; - (e.Accum) '!' e.Text = ; - (e.Accum) '@' e.Text = ; - (e.Accum) '#' e.Text = ; - (e.Accum) '$' e.Text = ; - (e.Accum) '%' e.Text = ; - (e.Accum) '^' e.Text = ; - (e.Accum) '=' e.Text = ; - (e.Accum) '/' e.Text = ; - (e.Accum) '\"' e.Text = (TErrorFlush e.Accum '\"') ; - (e.Accum) e.Text = (TokenError 'Expected error text or double quote') ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '-' e.Text = ) e.Text>; + (e.Accum) '_' e.Text = ) e.Text>; + (e.Accum) ' ' e.Text = ) e.Text>; + (e.Accum) '\t' e.Text = ) e.Text>; + (e.Accum) ',' e.Text = ) e.Text>; + (e.Accum) '.' e.Text = ) e.Text>; + (e.Accum) ':' e.Text = ) e.Text>; + (e.Accum) ';' e.Text = ) e.Text>; + (e.Accum) '(' e.Text = ) e.Text>; + (e.Accum) ')' e.Text = ) e.Text>; + (e.Accum) '{' e.Text = ) e.Text>; + (e.Accum) '}' e.Text = ) e.Text>; + (e.Accum) '[' e.Text = ) e.Text>; + (e.Accum) ']' e.Text = ) e.Text>; + (e.Accum) '*' e.Text = ) e.Text>; + (e.Accum) '&' e.Text = ) e.Text>; + (e.Accum) '!' e.Text = ) e.Text>; + (e.Accum) '@' e.Text = ) e.Text>; + (e.Accum) '#' e.Text = ) e.Text>; + (e.Accum) '$' e.Text = ) e.Text>; + (e.Accum) '%' e.Text = ) e.Text>; + (e.Accum) '^' e.Text = ) e.Text>; + (e.Accum) '=' e.Text = ) e.Text>; + (e.Accum) '/' e.Text = ) e.Text>; + (e.Accum) '\"' e.Text = (TErrorFlush e.Accum '\"') ) e.Text>; + (e.Accum) e.Text = (TokenError 'Expected error text or double quote') ) e.Text>; } -$SPEC FlushName (e.acc) e.text; - FlushName { - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) e.Text = (TokenError 'Expected flush name') ; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Expected flush name') ) e.Text>; } -$SPEC Literal-Escape (e.acc) e.text; - Literal-Escape { - (e.Accum) 'n' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) '\\' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) '\'' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) e.Text = (TokenError 'Unexpected escaped character') ; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) '\\' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) '\'' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) e.Text = (TokenError 'Unexpected escaped character') ) e.Text>; } -$SPEC Literal-Quote (e.acc) e.text; - Literal-Quote { - (e.Accum) '\'' e.Text = ; - (e.Accum) e.Text = (TLiteral e.Accum) ; + (e.Accum) '\'' e.Text = ) e.Text>; + (e.Accum) e.Text = (TLiteral e.Accum) ) e.Text>; } -$SPEC FlushNameTail (e.acc) e.text; - FlushNameTail { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 's' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '-' e.Text = ; - (e.Accum) '_' e.Text = ; - (e.Accum) e.Text = (TNamedFlush e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '-' e.Text = ) e.Text>; + (e.Accum) '_' e.Text = ) e.Text>; + (e.Accum) e.Text = (TNamedFlush e.Accum) ) e.Text>; } -$SPEC Literal-DecCode (e.acc) e.text; - Literal-DecCode { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; (e.Accum) = (TokenError 'Unexpected end of file'); - (e.Accum) e.Text = (TokenError 'Expected digits') ; + (e.Accum) e.Text = (TokenError 'Expected digits') ) e.Text>; } + +gen_e__ { e.any = e.any; } diff --git a/src/lexgen/Flex-Lexer.ref b/src/lexgen/Flex-Lexer.ref index 2bd20abc..aa980bde 100644 --- a/src/lexgen/Flex-Lexer.ref +++ b/src/lexgen/Flex-Lexer.ref @@ -266,458 +266,424 @@ DigitFromChar { GEN:END*/ -$SPEC Root (e.acc) e.text; - Root { - (e.Accum) ' ' e.Text = ; - (e.Accum) '\t' e.Text = ; - (e.Accum) '\r' e.Text = ; - (e.Accum) '\n' e.Text = (TNewLine e.Accum '\n') ; - (e.Accum) '/' e.Text = (TStartRegexp e.Accum '/') ; - (e.Accum) '-' e.Text = ; - (e.Accum) '=' e.Text = (TEquals e.Accum '=') ; - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '<' e.Text = (TStateStart e.Accum '<') ; - (e.Accum) ',' e.Text = (TComma e.Accum ',') ; - (e.Accum) '>' e.Text = (TStateEnd e.Accum '>') ; - (e.Accum) '\"' e.Text = ; - (e.Accum) s.Any e.Text = (TUnexpecteChar e.Accum s.Any) ; + (e.Accum) ' ' e.Text = ) e.Text>; + (e.Accum) '\t' e.Text = ) e.Text>; + (e.Accum) '\r' e.Text = ) e.Text>; + (e.Accum) '\n' e.Text = (TNewLine e.Accum '\n') ) e.Text>; + (e.Accum) '/' e.Text = (TStartRegexp e.Accum '/') ) e.Text>; + (e.Accum) '-' e.Text = ) e.Text>; + (e.Accum) '=' e.Text = (TEquals e.Accum '=') ) e.Text>; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '<' e.Text = (TStateStart e.Accum '<') ) e.Text>; + (e.Accum) ',' e.Text = (TComma e.Accum ',') ) e.Text>; + (e.Accum) '>' e.Text = (TStateEnd e.Accum '>') ) e.Text>; + (e.Accum) '\"' e.Text = ) e.Text>; + (e.Accum) s.Any e.Text = (TUnexpecteChar e.Accum s.Any) ) e.Text>; (e.Accum) = (TEOF e.Accum); } -$SPEC ReadRegexp (e.acc) e.text; - ReadRegexp { - (e.Accum) '/' e.Text = (TEndRegexp e.Accum '/') ; - (e.Accum) '\n' e.Text = (TNewLine e.Accum '\n') ; - (e.Accum) '\\' e.Text = ; - (e.Accum) '[' e.Text = (TStartGroup e.Accum '[') ; - (e.Accum) '?' e.Text = (TQuantifier e.Accum '?') ; - (e.Accum) '*' e.Text = (TQuantifier e.Accum '*') ; - (e.Accum) '+' e.Text = (TQuantifier e.Accum '+') ; - (e.Accum) '.' e.Text = (TSpecChar e.Accum '.') ; - (e.Accum) '(' e.Text = (TSpecChar e.Accum '(') ; - (e.Accum) ')' e.Text = (TSpecChar e.Accum ')') ; - (e.Accum) '|' e.Text = (TSpecChar e.Accum '|') ; - (e.Accum) '^' e.Text = (TSpecChar e.Accum '^') ; - (e.Accum) '$' e.Text = (TSpecChar e.Accum '$') ; - (e.Accum) '{' e.Text = ; - (e.Accum) s.Any e.Text = (TChar e.Accum s.Any) ; + (e.Accum) '/' e.Text = (TEndRegexp e.Accum '/') ) e.Text>; + (e.Accum) '\n' e.Text = (TNewLine e.Accum '\n') ) e.Text>; + (e.Accum) '\\' e.Text = ) e.Text>; + (e.Accum) '[' e.Text = (TStartGroup e.Accum '[') ) e.Text>; + (e.Accum) '?' e.Text = (TQuantifier e.Accum '?') ) e.Text>; + (e.Accum) '*' e.Text = (TQuantifier e.Accum '*') ) e.Text>; + (e.Accum) '+' e.Text = (TQuantifier e.Accum '+') ) e.Text>; + (e.Accum) '.' e.Text = (TSpecChar e.Accum '.') ) e.Text>; + (e.Accum) '(' e.Text = (TSpecChar e.Accum '(') ) e.Text>; + (e.Accum) ')' e.Text = (TSpecChar e.Accum ')') ) e.Text>; + (e.Accum) '|' e.Text = (TSpecChar e.Accum '|') ) e.Text>; + (e.Accum) '^' e.Text = (TSpecChar e.Accum '^') ) e.Text>; + (e.Accum) '$' e.Text = (TSpecChar e.Accum '$') ) e.Text>; + (e.Accum) '{' e.Text = ) e.Text>; + (e.Accum) s.Any e.Text = (TChar e.Accum s.Any) ) e.Text>; (e.Accum) = (TokenError 'Unexpected EOF in Regexp'); } -$SPEC ReadArrow (e.acc) e.text; - ReadArrow { - (e.Accum) '>' e.Text = (TArrow e.Accum '>') ; - (e.Accum) e.Text = (TSkip e.Accum) ; + (e.Accum) '>' e.Text = (TArrow e.Accum '>') ) e.Text>; + (e.Accum) e.Text = (TSkip e.Accum) ) e.Text>; } -$SPEC Number (e.acc) e.text; - Number { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) e.Text = (TkNumber e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) e.Text = (TkNumber e.Accum) ) e.Text>; } -$SPEC Name (e.acc) e.text; - Name { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 's' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) e.Text = (TName e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) e.Text = (TName e.Accum) ) e.Text>; } -$SPEC ErrorMessage (e.acc) e.text; - ErrorMessage { - (e.Accum) '\"' e.Text = (TErrorMessage e.Accum '\"') ; - (e.Accum) s.Any e.Text = ; + (e.Accum) '\"' e.Text = (TErrorMessage e.Accum '\"') ) e.Text>; + (e.Accum) s.Any e.Text = ) e.Text>; (e.Accum) = (TokenError 'Unclosed error message'); } -$SPEC EscRegexp (e.acc) e.text; - EscRegexp { - (e.Accum) '\\' e.Text = (TGenericEscChar e.Accum '\\') ; - (e.Accum) 'n' e.Text = (TGenericEscChar e.Accum 'n') ; - (e.Accum) 't' e.Text = (TGenericEscChar e.Accum 't') ; - (e.Accum) 'r' e.Text = (TGenericEscChar e.Accum 'r') ; - (e.Accum) '/' e.Text = (TChar e.Accum '/') ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '.' e.Text = (TChar e.Accum '.') ; - (e.Accum) '(' e.Text = (TChar e.Accum '(') ; - (e.Accum) ')' e.Text = (TChar e.Accum ')') ; - (e.Accum) '|' e.Text = (TChar e.Accum '|') ; - (e.Accum) '^' e.Text = (TChar e.Accum '^') ; - (e.Accum) '$' e.Text = (TChar e.Accum '$') ; - (e.Accum) s.Any e.Text = (TokenError 'Bad escaped symbol') ; + (e.Accum) '\\' e.Text = (TGenericEscChar e.Accum '\\') ) e.Text>; + (e.Accum) 'n' e.Text = (TGenericEscChar e.Accum 'n') ) e.Text>; + (e.Accum) 't' e.Text = (TGenericEscChar e.Accum 't') ) e.Text>; + (e.Accum) 'r' e.Text = (TGenericEscChar e.Accum 'r') ) e.Text>; + (e.Accum) '/' e.Text = (TChar e.Accum '/') ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '.' e.Text = (TChar e.Accum '.') ) e.Text>; + (e.Accum) '(' e.Text = (TChar e.Accum '(') ) e.Text>; + (e.Accum) ')' e.Text = (TChar e.Accum ')') ) e.Text>; + (e.Accum) '|' e.Text = (TChar e.Accum '|') ) e.Text>; + (e.Accum) '^' e.Text = (TChar e.Accum '^') ) e.Text>; + (e.Accum) '$' e.Text = (TChar e.Accum '$') ) e.Text>; + (e.Accum) s.Any e.Text = (TokenError 'Bad escaped symbol') ) e.Text>; (e.Accum) = (TokenError 'Unexpected EOF in Regexp'); } -$SPEC StartGroup (e.acc) e.text; - StartGroup { - (e.Accum) '^' e.Text = (TInvertGroup e.Accum '^') ; - (e.Accum) e.Text = ; + (e.Accum) '^' e.Text = (TInvertGroup e.Accum '^') ) e.Text>; + (e.Accum) e.Text = ) e.Text>; } -$SPEC ReadInclude (e.acc) e.text; - ReadInclude { - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) s.Any e.Text = (TokenError 'Expected Name in Include') ; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) s.Any e.Text = (TokenError 'Expected Name in Include') ) e.Text>; (e.Accum) = (TokenError 'Unexpected EOF in Include'); } -$SPEC EscRegexp-XCode (e.acc) e.text; - EscRegexp-XCode { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) e.Text = (TkHexNumber e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) e.Text = (TkHexNumber e.Accum) ) e.Text>; } -$SPEC EscRegexp-OCode (e.acc) e.text; - EscRegexp-OCode { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) e.Text = (TkOctNumber e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) e.Text = (TkOctNumber e.Accum) ) e.Text>; } -$SPEC ReadGroup (e.acc) e.text; - ReadGroup { - (e.Accum) ']' e.Text = (TEndGroup e.Accum ']') ; - (e.Accum) '-' e.Text = (TGroupRange e.Accum '-') ; - (e.Accum) '\\' e.Text = ; - (e.Accum) s.Any e.Text = (TChar e.Accum s.Any) ; + (e.Accum) ']' e.Text = (TEndGroup e.Accum ']') ) e.Text>; + (e.Accum) '-' e.Text = (TGroupRange e.Accum '-') ) e.Text>; + (e.Accum) '\\' e.Text = ) e.Text>; + (e.Accum) s.Any e.Text = (TChar e.Accum s.Any) ) e.Text>; (e.Accum) = (TokenError 'Unexpected EOF in Regexp'); } -$SPEC ReadBody (e.acc) e.text; - ReadBody { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) 'g' e.Text = ; - (e.Accum) 'h' e.Text = ; - (e.Accum) 'i' e.Text = ; - (e.Accum) 'j' e.Text = ; - (e.Accum) 'k' e.Text = ; - (e.Accum) 'l' e.Text = ; - (e.Accum) 'm' e.Text = ; - (e.Accum) 'n' e.Text = ; - (e.Accum) 'o' e.Text = ; - (e.Accum) 'p' e.Text = ; - (e.Accum) 'q' e.Text = ; - (e.Accum) 'r' e.Text = ; - (e.Accum) 's' e.Text = ; - (e.Accum) 't' e.Text = ; - (e.Accum) 'u' e.Text = ; - (e.Accum) 'v' e.Text = ; - (e.Accum) 'w' e.Text = ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'y' e.Text = ; - (e.Accum) 'z' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'G' e.Text = ; - (e.Accum) 'H' e.Text = ; - (e.Accum) 'I' e.Text = ; - (e.Accum) 'J' e.Text = ; - (e.Accum) 'K' e.Text = ; - (e.Accum) 'L' e.Text = ; - (e.Accum) 'M' e.Text = ; - (e.Accum) 'N' e.Text = ; - (e.Accum) 'O' e.Text = ; - (e.Accum) 'P' e.Text = ; - (e.Accum) 'Q' e.Text = ; - (e.Accum) 'R' e.Text = ; - (e.Accum) 'S' e.Text = ; - (e.Accum) 'T' e.Text = ; - (e.Accum) 'U' e.Text = ; - (e.Accum) 'V' e.Text = ; - (e.Accum) 'W' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) 'Y' e.Text = ; - (e.Accum) 'Z' e.Text = ; - (e.Accum) '}' e.Text = (TInclude e.Accum '}') ; - (e.Accum) e.Text = (TokenError 'Unclused include') ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) 'g' e.Text = ) e.Text>; + (e.Accum) 'h' e.Text = ) e.Text>; + (e.Accum) 'i' e.Text = ) e.Text>; + (e.Accum) 'j' e.Text = ) e.Text>; + (e.Accum) 'k' e.Text = ) e.Text>; + (e.Accum) 'l' e.Text = ) e.Text>; + (e.Accum) 'm' e.Text = ) e.Text>; + (e.Accum) 'n' e.Text = ) e.Text>; + (e.Accum) 'o' e.Text = ) e.Text>; + (e.Accum) 'p' e.Text = ) e.Text>; + (e.Accum) 'q' e.Text = ) e.Text>; + (e.Accum) 'r' e.Text = ) e.Text>; + (e.Accum) 's' e.Text = ) e.Text>; + (e.Accum) 't' e.Text = ) e.Text>; + (e.Accum) 'u' e.Text = ) e.Text>; + (e.Accum) 'v' e.Text = ) e.Text>; + (e.Accum) 'w' e.Text = ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'y' e.Text = ) e.Text>; + (e.Accum) 'z' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'G' e.Text = ) e.Text>; + (e.Accum) 'H' e.Text = ) e.Text>; + (e.Accum) 'I' e.Text = ) e.Text>; + (e.Accum) 'J' e.Text = ) e.Text>; + (e.Accum) 'K' e.Text = ) e.Text>; + (e.Accum) 'L' e.Text = ) e.Text>; + (e.Accum) 'M' e.Text = ) e.Text>; + (e.Accum) 'N' e.Text = ) e.Text>; + (e.Accum) 'O' e.Text = ) e.Text>; + (e.Accum) 'P' e.Text = ) e.Text>; + (e.Accum) 'Q' e.Text = ) e.Text>; + (e.Accum) 'R' e.Text = ) e.Text>; + (e.Accum) 'S' e.Text = ) e.Text>; + (e.Accum) 'T' e.Text = ) e.Text>; + (e.Accum) 'U' e.Text = ) e.Text>; + (e.Accum) 'V' e.Text = ) e.Text>; + (e.Accum) 'W' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) 'Y' e.Text = ) e.Text>; + (e.Accum) 'Z' e.Text = ) e.Text>; + (e.Accum) '}' e.Text = (TInclude e.Accum '}') ) e.Text>; + (e.Accum) e.Text = (TokenError 'Unclused include') ) e.Text>; } -$SPEC EscRegexp-OCode-C1 (e.acc) e.text; - EscRegexp-OCode-C1 { - (e.Accum) '0' e.Text = (TkOctNumber e.Accum '0') ; - (e.Accum) '1' e.Text = (TkOctNumber e.Accum '1') ; - (e.Accum) '2' e.Text = (TkOctNumber e.Accum '2') ; - (e.Accum) '3' e.Text = (TkOctNumber e.Accum '3') ; - (e.Accum) '4' e.Text = (TkOctNumber e.Accum '4') ; - (e.Accum) '5' e.Text = (TkOctNumber e.Accum '5') ; - (e.Accum) '6' e.Text = (TkOctNumber e.Accum '6') ; - (e.Accum) '7' e.Text = (TkOctNumber e.Accum '7') ; - (e.Accum) e.Text = (TkOctNumber e.Accum) ; + (e.Accum) '0' e.Text = (TkOctNumber e.Accum '0') ) e.Text>; + (e.Accum) '1' e.Text = (TkOctNumber e.Accum '1') ) e.Text>; + (e.Accum) '2' e.Text = (TkOctNumber e.Accum '2') ) e.Text>; + (e.Accum) '3' e.Text = (TkOctNumber e.Accum '3') ) e.Text>; + (e.Accum) '4' e.Text = (TkOctNumber e.Accum '4') ) e.Text>; + (e.Accum) '5' e.Text = (TkOctNumber e.Accum '5') ) e.Text>; + (e.Accum) '6' e.Text = (TkOctNumber e.Accum '6') ) e.Text>; + (e.Accum) '7' e.Text = (TkOctNumber e.Accum '7') ) e.Text>; + (e.Accum) e.Text = (TkOctNumber e.Accum) ) e.Text>; } -$SPEC EscGroup (e.acc) e.text; - EscGroup { - (e.Accum) '\\' e.Text = (TGenericEscChar e.Accum '\\') ; - (e.Accum) 'n' e.Text = (TGenericEscChar e.Accum 'n') ; - (e.Accum) 't' e.Text = (TGenericEscChar e.Accum 't') ; - (e.Accum) 'r' e.Text = (TGenericEscChar e.Accum 'r') ; - (e.Accum) ']' e.Text = (TChar e.Accum ']') ; - (e.Accum) '-' e.Text = (TChar e.Accum '-') ; - (e.Accum) 'x' e.Text = ; - (e.Accum) 'X' e.Text = ; - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) s.Any e.Text = (TokenError 'Bad escaped symbol') ; + (e.Accum) '\\' e.Text = (TGenericEscChar e.Accum '\\') ) e.Text>; + (e.Accum) 'n' e.Text = (TGenericEscChar e.Accum 'n') ) e.Text>; + (e.Accum) 't' e.Text = (TGenericEscChar e.Accum 't') ) e.Text>; + (e.Accum) 'r' e.Text = (TGenericEscChar e.Accum 'r') ) e.Text>; + (e.Accum) ']' e.Text = (TChar e.Accum ']') ) e.Text>; + (e.Accum) '-' e.Text = (TChar e.Accum '-') ) e.Text>; + (e.Accum) 'x' e.Text = ) e.Text>; + (e.Accum) 'X' e.Text = ) e.Text>; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) s.Any e.Text = (TokenError 'Bad escaped symbol') ) e.Text>; (e.Accum) = (TokenError 'Unexpected EOF in Regexp'); } -$SPEC EscGroup-XCode (e.acc) e.text; - EscGroup-XCode { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) '8' e.Text = ; - (e.Accum) '9' e.Text = ; - (e.Accum) 'A' e.Text = ; - (e.Accum) 'B' e.Text = ; - (e.Accum) 'C' e.Text = ; - (e.Accum) 'D' e.Text = ; - (e.Accum) 'E' e.Text = ; - (e.Accum) 'F' e.Text = ; - (e.Accum) 'a' e.Text = ; - (e.Accum) 'b' e.Text = ; - (e.Accum) 'c' e.Text = ; - (e.Accum) 'd' e.Text = ; - (e.Accum) 'e' e.Text = ; - (e.Accum) 'f' e.Text = ; - (e.Accum) e.Text = (TkHexNumber e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) '8' e.Text = ) e.Text>; + (e.Accum) '9' e.Text = ) e.Text>; + (e.Accum) 'A' e.Text = ) e.Text>; + (e.Accum) 'B' e.Text = ) e.Text>; + (e.Accum) 'C' e.Text = ) e.Text>; + (e.Accum) 'D' e.Text = ) e.Text>; + (e.Accum) 'E' e.Text = ) e.Text>; + (e.Accum) 'F' e.Text = ) e.Text>; + (e.Accum) 'a' e.Text = ) e.Text>; + (e.Accum) 'b' e.Text = ) e.Text>; + (e.Accum) 'c' e.Text = ) e.Text>; + (e.Accum) 'd' e.Text = ) e.Text>; + (e.Accum) 'e' e.Text = ) e.Text>; + (e.Accum) 'f' e.Text = ) e.Text>; + (e.Accum) e.Text = (TkHexNumber e.Accum) ) e.Text>; } -$SPEC EscGroup-OCode (e.acc) e.text; - EscGroup-OCode { - (e.Accum) '0' e.Text = ; - (e.Accum) '1' e.Text = ; - (e.Accum) '2' e.Text = ; - (e.Accum) '3' e.Text = ; - (e.Accum) '4' e.Text = ; - (e.Accum) '5' e.Text = ; - (e.Accum) '6' e.Text = ; - (e.Accum) '7' e.Text = ; - (e.Accum) e.Text = (TkOctNumber e.Accum) ; + (e.Accum) '0' e.Text = ) e.Text>; + (e.Accum) '1' e.Text = ) e.Text>; + (e.Accum) '2' e.Text = ) e.Text>; + (e.Accum) '3' e.Text = ) e.Text>; + (e.Accum) '4' e.Text = ) e.Text>; + (e.Accum) '5' e.Text = ) e.Text>; + (e.Accum) '6' e.Text = ) e.Text>; + (e.Accum) '7' e.Text = ) e.Text>; + (e.Accum) e.Text = (TkOctNumber e.Accum) ) e.Text>; } -$SPEC EscGroup-OCode-C1 (e.acc) e.text; - EscGroup-OCode-C1 { - (e.Accum) '0' e.Text = (TkOctNumber e.Accum '0') ; - (e.Accum) '1' e.Text = (TkOctNumber e.Accum '1') ; - (e.Accum) '2' e.Text = (TkOctNumber e.Accum '2') ; - (e.Accum) '3' e.Text = (TkOctNumber e.Accum '3') ; - (e.Accum) '4' e.Text = (TkOctNumber e.Accum '4') ; - (e.Accum) '5' e.Text = (TkOctNumber e.Accum '5') ; - (e.Accum) '6' e.Text = (TkOctNumber e.Accum '6') ; - (e.Accum) '7' e.Text = (TkOctNumber e.Accum '7') ; - (e.Accum) e.Text = (TkOctNumber e.Accum) ; + (e.Accum) '0' e.Text = (TkOctNumber e.Accum '0') ) e.Text>; + (e.Accum) '1' e.Text = (TkOctNumber e.Accum '1') ) e.Text>; + (e.Accum) '2' e.Text = (TkOctNumber e.Accum '2') ) e.Text>; + (e.Accum) '3' e.Text = (TkOctNumber e.Accum '3') ) e.Text>; + (e.Accum) '4' e.Text = (TkOctNumber e.Accum '4') ) e.Text>; + (e.Accum) '5' e.Text = (TkOctNumber e.Accum '5') ) e.Text>; + (e.Accum) '6' e.Text = (TkOctNumber e.Accum '6') ) e.Text>; + (e.Accum) '7' e.Text = (TkOctNumber e.Accum '7') ) e.Text>; + (e.Accum) e.Text = (TkOctNumber e.Accum) ) e.Text>; } + +gen_e__ { e.any = e.any; } diff --git a/src/lexgen/Generator.ref b/src/lexgen/Generator.ref index 3eaed79e..87898a64 100644 --- a/src/lexgen/Generator.ref +++ b/src/lexgen/Generator.ref @@ -17,13 +17,13 @@ $EXTERN EscapeChar; */ $ENTRY GenerateFromDFA { e.Rules = - ; + + () + ('gen_e__ { e.any = e.any; }') } WriteFunction { ((e.NextRule) e.Alternatives) = - () - ('$SPEC ' e.NextRule ' (e.acc) e.text;') () (e.NextRule ' {') @@ -74,5 +74,5 @@ NextState-L { NextState-R { Finitive e.NextStateAccum = /* пусто */; (e.NextStateName) e.NextStateAccum = - ' <' e.NextStateName ' (' e.NextStateAccum ') e.Text>'; + ' <' e.NextStateName ' () e.Text>'; } From 387d332fbb4220fe592c48b373e93b0e6ff8e7b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 24 Jul 2021 12:34:52 +0300 Subject: [PATCH 048/208] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BD=D1=83=D0=B4?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=C2=A0=D0=BA?= =?UTF-8?q?=D1=83=D1=87=D0=B5=20=D0=BC=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B1=D0=BE=D1=80=D1=8C=D0=B1=D1=8B=20=D1=81=C2=A0?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D0=BF=D1=83=D1=85=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=D0=BC=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit По-нормальному, нужно каждый случай обобщения описать, сделать выводы и решить проблему в общем случае в рамках #332. А пока я анализировал лог и подсекал наиболее явные точки распухания. --- src/compiler/Checker-Screening.ref | 8 +- src/compiler/Engine.ref | 7 ++ src/compiler/GenericMatch.ref | 149 ++++++++++++++++++----------- src/compiler/R5-Lexer.ref | 4 + 4 files changed, 109 insertions(+), 59 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index c6a13e1e..84d3f075 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -220,7 +220,7 @@ CheckBlocks { ) + (>) (e.ContextVars) (e.Sentences) >; @@ -232,6 +232,8 @@ CheckBlocks { >; } +gen_e__ { e.Arg = e.Arg } + /* : e.Prefix^ + = > : e.Prefix^ = ( e.ContextVars e.Pattern) ) + (>) (e.ContextVars) (e.Sentences) >; diff --git a/src/compiler/Engine.ref b/src/compiler/Engine.ref index b5421631..8b1045a1 100644 --- a/src/compiler/Engine.ref +++ b/src/compiler/Engine.ref @@ -202,6 +202,13 @@ LoadAST { } ResolveIncludes { + t.Config (e.BadIncludes) e.Units + = ) > +} + +gen_e__ { e.Arg = e.Arg } + +ResolveIncludes-Gen { t.Config (e.BadIncludes-B (e.IncludeName) e.BadIncludes-E) e.Units-B ( diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 0de7265b..dddd3f1b 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -4,6 +4,9 @@ $INCLUDE "LibraryEx"; $EXTERN ExtractVariables, NewVarName; +gen_e__ { e.arg = e.arg } + + /** == Clear (e.Val ':' t.Var)* @@ -61,7 +64,7 @@ $ENTRY Solve-Drive { (e.UsedVars) (None e.Contrs) ((e.Expr) ':' (e.Lexpr)) - (/* пусто */) + () > : { e._ (Generalize (e.Intervals)) e._ = Undefined; @@ -144,7 +147,7 @@ Solve-Spec-DoFindGeneralization { e._ (Generalize (e.Intervals)) e._ = - (e.L) (e.GenAssigns) + () () > : (e.UsedVars^) (e.L^) (e.GenAssigns^) = ) (e.Expr) (e.Assigns) > : (e.UsedVars^) (e.Expr^) (e.Assigns^) = ; @@ -512,7 +515,7 @@ Solve-Clashes { (e.UsedVars) (e.Contrs) e.ClashesStart e.ClashesEnd - (e.Assigns (('{'s.M'}') t.T ('{'s.N'}') ':' (Var 't' e.Index))) + () >; /* {m} Sym {n} : s.X ↦ {m} Sym {n} ← s.X */ @@ -524,7 +527,11 @@ Solve-Clashes { (e.UsedVars) (e.Contrs) e.ClashesStart e.ClashesEnd - (e.Assigns (('{'s.M'}') t.Sym ('{'s.N'}') ':' (Var 's' e.Index))) + ( + + ) >; /* {m} (E) {n} : (P) ↦ {m} E {n} : P */ @@ -710,7 +717,7 @@ Solve-Clashes { = ) >; /* {m} e.X E {n} : ε ↦ e.X → ε */ @@ -760,10 +767,14 @@ Solve-Clashes { , : True = : (e.Left1) (e.Left2) = + (e.Assigns) >; /* E {m} T {n} : P Pt ↦ E {m} : P && {m} T {n} : Pt */ @@ -775,10 +786,14 @@ Solve-Clashes { , : True = : (e.Left1) (e.Left2) = + (e.Assigns) >; /* {m} e.X E {n} : Pt P ↦ e.X → t.NEW1 e.NEW2 || e.X → ε */ @@ -790,16 +805,24 @@ Solve-Clashes { = : t.NewVars2 'e' e.New2 = + (e.Assigns) > : e.Branch1 = + (e.Assigns) > : e.Branch2 = @@ -814,16 +837,24 @@ Solve-Clashes { = : t.NewVars2 't' e.New2 = + (e.Assigns) > : e.Branch1 = + (e.Assigns) > : e.Branch2 = @@ -855,7 +886,7 @@ Solve-Clashes { = ) > } e.Parts @@ -967,9 +998,9 @@ SplitLeftPart-Aux { , : True , : True = ) (t.T2 e.Rest) - (e.Parts (e.Begin t.T1 ('sp') t.T2 e.Rest)) + () >; /* Точки разбиения добавляются между двумя смежными термами */ @@ -977,9 +1008,9 @@ SplitLeftPart-Aux { , : True , : True = ) (t.T2 e.Rest) - (e.Parts (e.Begin t.T1 ('sp' ('{'s.Coord'}')) t.T2 e.Rest)) + () >; /* Если E заканчивается на терм, то точка разбиения добавляется в конец */ @@ -990,7 +1021,7 @@ SplitLeftPart-Aux { (e.Begin) (t.T e.Rest) (e.Parts) , : True = ) (e.Rest) (e.Parts) >; @@ -999,14 +1030,14 @@ SplitLeftPart-Aux { (e.Begin) (t.eX e.Rest) (e.Parts) , t.eX : (Var 'e' e.XIndex) = ) (e.Rest) - (e.Parts (e.Begin ('sp' t.eX) e.Rest)) + () >; (e.Begin) (('{'s.Coord'}') e.Rest) (e.Parts) = ) (e.Rest) (e.Parts) >; @@ -1035,8 +1066,8 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = + () >; * {k} E1 T2 {m} T3 E4 {n} : e.X P e.Y ↦ {k} E1 T2 {m} ← e.X, @@ -1057,8 +1088,10 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = + () >; * E1 {m} E2* T3 . T4 E5* {n} E6 : e.X P e.Y ↦ E1 {m} E2* T3 {n} ← e.X, @@ -1081,9 +1114,10 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = + () >; * {m} E {n} : e.X P e.Y ↦ {m} E {n} ← e.X, ε : P e.Y @@ -1098,8 +1132,8 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = + () >; * ε : e.X P e.Y ↦ ε ← e.X, ε : P e.Y @@ -1111,8 +1145,8 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = + () >; * E1 e.X {m} e.Y E2 : e.L P e.R ↦ e.X → e.NEW1! t.NEW2 e.NEW3, @@ -1139,8 +1173,11 @@ SplitSolve { + () > >; @@ -1168,8 +1205,8 @@ SplitSolve { + () > >; } @@ -1387,8 +1424,7 @@ Solve-SymmClashes { (e.UsedVars) (e.Contrs) e.SymmClashes (e.Assigns) = : e.SymmClashes^ = ) e.SymmClashes (e.Assigns) >; } @@ -2155,6 +2191,7 @@ AddContractions-Spec-Symm { == PRTC */ +$DRIVE AddContraction-Spec, AddContraction-Spec-Symm; AddContraction-Spec { t.toAdd (s.OpenFlag e.Contrs) e.Clashes (e.Assigns) @@ -2171,9 +2208,9 @@ AddContraction-Spec { = + > ) - + > () >; } @@ -2193,9 +2230,9 @@ AddContraction-Spec-Symm { = + > ) - + > () >; } diff --git a/src/compiler/R5-Lexer.ref b/src/compiler/R5-Lexer.ref index 09a85c75..823e09fb 100644 --- a/src/compiler/R5-Lexer.ref +++ b/src/compiler/R5-Lexer.ref @@ -293,6 +293,8 @@ DoScan-BuildKeyword { (e.Line) e.Lines>; } +$INLINE EasterEgg; + EasterEgg { t.Pos s.Char e.Text = (TkChar t.Pos s.Char) ; @@ -478,6 +480,8 @@ HexDigit { }; } +$INLINE DoHexDigit; + DoHexDigit { s.Digit e.Samples s.Val s.Digit = s.Val; From 3c3d7f707c7bde3604a02ba7acfa2b6ca33e4641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 25 Jul 2021 23:59:18 +0300 Subject: [PATCH 049/208] $INLINE ReportErrors, ReportWarnings, ReportMessages; (#359) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ReportWarnings полностью встраивается, число экземпляров ReportErrors существенно уменьшилось. Оставшиеся случаи — предложения с условиями и не-L-образцами. И это тоже странно, т.к. там она должна встроиться. --- src/compiler/main.ref | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/main.ref b/src/compiler/main.ref index aa0815de..75f70e8b 100644 --- a/src/compiler/main.ref +++ b/src/compiler/main.ref @@ -72,6 +72,8 @@ Main-SwValidCommandLine { = ; } +$INLINE ReportErrors, ReportWarnings, ReportMessages; + ReportErrors { t.CommandLineSource t.Config e.Errors = ; From 13fc222d073128f65ecfbde78b41a5ae231a6b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 30 Jul 2021 16:56:52 +0300 Subject: [PATCH 050/208] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BD=D1=83=D0=B4?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=C2=A0=D0=BA?= =?UTF-8?q?=D1=83=D1=87=D0=B5=20=D0=BC=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B1=D0=BE=D1=80=D1=8C=D0=B1=D1=8B=20=D1=81=C2=A0?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D0=BF=D1=83=D1=85=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=D0=BC=20=E2=84=96=C2=A02=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit По-нормальному, нужно каждый случай обобщения описать, сделать выводы и решить проблему в общем случае в рамках #332. А пока я анализировал лог и подсекал наиболее явные точки распухания. --- src/common/Escape.ref | 4 +++- src/compiler/Checker-Screening.ref | 2 +- src/compiler/Desugaring-UnCondition.ref | 5 ++++- src/compiler/HighLevelRASL-GenSubst-Save.ref | 10 ++++++++++ src/compiler/HighLevelRASL-GenSubst-Simple.ref | 10 ++++++++++ src/compiler/Log-AST.ref | 12 ++++++++++-- src/compiler/R5-Parser.ref | 6 +++++- src/compiler/main.ref | 8 ++++++-- src/lib/common/LibraryEx.refi | 4 +++- 9 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/common/Escape.ref b/src/common/Escape.ref index 281f21f7..4bfafb26 100644 --- a/src/common/Escape.ref +++ b/src/common/Escape.ref @@ -162,7 +162,9 @@ DoUnEscapeString-SR-Escape { (e.Scanned) (e.Octs) s.Next e.Tail = : { - Success s.Char = ; + Success s.Char + = ) e.Tail>; + Fails = Fails BadEscapeSymbol '\\' s.Next; }; diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index 84d3f075..0357635b 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -115,7 +115,7 @@ CheckSentences { { s.Num ((e.Pattern) e.AssignsOrConds (e.Result) (e.Blocks)) = e.Prefix '$' : e.Prefix^ - = e.ContextVars e.Pattern : e.ContextVars^ + = : e.ContextVars^ = ) + >; } +gen_e__ { e.arg = e.arg } + DoPatternSteps { t.UsedVariables (e.BoundEVariables) e.HolesAndItems , e.HolesAndItems diff --git a/src/compiler/HighLevelRASL-GenSubst-Save.ref b/src/compiler/HighLevelRASL-GenSubst-Save.ref index 3aa4b2a4..0503f089 100644 --- a/src/compiler/HighLevelRASL-GenSubst-Save.ref +++ b/src/compiler/HighLevelRASL-GenSubst-Save.ref @@ -24,6 +24,16 @@ $ENTRY GenSubst-Save { } DoGenSubst { + s.ContextOffset e.Substitutes (e.Vars) (e.Commands) + = () + () + > +} + +gen_e__ { e.arg = e.arg } + +DoGenSubst-GEN { /* Распознавание T-подстановки */ s.ContextOffset e.Substs-B diff --git a/src/compiler/HighLevelRASL-GenSubst-Simple.ref b/src/compiler/HighLevelRASL-GenSubst-Simple.ref index b25c6fe9..29a30b4d 100644 --- a/src/compiler/HighLevelRASL-GenSubst-Simple.ref +++ b/src/compiler/HighLevelRASL-GenSubst-Simple.ref @@ -24,6 +24,16 @@ $ENTRY GenSubst-Simple { } DoGenSubst { + s.ContextOffset e.Substitutes (e.Vars) (e.Commands) + = () + () + > +} + +gen_e__ { e.arg = e.arg } + +DoGenSubst-GEN { /* Распознавание T-подстановки */ s.ContextOffset e.Substs-B diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index 1be8e00d..6383098d 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -239,9 +239,17 @@ InlineTerm { (ClosureBrackets e.Value) = ; } -$SPEC MultilineTerm s.pos (e.prefix) e.indent t.term (e.suffix); - MultilineTerm { + s.pos (e.prefix) e.indent t.term (e.suffix) + = ) e.indent () + >; +} + +* TODO: исправить после реализации gen_t__ +gen_t__ { e.Arg = } + +MultilineTerm-Gen { FIRST (e.Prefix) e.Indent t.Term (e.Suffix) = ; diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index c3665404..8376fc93 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -696,9 +696,13 @@ Expression { TokenChain { t.ErrorList s.Mode s.Kind e.Tokens - = + = ) e.Tokens + > } +gen_e__ { e.arg = e.arg } + DoTokenChain { s.Mode s.Kind t.ErrorList (e.Collected) t.NextToken e.Tokens = t.NextToken diff --git a/src/compiler/main.ref b/src/compiler/main.ref index 75f70e8b..fa8ad330 100644 --- a/src/compiler/main.ref +++ b/src/compiler/main.ref @@ -665,8 +665,9 @@ Link-R { Link-WithPrefix { (e.PrefixFileName) t.Config e.Files + = : s.TargetMode = + s.TargetMode { e.IntermediateName = @@ -707,8 +708,9 @@ Link-CppCompile { e.CommandLineSuf^ = ' "' '"'; } : e.CommandLineSuf^ + = : s.TargetMode = + s.TargetMode { e.IntermediateName = >; } +$INLINE LinkError; + LinkError { t.Config e.Message = diff --git a/src/lib/common/LibraryEx.refi b/src/lib/common/LibraryEx.refi index 84324a23..aea07b56 100644 --- a/src/lib/common/LibraryEx.refi +++ b/src/lib/common/LibraryEx.refi @@ -66,9 +66,11 @@ $SPEC Fetch e.arg t.FUNC; t.Accum′ ::= t.Accum */ MapAccum { - t.Fn t.Acc e.Tail = ; + t.Fn t.Acc e.Tail = ) e.Tail>; } +gen-e__ { e.arg = e.arg } + $SPEC MapAccum t.FUNC t.accum e.items; $INLINE MapAccum; From b1d5a2b2f28001505b3484d0c696303f42e89fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 31 Jul 2021 22:12:52 +0300 Subject: [PATCH 051/208] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BD=D1=83=D0=B4?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=C2=A0=D0=BA?= =?UTF-8?q?=D1=83=D1=87=D0=B5=20=D0=BC=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B1=D0=BE=D1=80=D1=8C=D0=B1=D1=8B=20=D1=81=C2=A0?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D0=BF=D1=83=D1=85=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=D0=BC=20=E2=84=96=C2=A03=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit По-нормальному, нужно каждый случай обобщения описать, сделать выводы и решить проблему в общем случае в рамках #332. А пока я анализировал лог и подсекал наиболее явные точки распухания. --- src/compiler/Checker-Screening.ref | 8 +++--- src/compiler/Checker.ref | 16 +++++++----- src/compiler/Desugaring.ref | 7 +++-- src/compiler/GenericMatch.ref | 3 +++ src/compiler/Log-AST.ref | 15 +++++++---- src/compiler/ParseCmdLine.ref | 12 +++++---- src/compiler/R5-Lexer.ref | 2 ++ src/compiler/R5-Parser.ref | 41 ++++++++++++++++-------------- src/compiler/SR-Lexer.sref | 2 +- src/compiler/SR-Parser.sref | 10 ++++++-- 10 files changed, 72 insertions(+), 44 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index 0357635b..9218905b 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -80,7 +80,7 @@ MakePairs { */ CheckFunction { ((Function s.ScopeClass (e.Name) Sentences e.Sentences) t.SrcPos) - = + = ) () (e.Sentences)> } /* @@ -114,7 +114,7 @@ CheckSentences { : e.Prefix^ + = > : e.Prefix^ = : e.ContextVars^ = ) ((e.Pattern) e.AssignsOrConds (e.Result) (e.Blocks)) > ) ((e.Pattern) e.AssignsOrConds (e.Result) (e.Blocks)) > } diff --git a/src/compiler/Checker.ref b/src/compiler/Checker.ref index b9deaeba..413a0199 100644 --- a/src/compiler/Checker.ref +++ b/src/compiler/Checker.ref @@ -555,7 +555,7 @@ SeparateDefines { (e.Declarations) (NativeBlock e.Block) = (e.Declarations); } - (/* объявления */) + () e.AST >; } @@ -766,7 +766,7 @@ CheckRedefinitions { CheckFunctionBody { (e.Body) = - ; + ) e.Body>; } CheckFunctionBodyRec { @@ -846,14 +846,18 @@ DoCheckAssignments { = s.Backtrack >; } +gen_e__ { e.arg = e.arg } + FixBacktrackForOpenEVars { e.Pattern OneWay, : /* пусто */ = OneWay; diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index 06ec0bd2..6b4d88d5 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -646,7 +646,7 @@ Pass-FlatNestedFuncs { ExtractNested { s.MarkupContext e.Sentences = ) e.Sentences > : (/* заимстовованных переменных нет */) (e.NestedFuncs) e.Sentences^ = (e.NestedFuncs) e.Sentences; @@ -656,7 +656,10 @@ ExtractNestedRec { s.MarkupContext (e.ScopeVars) Sentences e.Sentences = ) + () + ) e.Sentences > : ((e.NestedFuncs) (e.BorrowedVars)) e.Sentences^ diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index dddd3f1b..468ea4a2 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -2205,6 +2205,7 @@ AddContraction-Spec { t._ = s.OpenFlag; } : s.OpenFlag^ + = : t.toAdd^ = ; } +gen_t__ { e.arg = } + AddContraction-Spec-Symm { t.toAdd (s.OpenFlag e.Contrs) e.SymmClashes (e.Assigns) = t.toAdd diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index 6383098d..69ddff7e 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -192,18 +192,23 @@ Expression { = ; } -$SPEC DoExpression s.POS (e.indent) (e.out-line) e.expression; - DoExpression { + s.POS (e.indent) (e.out-line) e.expression + = ) () + >; +} + +DoExpression-GEN { s.Pos (e.Indent) (e.OutLine) /* пусто */ (e.Suffix) = (e.OutLine e.Suffix); s.Pos (e.Indent) (e.OutLine) t.NextTerm e.Expr (e.Suffix) - = : e.TextualTerm - = : e.NewOutLine + = > : e.TextualTerm + = (e.TextualTerm)> : e.NewOutLine = : { True - = e.Indent e.TextualTerm : e.OutLineTerm + = : e.OutLineTerm = : { True, e.Expr : /* пусто */ diff --git a/src/compiler/ParseCmdLine.ref b/src/compiler/ParseCmdLine.ref index 8f416590..74cc4c97 100644 --- a/src/compiler/ParseCmdLine.ref +++ b/src/compiler/ParseCmdLine.ref @@ -151,7 +151,7 @@ $ENTRY ParseCommandLine { t.Config (e.Errors) &Config-SetCompilerFlags s.Num ' -I"' e.Path '"' > - (SearchFolder s.Num e.Path); + ; (t.Config e.Errors) (TargetFileName s.Num e.FileName) = ; (t.Config e.Errors) (REF5RSL-Env s.Num) - = (t.Config e.Errors) (REF5RSL-Env s.Num); + = (t.Config e.Errors) ; (t.Config e.Errors) (OverwriteExistRasls s.Num) = ; (t.Config e.Errors) t.Option - = (t.Config e.Errors) t.Option; + = (t.Config e.Errors) ; } ) (&MapAccum { (t.Config e.Errors) (SearchFolder s.Num e.Folder) - = ( e.Errors); + = ( e.Errors>); (t.Config e.Errors) (REF5RSL-Env s.Num) - = ( e.Errors); + = ( e.Errors>); (t.Config e.Errors) (FILE s.Num e.FileName) = (t.Config e.Errors) (s.Num e.FileName); @@ -326,6 +326,8 @@ $ENTRY ParseCommandLine { >; } +gen_e__ { e.arg = e.arg } + Update { t.Config (e.Errors) s.Updater s.LineNum e.Option = diff --git a/src/compiler/R5-Lexer.ref b/src/compiler/R5-Lexer.ref index 823e09fb..dab7cfa8 100644 --- a/src/compiler/R5-Lexer.ref +++ b/src/compiler/R5-Lexer.ref @@ -111,6 +111,8 @@ IncLine { (RowCol s.Line s.Col) = (RowCol 1); } +$DRIVE IncCol; + IncCol { (RowCol s.Line s.Col) = (RowCol s.Line ); diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index 8376fc93..543ff8cc 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -243,10 +243,9 @@ NameList-DoNames { t.ErrorList (e.Units) e.Tokens; t.ErrorList s.Tag (e.Units) (TkComma t.Pos) e.Tokens - = - s.Tag (e.Units) e.Tokens - >; + = + : t.ErrorList^ + = ; t.ErrorList s.Tag (e.Units) (TkName t.NamePos e.Name) (TkOpenBlock t.BracketPos) e.Tokens @@ -254,19 +253,20 @@ NameList-DoNames { t.ErrorList t.NamePos 'missed semicolon after previous ' ' declaration' > + : t.ErrorList^ + = t.ErrorList (e.Units) (TkName t.NamePos e.Name) (TkOpenBlock t.BracketPos) e.Tokens; t.ErrorList s.Tag (e.Units) (TkName t.Pos e.Name) e.Tokens - = - s.Tag (e.Units) e.Tokens - >; + = + : t.ErrorList^ + = ; t.ErrorList s.Tag (e.Units) t.NextToken e.Tokens , t.NextToken : (s.Type t.Pos e.Value) , : True - = - (e.Units) t.NextToken e.Tokens; + = : t.ErrorList^ + = t.ErrorList (e.Units) t.NextToken e.Tokens; t.ErrorList s.Tag (e.Units) t.NextToken e.Tokens = ; + = ) e.ExceedBlocks>; } DoCheckExceedBlocks { s.Mode t.ErrorList (e.ScannedBlocks) (t.Pos e.Body) e.RestBlocks + = + : t.ErrorList^ = - (e.ScannedBlocks (e.Body)) - e.RestBlocks + s.Mode t.ErrorList (e.ScannedBlocks (e.Body)) e.RestBlocks >; s.Mode t.ErrorList (e.ScannedBlocks) /* empty */ @@ -633,7 +630,8 @@ Pattern { Result { t.ErrorList s.Mode e.Tokens = + s.Mode () + >; } @@ -694,10 +692,12 @@ Expression { >; } +$INLINE TokenChain, Expression; + TokenChain { t.ErrorList s.Mode s.Kind e.Tokens = ) e.Tokens + s.Mode s.Kind t.ErrorList () > } @@ -762,12 +762,14 @@ DoTokenChain { t.ErrorList s.Mode t.Pos 'Identifier expected after \'<\'' > : t.ErrorList^ + = : e.Collected^ = >; (TkOpenCall t.Pos e.FuncName) + = : e.Collected^ = @@ -956,6 +958,7 @@ Expression-CheckBrackets { = t.ErrorList t.Expression e.Tokens; } +$DRIVE ClassicError; ClassicError { t.ErrorList Classic t.Pos e.Message diff --git a/src/compiler/SR-Lexer.sref b/src/compiler/SR-Lexer.sref index 49398aaf..11d8dbc3 100644 --- a/src/compiler/SR-Lexer.sref +++ b/src/compiler/SR-Lexer.sref @@ -165,7 +165,7 @@ ValidDirective { 'ESWAP' = (#TkDirective #ESwap); 'LABEL' = (#TkDirective #Ident); 'INCLUDE' = (#TkDirective #Include); - 'EASTEREGG' = ; + 'EASTEREGG' = >; 'SCOPEID' = (#TkNumber #Cookie1) (#TkNumber #Cookie2) (#TkWarning #deprecated '$SCOPEID is deprecated'); diff --git a/src/compiler/SR-Parser.sref b/src/compiler/SR-Parser.sref index 7c1994d8..95c54d29 100644 --- a/src/compiler/SR-Parser.sref +++ b/src/compiler/SR-Parser.sref @@ -408,10 +408,14 @@ ParseSentencePart { ParsePattern { t.ErrorList e.Tokens = ) () + e.Tokens >; } +gen_e__ { e.arg = e.arg; } + DoParsePattern { // Обработка литералов атомов @@ -612,7 +616,9 @@ StrFromBracket { ParseResult { t.ErrorList e.Tokens = ) () + e.Tokens > : t.ErrorList^ (e.Result) e.Tail = : t.ErrorList^ (e.Blocks) e.Tail^ From 11d93235a90baf10f563e9e819542f109d08fe8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 31 Jul 2021 22:14:30 +0300 Subject: [PATCH 052/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D0=B7=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20TermCompare=20=E2=86=92=20Compare=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GST.ref | 4 ++-- src/compiler/Generator-RASL.ref | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/GST.ref b/src/compiler/GST.ref index 8c4b2581..bc671dde 100644 --- a/src/compiler/GST.ref +++ b/src/compiler/GST.ref @@ -242,9 +242,9 @@ FindHeavyTile { { (s.MaxWeight s.IndexP s.IndexR e.MaxItems) (s.Weight s.CurIndexP s.CurIndexR e.Items) - = + = : { - '<' = + '-' = (s.Weight s.CurIndexP s.CurIndexR e.Items) (s.MaxWeight s.IndexP s.IndexR e.MaxItems); diff --git a/src/compiler/Generator-RASL.ref b/src/compiler/Generator-RASL.ref index 2964ce76..b4761d15 100644 --- a/src/compiler/Generator-RASL.ref +++ b/src/compiler/Generator-RASL.ref @@ -471,9 +471,9 @@ ResolveLabeledDestinations { = : s.RelativeJump - = + = : { - '<' + '-' = : (s.JumpHigh) s.JumpLow = e.ReadyRASL From ddb7051cb7e9470981f27bb622b22425e75739fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 00:47:08 +0300 Subject: [PATCH 053/208] =?UTF-8?q?FIXED:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D1=82=D0=BE=D1=87=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=82=D1=80=D0=B8=D0=B2=D0=B8=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D1=81=D0=B8=D0=B3=D0=BD=D0=B0=D1=82=D1=83?= =?UTF-8?q?=D1=80=D1=8B=20(#251,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Проблема была внесена коммитом c1de4f56. Ошибка заключалась в том, что вызов функции IsTrivialSignature не соответствовал формату, поэтому условие всегда было ложным. --- src/compiler/OptTree-Spec.ref | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 61bbad17..f765d218 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -979,22 +979,18 @@ RemoveLastGhostBracket { } IsTrivialSignature { - e.Arg (e.Body), : False = False (e.Arg) (e.Body); - e.Arg (e.Body) = ; + e.Arg (e.Body), : False = False; + e.Arg (e.Body t.GuardSentence) = ; } DoIsTrivialSignature { - e.Arg (e.ScannedSentences) (/* кончились предложения */) - = True (e.Arg) (e.ScannedSentences); + e.Arg (/* кончились предложения */) = True; - e.Arg (e.ScannedSentences) (((e.Pattern) e.Tail) e.Sentences) + e.Arg (((e.Pattern) e.Tail) e.Sentences) , : Clear e._ - = ; + = ; - e.Arg (e.ScannedSentences) (e.Sentences) - = False (e.Arg) (e.ScannedSentences e.Sentences); + e.Arg (e.Sentences) = False; } OrderUniqueVars { From ea34c7b26ae8dbd05b94cb3b73e8b763c066ce6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 01:06:12 +0300 Subject: [PATCH 054/208] =?UTF-8?q?=D0=A1=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0:=20=D0=B4?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD=D0=BD=D1=8B=D0=B5=20=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B2=C2=A0R5-Parser.ref=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/R5-Parser.ref | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index 543ff8cc..19d25cb8 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -92,7 +92,8 @@ UnitStartToken { } NameListTags { - = TkExtern TkEnum TkEEnum TkSwap TkESwap TkLabel TkInline TkDrive TkMeta TkIntrinsic + = TkExtern TkEnum TkEEnum TkSwap TkESwap TkLabel TkInline TkDrive TkMeta + TkIntrinsic } OneOf { @@ -366,7 +367,9 @@ Function { = ; t.ErrorList s.Mode (TkEntry t.Pos) e.Tokens - = + = (/* none */) e.Tokens; } From 916efbfe95b559c3cae13cc177beb6e0f0efcf04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 14:00:52 +0300 Subject: [PATCH 055/208] =?UTF-8?q?=D0=9E=D0=B1=D0=BE=D0=B1=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=83=D1=87=D0=B0=D1=81=D1=82=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B0=D1=80=D0=B3=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=B0?= =?UTF-8?q?=20=D0=BC=D0=B5=D0=B6=D0=B4=D1=83=20=D0=B4=D0=B2=D1=83=D0=BC?= =?UTF-8?q?=D1=8F=20e-=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8=20(#332,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 64 ++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index f765d218..5c8d227f 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -542,12 +542,16 @@ SpecCall { = : e.UsedVars = : (e.ExtractedCalls (e.UsedVars^)) e.NewArgument + + /* Обобщаем участки аргумента вида e.1 … e.2 */ + = + : e.NewArgument^ (e.UsedVars^) (e.Sg) + + = e.ExtractedCalls : e.Sg^ + /* ищем динамическое обобщение для аргумента и образцов */ - = - : (e.NewArgument^) (e.Sg) (e.Solutions) + = + : (e.NewArgument^) (e.Sg^) (e.Solutions) = ; } +/* + Функция обобщает участки между двумя e-параметрами: + … e.1 … e.2 … → … e.New …, e.1 … e.2 ← e.New +*/ +GenEE { + /* пусто */ (e.UsedVars) (e.Sg) = /* пусто */ (e.UsedVars) (e.Sg); + (Var 'e' e.Index) (e.UsedVars) (e.Sg) = (Var 'e' e.Index) (e.UsedVars) (e.Sg); + + (Var 'e' e.Left) e.Expr (Var 'e' e.Right) (e.UsedVars) (e.Sg) + = : (e.UsedVars^) 'e' e.eGen + = (Var 'e' e.eGen) (e.UsedVars) + (e.Sg ((Var 'e' e.Left) e.Expr (Var 'e' e.Right) ':' ('e' e.eGen))); + + (s.Brackets e.Nested) e.Expr (e.UsedVars) (e.Sg) + , Brackets ClosureBrackets : e._ s.Brackets e._ + = : e.Nested^ (e.UsedVars^) (e.Sg^) + = (s.Brackets e.Nested) ; + + (ADT-Brackets (e.Name) e.Nested) e.Expr (e.UsedVars) (e.Sg) + = : e.Nested^ (e.UsedVars^) (e.Sg^) + = (ADT-Brackets (e.Name) e.Nested) ; + + (Symbol e.Symbol) e.Expr (e.UsedVars) (e.Sg) + = (Symbol e.Symbol) ; + + (Var s.Mode e.Index) e.Expr (e.UsedVars) (e.Sg) + , 'st' : e._ s.Mode e._ + = (Var s.Mode e.Index) ; + + e.Expr (s.Brackets e.Nested) (e.UsedVars) (e.Sg) + , Brackets ClosureBrackets : e._ s.Brackets e._ + = : e.Expr^ (e.UsedVars^) (e.Sg^) + = : e.Nested^ (e.UsedVars^) (e.Sg^) + = e.Expr (s.Brackets e.Nested) (e.UsedVars) (e.Sg); + + e.Expr (ADT-Brackets (e.Name) e.Nested) (e.UsedVars) (e.Sg) + = : e.Expr^ (e.UsedVars^) (e.Sg^) + = : e.Nested^ (e.UsedVars^) (e.Sg^) + = e.Expr (ADT-Brackets (e.Name) e.Nested) (e.UsedVars) (e.Sg); + + e.Expr (Symbol e.Symbol) (e.UsedVars) (e.Sg) + = : e.Expr^ (e.UsedVars^) (e.Sg^) + = e.Expr (Symbol e.Symbol) (e.UsedVars) (e.Sg); + + e.Expr (Var s.Mode e.Index) (e.UsedVars) (e.Sg) + , 'st' : e._ s.Mode e._ + = : e.Expr^ (e.UsedVars^) (e.Sg^) + = e.Expr (Var s.Mode e.Index) (e.UsedVars) (e.Sg); +} + DynGenArg { (e.Arg) (e.Sg) (e.Sol) (e.Begin) ((e.Pat) e.Tail) e.Sentences From 7e50e6c64138868572f71eb1f61edc4cc211c9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 14:05:24 +0300 Subject: [PATCH 056/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2=C2=A0OptTree-Spec.ref=20(#359?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 5c8d227f..b77d95be 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -540,6 +540,7 @@ SpecCall { (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures (e.Argument) (e.History) = : e.UsedVars + = : (e.ExtractedCalls (e.UsedVars^)) e.NewArgument @@ -549,9 +550,10 @@ SpecCall { = e.ExtractedCalls : e.Sg^ - /* ищем динамическое обобщение для аргумента и образцов */ + /* ищем динамическое обобщение для аргумента и образцов */ = : (e.NewArgument^) (e.Sg^) (e.Solutions) + = : { - Success e.Solutions (e.SgNew) (e.ArgNew) - , e.SgNew : /* пусто */ + Success e.Solutions (/* нет обобщений */) (e.ArgNew) = e.ArgNew : e.ArgNew^ (Brackets e._) = e.Pat : e.Pat^ (Brackets e._) = : e.Sg^ + = : e.Sg^ = - > - ) - (/* пусто */) (/* пусто */) + (e.ArgNew) (e.Sg) (/* пусто */) (/* пусто */) e.Begin ((e.Pat) e.Tail) e.Sentences >; From 8844890dac7cb26fca43973c6625196c6a0f6a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 18:35:55 +0300 Subject: [PATCH 057/208] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BD=D1=83=D0=B4?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=C2=A0=D0=BA?= =?UTF-8?q?=D1=83=D1=87=D0=B5=20=D0=BC=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B1=D0=BE=D1=80=D1=8C=D0=B1=D1=8B=20=D1=81=C2=A0?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D0=BF=D1=83=D1=85=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=D0=BC=20=E2=84=96=C2=A04=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit По-нормальному, нужно каждый случай обобщения описать, сделать выводы и решить проблему в общем случае в рамках #332. А пока я анализировал лог и подсекал наиболее явные точки распухания. В Log-AST.ref был интересный случай квадратичного распухания, а в остальных местах — типичная специализация по аккумулятору. --- src/compiler/HighLevelRASL-GenResult-Simple.ref | 10 ++++++++++ src/compiler/Log-AST.ref | 4 ++-- src/compiler/LowLevelRASL.ref | 9 +++++++++ src/compiler/R5-Parser.ref | 7 +++++++ src/compiler/SR-Parser.sref | 14 ++++++++++++++ 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/compiler/HighLevelRASL-GenResult-Simple.ref b/src/compiler/HighLevelRASL-GenResult-Simple.ref index 454510bc..f9a2447b 100644 --- a/src/compiler/HighLevelRASL-GenResult-Simple.ref +++ b/src/compiler/HighLevelRASL-GenResult-Simple.ref @@ -75,7 +75,17 @@ GenResult { >; } +gen_e__ { e.arg = e.arg } + DoGenResult { + (e.Vars) (e.AllocCommands) (e.Commands) s.Counter e.Result + = ) () + s.Counter e.Result + >; +} + +DoGenResult-GEN { (e.Vars) (e.AllocCommands) (e.Commands) s.Counter (TkOpenCallCond s.Offset) e.Result = ' :: ' ); + ((Symbol Identifier e.Ident) (Symbol Name e.Name^)) + = (' ' ' :: ' ); } e.Metatable > diff --git a/src/compiler/LowLevelRASL.ref b/src/compiler/LowLevelRASL.ref index 99414c96..22997d12 100644 --- a/src/compiler/LowLevelRASL.ref +++ b/src/compiler/LowLevelRASL.ref @@ -56,6 +56,15 @@ Canonize { } CalcDigest { + t.Hashes t.Element + = : t.Hashes^ t.Element^ + = t.Hashes ; +} + +gen_t__ { e.arg = } +gen_e__ { e.arg = e.arg } + +CalcDigest-Aux { (s.Hash1 s.Hash2) (UnitName e.SrcName) = () (UnitName e.SrcName); diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index 19d25cb8..d02156af 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -707,6 +707,13 @@ TokenChain { gen_e__ { e.arg = e.arg } DoTokenChain { + s.Mode s.Kind t.ErrorList (e.Collected) e.Tokens + = ) e.Tokens + > +} + +DoTokenChain-GEN { s.Mode s.Kind t.ErrorList (e.Collected) t.NextToken e.Tokens = t.NextToken : { diff --git a/src/compiler/SR-Parser.sref b/src/compiler/SR-Parser.sref index 95c54d29..77a48f44 100644 --- a/src/compiler/SR-Parser.sref +++ b/src/compiler/SR-Parser.sref @@ -417,6 +417,13 @@ ParsePattern { gen_e__ { e.arg = e.arg; } DoParsePattern { + t.ErrorList (e.MultiBracket) (e.Scanned) e.Tokens + = ) () e.Tokens + >; +} + +DoParsePattern-GEN { // Обработка литералов атомов t.ErrorList (e.MultiBrackets) (e.Scanned) (#TkChar s.LnNum s.Char) e.Tail = @@ -638,6 +645,13 @@ ParseBlocks { */ DoParseResult { + t.ErrorList (e.MultiBracket) (e.Scanned) e.Tokens + = ) () e.Tokens + >; +} + +DoParseResult-GEN { // Обработка литералов атомов t.ErrorList (e.MultiBracket) (e.Scanned) (#TkChar s.LnNum s.Char) e.Tail = From 14a8b3eac6687b6105c60346e0345b60eff63e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 19:34:25 +0300 Subject: [PATCH 058/208] =?UTF-8?q?FIXED:=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE?= =?UTF-8?q?=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D1=81=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=BA=D0=B8=20=D1=81=D1=82=D0=B0=D0=B1=D0=B8=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B5=D0=B9=20(#3?= =?UTF-8?q?59,=20#361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 2 +- src/compiler/SR-Lexer.sref | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index b77d95be..02b7be1e 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -417,7 +417,7 @@ SpecTerm { = e.eClosureArgOut : { e.eClosureArg = /* пусто */; - e._ = <{}> + e._ = <{X = e.eClosureArg e.eClosureArgOut}> } : /* пусто */ diff --git a/src/compiler/SR-Lexer.sref b/src/compiler/SR-Lexer.sref index 11d8dbc3..faf09d6c 100644 --- a/src/compiler/SR-Lexer.sref +++ b/src/compiler/SR-Lexer.sref @@ -165,7 +165,7 @@ ValidDirective { 'ESWAP' = (#TkDirective #ESwap); 'LABEL' = (#TkDirective #Ident); 'INCLUDE' = (#TkDirective #Include); - 'EASTEREGG' = >; + 'EASTEREGG' = >; 'SCOPEID' = (#TkNumber #Cookie1) (#TkNumber #Cookie2) (#TkWarning #deprecated '$SCOPEID is deprecated'); From 3eccd9002d8d7a4de3f8993a896e49c3ef746d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 19:36:02 +0300 Subject: [PATCH 059/208] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=81=D0=B0=D0=BC=D0=BE=D0=BF=D1=80=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=C2=A0=D1=80=D0=B5?= =?UTF-8?q?=D0=B6=D0=B8=D0=BC=D0=B5=20-OiADPRS=20=D0=B2=C2=A0CI=20(#323)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI-posix.yml | 6 ++++++ .github/workflows/CI-windows.yml | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/CI-posix.yml b/.github/workflows/CI-posix.yml index 3415ee19..49053d75 100644 --- a/.github/workflows/CI-posix.yml +++ b/.github/workflows/CI-posix.yml @@ -45,3 +45,9 @@ jobs: bin src retention-days: 5 + + - name: Bootstrapping on ${{ matrix.os }} with ${{ matrix.ccomp }} and -OiADPRS + run: | + cp .github/workflows/conf-template-${{ matrix.ccomp }}.bash c-plus-plus.conf.sh + RLMAKE_FLAGS="-X-OiADPRS" ./bootstrap.sh --no-tests + shell: bash diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index af713985..2127bfb0 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -36,3 +36,10 @@ jobs: bin src retention-days: 5 + + - name: Bootstrapping with ${{ matrix.ccomp }} and -OiADPRS + run: | + copy .github\workflows\conf-template-${{ matrix.ccomp }}.bat c-plus-plus.conf.bat + set RLMAKE_FLAGS=-X-OiADPRS + bootstrap.bat + shell: cmd From 86bcb60cd20c9852ff249b461008e279ecd2bf1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 19:55:41 +0300 Subject: [PATCH 060/208] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=BE=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BD=D0=B5=D0=BD=D1=83=D0=B6=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=B0=D1=80=D1=82=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B2=C2=A0CI=20(#323)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI-posix.yml | 1 - .github/workflows/CI-windows.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/CI-posix.yml b/.github/workflows/CI-posix.yml index 49053d75..7d9c402f 100644 --- a/.github/workflows/CI-posix.yml +++ b/.github/workflows/CI-posix.yml @@ -43,7 +43,6 @@ jobs: autotests/__dump.txt autotests/__log.txt bin - src retention-days: 5 - name: Bootstrapping on ${{ matrix.os }} with ${{ matrix.ccomp }} and -OiADPRS diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 2127bfb0..4f184795 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -34,7 +34,6 @@ jobs: autotests\__dump.txt autotests\__log.txt bin - src retention-days: 5 - name: Bootstrapping with ${{ matrix.ccomp }} and -OiADPRS From 797c494a4bdc2b5520905a625b099636273ab740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 19:56:16 +0300 Subject: [PATCH 061/208] =?UTF-8?q?=D0=A3=D0=BF=D0=B0=D0=B2=D1=88=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9=D0=BD=D1=8B=D0=B5?= =?UTF-8?q?=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20=D1=82=D0=B5=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D1=8C=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D1=8F=D1=8E?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=BA=D0=B0=D0=BA=20=D0=B0=D1=80=D1=82?= =?UTF-8?q?=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D1=8B=20=D0=B2=C2=A0CI=20(#323)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI-posix.yml | 2 ++ .github/workflows/CI-windows.yml | 2 ++ autotests/any-random-test/run.bat | 4 ---- autotests/any-random-test/run.sh | 4 ---- autotests/positive-random-test/run.bat | 4 ---- autotests/positive-random-test/run.sh | 4 ---- 6 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/CI-posix.yml b/.github/workflows/CI-posix.yml index 7d9c402f..979d4088 100644 --- a/.github/workflows/CI-posix.yml +++ b/.github/workflows/CI-posix.yml @@ -42,6 +42,8 @@ jobs: autotests/__error.txt autotests/__dump.txt autotests/__log.txt + autotests/any-random-test + autotests/positive-random-test bin retention-days: 5 diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 4f184795..3de45453 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -33,6 +33,8 @@ jobs: autotests\__error.txt autotests\__dump.txt autotests\__log.txt + autotests\any-random-test + autotests\positive-random-test bin retention-days: 5 diff --git a/autotests/any-random-test/run.bat b/autotests/any-random-test/run.bat index b04b61bb..6b1092c9 100644 --- a/autotests/any-random-test/run.bat +++ b/autotests/any-random-test/run.bat @@ -52,10 +52,6 @@ setlocal 2>%FILE%.err >%FILE%.out if errorlevel 100 ( echo ...COMPILER FAILS ON %FILE%, see %FILE%.err - echo FILE %FILE%.ref: - echo ============================================================ - type %FILE%.ref - echo ============================================================ exit /b 1 ) if exist %FILE%.rasl erase %FILE%.rasl diff --git a/autotests/any-random-test/run.sh b/autotests/any-random-test/run.sh index 15f4728c..e6fc3449 100755 --- a/autotests/any-random-test/run.sh +++ b/autotests/any-random-test/run.sh @@ -48,10 +48,6 @@ run_test() { if [[ $? -gt 99 ]]; then echo "...COMPILER FAILS ON $FILE, see $FILE.err" - echo FILE "$FILE.ref": - echo ============================================================ - cat "$FILE.ref" - echo ============================================================ return 1 fi rm -f "$FILE.rasl" diff --git a/autotests/positive-random-test/run.bat b/autotests/positive-random-test/run.bat index f79c4bd4..204f1ab0 100644 --- a/autotests/positive-random-test/run.bat +++ b/autotests/positive-random-test/run.bat @@ -114,10 +114,6 @@ setlocal 2>%FILE%.err%FLAGS% >%FILE%.out%FLAGS% if not exist %FILE%.rasl ( - echo FILE %FILE%.ref: - echo ============================================================ - type %FILE%.ref - echo ============================================================ exit /b 1 ) erase %FILE%.rasl diff --git a/autotests/positive-random-test/run.sh b/autotests/positive-random-test/run.sh index d01c5f72..bca40ea7 100755 --- a/autotests/positive-random-test/run.sh +++ b/autotests/positive-random-test/run.sh @@ -114,10 +114,6 @@ run_test() { 2>"$FILE.err$FLAGS" >"$FILE.out$FLAGS" if [[ ! -e "$FILE.rasl" ]]; then - echo FILE "$FILE.ref": - echo ============================================================ - cat "$FILE.ref" - echo ============================================================ return 1 fi rm -f "$FILE.rasl" From 4c69b3be4a8d15256fbb548b77a302ee213d5624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 20:41:18 +0300 Subject: [PATCH 062/208] =?UTF-8?q?FIXED:=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE?= =?UTF-8?q?=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D1=81=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=BA=D0=B8=20=D1=81=D1=82=D0=B0=D0=B1=D0=B8=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B5=D0=B9=20(#3?= =?UTF-8?q?59,=20#361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/SR-Lexer.sref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/SR-Lexer.sref b/src/compiler/SR-Lexer.sref index faf09d6c..49398aaf 100644 --- a/src/compiler/SR-Lexer.sref +++ b/src/compiler/SR-Lexer.sref @@ -165,7 +165,7 @@ ValidDirective { 'ESWAP' = (#TkDirective #ESwap); 'LABEL' = (#TkDirective #Ident); 'INCLUDE' = (#TkDirective #Include); - 'EASTEREGG' = >; + 'EASTEREGG' = ; 'SCOPEID' = (#TkNumber #Cookie1) (#TkNumber #Cookie2) (#TkWarning #deprecated '$SCOPEID is deprecated'); From 92264d38a9beb12bbeefa7605ad315a0688bb76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 20:56:01 +0300 Subject: [PATCH 063/208] =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=B4=D1=83=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=B6=D0=B4=D0=B5=D0=BD=D0=B8=D0=B5=20GCC:=20?= =?UTF-8?q?=D1=83=D1=87=D1=91=D1=82=20=D0=B2=D0=BE=D0=B7=D0=B2=D1=80=D0=B0?= =?UTF-8?q?=D1=89=D0=B0=D0=B5=D0=BC=D0=BE=D0=B3=D0=BE=20=D0=B7=D0=BD=D0=B0?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20fgets()=20(#85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/debug/refalrts-debugger.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/debug/refalrts-debugger.cpp b/src/lib/debug/refalrts-debugger.cpp index 2eaadffa..9f7c68fb 100644 --- a/src/lib/debug/refalrts-debugger.cpp +++ b/src/lib/debug/refalrts-debugger.cpp @@ -659,8 +659,11 @@ std::string refalrts::debugger::RefalDebugger::ask_for_param( printf("param>"); char param[MAX_COMMAND_LEN] = {0}; - fgets(param, MAX_COMMAND_LEN - 1, m_in); - return trim(std::string(param)); + if (fgets(param, MAX_COMMAND_LEN - 1, m_in) != 0) { + return trim(std::string(param)); + } else { + return std::string(); + } } //============================================================================= @@ -1254,7 +1257,9 @@ refalrts::FnResult refalrts::debugger::RefalDebugger::debugger_loop( break; } } else { - fgets(command, MAX_COMMAND_LEN - 1, m_in); + if (fgets(command, MAX_COMMAND_LEN - 1, m_in) == 0) { + memcpy(command, s_QUIT, strlen(s_QUIT)); + } } std::pair cmdAndError = parse_input_line( std::string(command)); From 3ed28e8b4b4f8d991ddd8fc843937a6e813bcafd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 21:02:09 +0300 Subject: [PATCH 064/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=20ApplyContractions=20=D0=B2=C2=A0TreeUtils.?= =?UTF-8?q?ref=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 48 +---------------------------- src/compiler/OptTree-Drive.ref | 4 +-- src/compiler/TreeUtils.ref | 46 +++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 9a9d90d6..2ba039e0 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -11,7 +11,7 @@ $EXTERN OptTree-Drive-Intrinsic; $EXTERN Solve-Drive; *$FROM TreeUtils -$EXTERN ExpandClosures-Result, IsPassiveExpr, HashName; +$EXTERN ExpandClosures-Result, ApplyContractions, IsPassiveExpr, HashName; /** @@ -527,52 +527,6 @@ ApplyAssigns-Term { t.T (e.Assigns) = t.T; } -/** - : (e._) e.Expr^ - = e.Expr; -} - -ApplyContractions-Expr { - (e.Contrs) e.Expr = ; -} - -ApplyContractions-Term { - (e.Contrs) (Brackets e.Expr) - = : (e.Contrs^) e.Expr^ - = (e.Contrs) (Brackets e.Expr); - - (e.Contrs) (CallBrackets e.Expr) - = : (e.Contrs^) e.Expr^ - = (e.Contrs) (CallBrackets e.Expr); - - (e.Contrs) (ColdCallBrackets e.OriginArgs) - = - : { -* Содержимое холодных скобок не изменилось, оставляем их холодными - (e.Contrs^) e.OriginArgs = (e.Contrs) (ColdCallBrackets e.OriginArgs); - -* Содержимое обновилось, оттаиваем скобки - (e.Contrs^) e.ChangedArgs = (e.Contrs) (CallBrackets e.ChangedArgs); - }; - - (e.Contrs) (ClosureBrackets e.Expr) - = : (e.Contrs^) e.Expr^ - = (e.Contrs) (ClosureBrackets e.Expr); - - (e.Contrs) (ADT-Brackets (e.Name) e.Expr) - = : (e.Contrs^) e.Expr^ - = (e.Contrs) (ADT-Brackets (e.Name) e.Expr); - - (e.B (t.Term ':' e.Contr) e.E) t.Term - = ; - - (e.Contrs) t.T = (e.Contrs) t.T; -} - /* == e.Name */ diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index dcb7474c..a7dcac1c 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -8,10 +8,10 @@ $EXTERN Log-PutLine; $EXTERN DisplayName; *$FROM TreeUtils -$EXTERN HashName, ExtractVariables, IsLExpr; +$EXTERN HashName, ExtractVariables, IsLExpr, ApplyContractions; *$FROM OptTree-Drive-Expr -$EXTERN OptTree-Drive-Expr, ApplyContractions; +$EXTERN OptTree-Drive-Expr; /* diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index 7c7624f5..ec92424a 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -273,3 +273,49 @@ ExpandClosures-ResultTerm { t.OtherTerm = t.OtherTerm; } + +/** + : (e._) e.Expr^ + = e.Expr; +} + +ApplyContractions-Expr { + (e.Contrs) e.Expr = ; +} + +ApplyContractions-Term { + (e.Contrs) (Brackets e.Expr) + = : (e.Contrs^) e.Expr^ + = (e.Contrs) (Brackets e.Expr); + + (e.Contrs) (CallBrackets e.Expr) + = : (e.Contrs^) e.Expr^ + = (e.Contrs) (CallBrackets e.Expr); + + (e.Contrs) (ColdCallBrackets e.OriginArgs) + = + : { +* Содержимое холодных скобок не изменилось, оставляем их холодными + (e.Contrs^) e.OriginArgs = (e.Contrs) (ColdCallBrackets e.OriginArgs); + +* Содержимое обновилось, оттаиваем скобки + (e.Contrs^) e.ChangedArgs = (e.Contrs) (CallBrackets e.ChangedArgs); + }; + + (e.Contrs) (ClosureBrackets e.Expr) + = : (e.Contrs^) e.Expr^ + = (e.Contrs) (ClosureBrackets e.Expr); + + (e.Contrs) (ADT-Brackets (e.Name) e.Expr) + = : (e.Contrs^) e.Expr^ + = (e.Contrs) (ADT-Brackets (e.Name) e.Expr); + + (e.B (t.Term ':' e.Contr) e.E) t.Term + = ; + + (e.Contrs) t.T = (e.Contrs) t.T; +} From 002debe3ae5f3869e6ec52ea341912c64d87d495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 22:16:15 +0300 Subject: [PATCH 065/208] =?UTF-8?q?FIXED:=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BA=D0=B0=20=D1=81=D0=B0=D0=BC=D0=BE=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=C2=A0=D1=80?= =?UTF-8?q?=D0=B5=D0=B6=D0=B8=D0=BC=D0=B5=20-OiADPRS=20=D0=B2=C2=A0CI=20(#?= =?UTF-8?q?323)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Повторная самосборка для Windows по ошибке включала автотесты. --- .github/workflows/CI-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 3de45453..d75946c3 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -42,5 +42,5 @@ jobs: run: | copy .github\workflows\conf-template-${{ matrix.ccomp }}.bat c-plus-plus.conf.bat set RLMAKE_FLAGS=-X-OiADPRS - bootstrap.bat + bootstrap.bat --no-tests shell: cmd From f5dbfee6a8ed102d9903bfcb28621ffe65758392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 1 Aug 2021 22:55:44 +0300 Subject: [PATCH 066/208] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=BE=D0=B9=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20=D1=83=D0=BF=D1=80=D0=BE=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BE=D1=80=D0=B4=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=D1=82=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 92 +++++++++++------------------------ 1 file changed, 29 insertions(+), 63 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 468ea4a2..c97563f8 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -439,48 +439,20 @@ DoAddCoordinateLabels { /* Упрощение координат (редуцирование их бессмысленного скопления) - - - == (e.Contractions) t.Clash^* (t.Assign^*) */ -SimplifyCoordinates { - (e.Contrs) e.Clashes (e.Assigns) - = (e.Contrs) - - () -} - -SimplifyCoordinates-Symm { - (e.Contrs) e.SymmClashes (e.Assigns) - = (e.Contrs) - - () -} - -SimplifyCoordinates-Clash { - ((e.Left) ':' (e.Right)) - = (() ':' (e.Right)) -} - SimplifyCoordinates-SymmClash { - (e.L '=' e.R) - = ( '=' ) -} - -SimplifyCoordinates-Assign { - (e.Left ':' t.Right) - = ( ':' t.Right) + (e.L '=' e.R) = ( '=' ) } -SimplifyCoordinates-Expr { +SimplifyCoordinates { /* {k} {m} E {n} ↦ {m} E {n} */ ('{'s.K'}') ('{'s.M'}') e.E ('{'s.N'}') - = ; + = ; /* {k} E {m} {n} ↦ {k} E {m} */ ('{'s.K'}') e.E ('{'s.M'}') ('{'s.N'}') - = ; + = ; /* {m} {n} ↦ ε */ ('{'s.M'}') ('{'s.N'}') @@ -541,9 +513,7 @@ Solve-Clashes { = + (() ':' (e.RBody)) e.ClashesEnd (e.Assigns) >; @@ -557,9 +527,7 @@ Solve-Clashes { = + (() ':' (e.RBody)) e.ClashesEnd (e.Assigns) >; @@ -2206,14 +2174,12 @@ AddContraction-Spec { } : s.OpenFlag^ = : t.toAdd^ - = > - ) - > - () - >; + = ( + s.OpenFlag + > + ) + > + () } gen_t__ { e.arg = } @@ -2230,14 +2196,12 @@ AddContraction-Spec-Symm { t._ = s.OpenFlag; } : s.OpenFlag^ - = > - ) - > - () - >; + = ( + s.OpenFlag + > + ) + > + () } /* @@ -2258,8 +2222,10 @@ ApplyContraction-toContraction { */ ApplyContraction-toAssign { - t.Contraction (e.M ':' t.Rval) - = ( ':' t.Rval); + t.Contraction (e.Expr ':' t.Rval) + = : e.Expr^ + = : e.Expr^ + = (e.Expr ':' t.Rval); } /* @@ -2269,17 +2235,17 @@ ApplyContraction-toAssign { */ ApplyContraction-toEquation { - t.Contraction ((e.Expr) ':' (e.Lexpr)) = - (() ':' (e.Lexpr)) + t.Contraction ((e.Expr) ':' (e.Lexpr)) + = : e.Expr^ + = : e.Expr^ + = ((e.Expr) ':' (e.Lexpr)) } ApplyContraction-toSymmClash { t.Contr (e.L '=' e.R) - = ( - - '=' - - ) + = : e.L^ + = : e.R^ + = : e.Contrs = : e.Expr^ = ) ((e.Expr) ':' (e.Lexpr)) - () + () > : { e._ (Generalize (e.Intervals)) e._ = Undefined; @@ -102,7 +101,6 @@ CombineResults-Drive { = : e.Contrs^ = ':' t.Var) @@ -139,9 +137,9 @@ Solve-Spec-DoFindGeneralization { (e.UsedVars) ((e.L) ':' (e.R)) (e.GenAssigns) = ) + (None /* сужения */) ((e.L) ':' (e.R)) - (/* пусто */) + (/* присваивания */) > : { e._ (Generalize (e.Intervals)) e._ @@ -164,39 +162,6 @@ Solve-Spec-DoFindGeneralization { } } -/* - Инициализирует список сужений тривиальными сужениями - - == t.Contr* -*/ - -InitContractions { - e.Expr - = : e.Vars - = -} - -/* - Удаляет тривиальные сужения из набора сужений - - == t.Contr* -*/ - -RemoveTrivialContractions { - e.Contrs - = -} - /* Объединяет два интервала, если они пересекаются. В остальных случаях возвращает исходный список интервалов. @@ -257,7 +222,6 @@ CombineResults-Spec { = : e.Contrs^ = ':' t.Var) @@ -862,7 +826,7 @@ Solve-Clashes { /* клэши закончились */ (e.UsedVars) (e.Contrs) (e.Assigns) - = : (e.Assigns^) (e.SymmClashes) + = : (e.Assigns^) (e.SymmClashes) = + == (t.Assign*) (t.SymmClash*) == (t.Assign*) (t.SymmClash*) @@ -1192,7 +1156,8 @@ SplitSolve { */ CreateSymmClashes { - (e.Assigns) + (e.Contrs) (e.Assigns) + = : e.Assigns^ = : (e.Assigns^) (e.SymmClashes) = (e.Assigns) (); @@ -2100,6 +2065,7 @@ Solve-SymmClashes-Aux { * Если клэши кончились, возвращаем решение (e.UsedVars) (s.OpenFlag e.Contrs) (e.Assigns) + = : e.Assigns^ = (Success (e.UsedVars) s.OpenFlag (e.Contrs) (e.Assigns)); } @@ -2174,12 +2140,9 @@ AddContraction-Spec { } : s.OpenFlag^ = : t.toAdd^ - = ( - s.OpenFlag - > - ) - > - () + = (s.OpenFlag e.Contrs t.toAdd) + + (e.Assigns); } gen_t__ { e.arg = } @@ -2196,36 +2159,27 @@ AddContraction-Spec-Symm { t._ = s.OpenFlag; } : s.OpenFlag^ - = ( - s.OpenFlag - > - ) - > - () -} - -/* - Применение сужения к другому сужению - - == t.OtherContr^ -*/ - -ApplyContraction-toContraction { - t.Contr (t.Var ':' e.Right) - = (t.Var ':' ); + = (s.OpenFlag e.Contrs t.toAdd) + + (e.Assigns); } /* Применение сужения к присваиванию - == e.Assigns^ */ - -ApplyContraction-toAssign { - t.Contraction (e.Expr ':' t.Rval) - = : e.Expr^ - = : e.Expr^ - = (e.Expr ':' t.Rval); +ApplyContractions-toAssigns { + (e.Contrs) (e.Assigns) + = : e.Expr^ + = : e.Expr^ + = (e.Expr ':' t.Var) + } + e.Assigns + > } /* diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 51c91483..d1288d0d 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -8,7 +8,7 @@ $EXTERN DisplayName; *$FROM TreeUtils $EXTERN AddSuffix, ExtractVariables-Expr, NewVarName, ExtractVariables, - IsHardExpr; + ApplyContractions, IsHardExpr; *$FROM GenericMatch $EXTERN Solve-Spec, GenericMatch; @@ -941,9 +941,8 @@ CreateNewSentences { = : e.Contrs^ = : e.Assigns^ - = : e.Pat^ + = : e.Pat^ = : e.Tail^ = (e.NewSentences ((e.Pat) e.Tail)); @@ -964,13 +963,6 @@ CreateNewSentences { = e.NewSentences; } -FormatContractions { - ((Var e.ModeIndex) ':' e.Val) e.Contrs - = (e.Val ':' (e.ModeIndex)) ; - - /* пусто */ = /* пусто */; -} - FormatAssigns { (e.Val ':' (Var e.ModeIndex)) e.Assigns = (e.Val ':' (e.ModeIndex)) ; From 2b24463d69dda8d27e001ec2846af743f3f2a484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 2 Aug 2021 22:42:40 +0300 Subject: [PATCH 070/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=20ApplyAssigns=20=D0=B2=C2=A0TreeUtils.ref?= =?UTF-8?q?=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 38 ++--------------------------- src/compiler/OptTree-Spec.ref | 21 +++++----------- src/compiler/TreeUtils.ref | 33 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 51 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 2ba039e0..ffbb3ab2 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -11,7 +11,8 @@ $EXTERN OptTree-Drive-Intrinsic; $EXTERN Solve-Drive; *$FROM TreeUtils -$EXTERN ExpandClosures-Result, ApplyContractions, IsPassiveExpr, HashName; +$EXTERN ExpandClosures-Result, ApplyContractions, IsPassiveExpr, ApplyAssigns, + HashName; /** @@ -492,41 +493,6 @@ FindOptimizedCall-Term { = (e.OptFuncNames t.Found) t.AnyTerm; } -/* - == e.Expr^ -*/ - -ApplyAssigns { - e.Expr (e.Assigns) - = - } - e.Expr - > -} - -ApplyAssigns-Term { - (Brackets e.Expr) (e.Assigns) = (Brackets ); - - (CallBrackets e.Args) (e.Assigns) - = (CallBrackets ); - - (ColdCallBrackets e.Args) (e.Assigns) - = (ColdCallBrackets ); - - (ClosureBrackets e.Args) (e.Assigns) - = (ClosureBrackets ); - - (ADT-Brackets (e.Name) e.Expr) (e.Assigns) - = (ADT-Brackets (e.Name) ); - - t.T (e.B (e.Asgn ':' t.T) e.E) - = e.Asgn; - - t.T (e.Assigns) = t.T; -} - /* == e.Name */ diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index d1288d0d..9a97580c 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -8,7 +8,7 @@ $EXTERN DisplayName; *$FROM TreeUtils $EXTERN AddSuffix, ExtractVariables-Expr, NewVarName, ExtractVariables, - ApplyContractions, IsHardExpr; + ApplyContractions, ApplyAssigns, IsHardExpr; *$FROM GenericMatch $EXTERN Solve-Spec, GenericMatch; @@ -941,7 +941,6 @@ CreateNewSentences { = : e.Assigns^ = : e.Pat^ = : e.Tail^ = (e.NewSentences ((e.Pat) e.Tail)); @@ -963,24 +962,16 @@ CreateNewSentences { = e.NewSentences; } -FormatAssigns { - (e.Val ':' (Var e.ModeIndex)) e.Assigns - = (e.Val ':' (e.ModeIndex)) ; - - /* пусто */ = /* пусто */; -} - ApplySubst-Tail { - (e.Substitution) (Condition (e.ConditionName) (e.Result) (e.Pattern)) e.Tail + (e.Assigns) (Condition (e.ConditionName) (e.Result) (e.Pattern)) e.Tail = ( Condition (e.ConditionName) - () - () + () + () ) - ; + ; - (e.Substitution) (e.Result) - = (); + (e.Assigns) (e.Result) = (); } WrapVars { diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index 6951fba3..097dc775 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -319,3 +319,36 @@ ApplyContractions-Term { (e.Contrs) t.T = (e.Contrs) t.T; } + +/** + == e.Expr^ +*/ +$ENTRY ApplyAssigns { + e.Expr (e.Assigns) + = + } + e.Expr + > +} + +ApplyAssigns-Term { + (Brackets e.Expr) (e.Assigns) = (Brackets ); + + (CallBrackets e.Args) (e.Assigns) + = (CallBrackets ); + + (ColdCallBrackets e.Args) (e.Assigns) + = (ColdCallBrackets ); + + (ClosureBrackets e.Args) (e.Assigns) + = (ClosureBrackets ); + + (ADT-Brackets (e.Name) e.Expr) (e.Assigns) + = (ADT-Brackets (e.Name) ); + + t.T (e.B (e.Expr ':' t.T) e.E) = e.Expr; + + t.T (e.Assigns) = t.T; +} From 855d138e8cfa24e2e5e2f3b5122961ce0eeb0f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 3 Aug 2021 01:14:22 +0300 Subject: [PATCH 071/208] =?UTF-8?q?=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D1=81?= =?UTF-8?q?=D0=BB=D0=B5=D0=B4=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D1=81=D1=83=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D1=81=D0=BF=D0=B5=D1=86=D0=B8=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20(#259)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 2 +- src/compiler/OptTree-Spec.ref | 72 +++++++++++------------------------ 2 files changed, 23 insertions(+), 51 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index ff7e6e05..e61d42fb 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -267,7 +267,7 @@ DoGeneralize-Rec { = : (e.UsedVars^) s.VarType^ e.New = (e.UsedVars) (e.Begin e.E1 ('{'s.A'}') (Var s.VarType e.New) ('{'s.B'}') e.E2) - (e.Assigns (e.VarVal ':' (s.VarType e.New))); + ((e.VarVal ':' (Var s.VarType e.New)) e.Assigns); (e.UsedVars) t.Interval (e.Begin) ((Brackets e.Nested) e.Rest) (e.Assigns) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 9a97580c..82f716bd 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -548,7 +548,7 @@ SpecCall { = : e.NewArgument^ (e.UsedVars^) (e.Sg) - = e.ExtractedCalls : e.Sg^ + = e.Sg e.ExtractedCalls : e.Sg^ /* ищем динамическое обобщение для аргумента и образцов */ = @@ -572,7 +572,7 @@ GenEE { (Var 'e' e.Left) e.Expr (Var 'e' e.Right) (e.UsedVars) (e.Sg) = : (e.UsedVars^) 'e' e.eGen = (Var 'e' e.eGen) (e.UsedVars) - (e.Sg ((Var 'e' e.Left) e.Expr (Var 'e' e.Right) ':' ('e' e.eGen))); + (e.Sg ((Var 'e' e.Left) e.Expr (Var 'e' e.Right) ':' (Var 'e' e.eGen))); (s.Brackets e.Nested) e.Expr (e.UsedVars) (e.Sg) , Brackets ClosureBrackets : e._ s.Brackets e._ @@ -632,7 +632,7 @@ DynGenArg { Success e.Solutions (e.SgNew) (e.ArgNew) = e.ArgNew : e.ArgNew^ (Brackets e._) = e.Pat : e.Pat^ (Brackets e._) - = e.Sg : e.Sg^ + = e.SgNew e.Sg : e.Sg^ = : e.Sg^ = > + (e.Sg)> ) /* пусто */ (/* пусто */); @@ -758,7 +758,7 @@ SpecCall-NewSignature-Generalize { (e.Signature) (e.HistorySignature) /* Получает обобщённую сигнатуру для двух сигнатур */ = : e.GenSignature - = : e.ArgVars + = : e.ArgVars = : t._ e.GenSignature^ = : Clear e.NewSg @@ -774,9 +774,15 @@ SpecCall-NewSignature-Generalize { False = True; } : s.NeedRelationCheck + = + : e.NewSg^ = ) - (/* пусто */) (/* пусто */) e.Body + (e.GenSignature) (e.NewSg e.Sg) (/* пусто */) (/* пусто */) e.Body > : (e.NewArg^) (e.Sg^) (e.Solutions^) = > + (e.Sg)> ) (Function GN-Local (e.InstanceName) Sentences e.NewSentences) ( @@ -814,7 +820,7 @@ ExtractCalls-Expr { ExtractCalls-Term { (e.Calls (e.UsedVars)) (CallBrackets e.Expr) = : (e.UsedVars^) e.NewVar - = (e.Calls ((CallBrackets e.Expr) ':' (e.NewVar)) (e.UsedVars)) + = (e.Calls ((CallBrackets e.Expr) ':' (Var e.NewVar)) (e.UsedVars)) (Var e.NewVar); (e.Calls (e.UsedVars)) (Brackets e.Expr) @@ -857,50 +863,16 @@ RenameSignatureVars-Term { t.State t.OtherTerm = t.State t.OtherTerm; } -/* - Применяем левую подстановку к левым частям правой. - Это не совсем композиция подстановок, поскольку для композиции нужно - также объединять домены подстановок. -*/ -ApplySubst-Subst { - (e.FromSubstitution) e.ToSubstitution +ApplySequentalAssigns { + e.Expression (e.Assigns) = ':' t.Var); + (e.Expr ':' t.Var) = (t.Var ':' e.Expr) } - e.ToSubstitution - >; -} - -ApplySubst-Expr { - (e.Substitution) e.Expression - = ); - - (ADT-Brackets (e.Name) e.Nested) - = (ADT-Brackets - (e.Name) - ); - - (CallBrackets e.Nested) - = (CallBrackets ); - - (ClosureBrackets e.ClosureContent) - = (ClosureBrackets - - ); - - t.OtherTerm = t.OtherTerm; - } - e.Expression - >; + e.Assigns + > + : e.Contractions + = } Spec-FindInSignatures { From 053e9ca3693a8e6f109334fa0e15382ef862d68b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 11:34:39 +0300 Subject: [PATCH 072/208] =?UTF-8?q?=D0=9F=D0=BE=D1=87=D1=82=D0=B8=20=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B2=D1=8B=D0=B5=20=D0=B3=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B5=D0=B2=20=D0=B8=C2=A0=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь для CmdComment и вывода сигнатур текстовые представления выражений печатаются только в момент реального вывода. Для этого вместо самих текстовых представлений передаются функции, их возвращающие. «Почти ленивые», т.к. результат не мемоизируется, а это значит, что при некоторых условиях текстовые представления выражений могут вычисляться дважды (а именно, включён вывод в лог и -Od). --- src/compiler/Generator-Native.ref | 4 ++-- src/compiler/HighLevelRASL-GenResult-Opt.ref | 4 ++-- .../HighLevelRASL-GenResult-Simple.ref | 2 +- src/compiler/HighLevelRASL-GenSubst-Save.ref | 4 ++-- src/compiler/HighLevelRASL-GenSubst-Simple.ref | 4 ++-- src/compiler/Log.ref | 18 ++++++++++++++++-- src/compiler/LowLevelRASL-Native.ref | 2 +- src/compiler/LowLevelRASL-RASL.ref | 2 +- src/compiler/OptTree-Spec.ref | 11 +++++++---- src/compiler/README.md | 10 ++++++---- 10 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/compiler/Generator-Native.ref b/src/compiler/Generator-Native.ref index a8a1bf72..362be95c 100644 --- a/src/compiler/Generator-Native.ref +++ b/src/compiler/Generator-Native.ref @@ -129,8 +129,8 @@ GenCommand-Native { /* -------------------------------------------------------------------------*/ /* Создания глобальных объектов, общие команды */ - (e.Indent) (CmdComment e.Text) - = (e.Indent) (e.Indent '//' ); + (e.Indent) (CmdComment s.FnText) + = (e.Indent) (e.Indent '//' >); (e.Indent) (CmdCEnum-Start e.Prefix) = (e.Indent) () (e.Indent 'enum ' e.Prefix ' {'); diff --git a/src/compiler/HighLevelRASL-GenResult-Opt.ref b/src/compiler/HighLevelRASL-GenResult-Opt.ref index 738ef749..c7fdc2ce 100644 --- a/src/compiler/HighLevelRASL-GenResult-Opt.ref +++ b/src/compiler/HighLevelRASL-GenResult-Opt.ref @@ -85,8 +85,8 @@ FlatResult { GenResult-Aux { (e.Trash) (e.MarkedResult) - = (CmdComment 'TRASH:' ) - (CmdComment 'RESULT:' ) + = (CmdComment { = 'TRASH:' }) + (CmdComment { = 'RESULT:' }) /* Генерируем команды аллокаций */ diff --git a/src/compiler/HighLevelRASL-GenResult-Simple.ref b/src/compiler/HighLevelRASL-GenResult-Simple.ref index f9a2447b..0a715e04 100644 --- a/src/compiler/HighLevelRASL-GenResult-Simple.ref +++ b/src/compiler/HighLevelRASL-GenResult-Simple.ref @@ -313,5 +313,5 @@ ReplicateVar { MakeVariableComment { (s.Offset s.Mode e.Index) - = (CmdComment Offset s.Offset ': ' ); + = (CmdComment { = Offset s.Offset ': ' }); } diff --git a/src/compiler/HighLevelRASL-GenSubst-Save.ref b/src/compiler/HighLevelRASL-GenSubst-Save.ref index 0503f089..ec9692a6 100644 --- a/src/compiler/HighLevelRASL-GenSubst-Save.ref +++ b/src/compiler/HighLevelRASL-GenSubst-Save.ref @@ -493,7 +493,7 @@ DoGenSubst-GEN { (e.Vars ('e' (e.Index) s.Num)) (e.Commands (CmdComment - ' closed ' ' as range ' Offset s.Num + { = ' closed ' ' as range ' Offset s.Num } ) ) >; @@ -581,7 +581,7 @@ DoGenSubst-GEN { /* Завершение разбора. */ s.ContextOffset (Junk e.MarkedPattern) (e.Vars) (e.Commands) = s.ContextOffset (e.Vars) (e.MarkedPattern) - (CmdComment ) e.Commands; + (CmdComment { = }) e.Commands; } IncVarOffset-Saved { diff --git a/src/compiler/HighLevelRASL-GenSubst-Simple.ref b/src/compiler/HighLevelRASL-GenSubst-Simple.ref index 29a30b4d..d4f3f279 100644 --- a/src/compiler/HighLevelRASL-GenSubst-Simple.ref +++ b/src/compiler/HighLevelRASL-GenSubst-Simple.ref @@ -470,7 +470,7 @@ DoGenSubst-GEN { (e.Vars ('e' (e.Index) s.Num)) (e.Commands (CmdComment - ' closed ' ' as range ' Offset s.Num + { = ' closed ' ' as range ' Offset s.Num } ) ) >; @@ -557,6 +557,6 @@ DoGenSubst-GEN { /* Завершение разбора. */ s.ContextOffset (Junk e.MarkedPattern) (e.Vars) (e.Commands) = s.ContextOffset (e.Vars) (e.MarkedPattern) - (CmdComment ) + (CmdComment { = }) e.Commands; } diff --git a/src/compiler/Log.ref b/src/compiler/Log.ref index 73627b39..02deee22 100644 --- a/src/compiler/Log.ref +++ b/src/compiler/Log.ref @@ -67,6 +67,20 @@ $ENTRY Log-PutLine { } +/** + == [] +*/ +$ENTRY Log-PutLine-Lazy { + s.FnMessage + = + : { + /* none */ = /* do nothing */; + + s.FileHandle = ': ' >; + }; +} + + /** == e.AST */ @@ -184,8 +198,8 @@ PutRASLCommands { ; - (CmdComment e.Message) - = ; + (CmdComment s.FnMessage) + = >; /* TODO: pretty print */ (s.Command e.Args) diff --git a/src/compiler/LowLevelRASL-Native.ref b/src/compiler/LowLevelRASL-Native.ref index dcafd354..42ba1bea 100644 --- a/src/compiler/LowLevelRASL-Native.ref +++ b/src/compiler/LowLevelRASL-Native.ref @@ -124,7 +124,7 @@ ConvertDirectCommands { ; (CmdVariableDebugTable s.Mode e.Index s.Offset) e.Tail - = (CmdComment 'DEBUG: ' s.Mode '.' e.Index ': ' ) + = (CmdComment { = 'DEBUG: ' s.Mode '.' e.Index ': ' }) ; t.Command e.Tail diff --git a/src/compiler/LowLevelRASL-RASL.ref b/src/compiler/LowLevelRASL-RASL.ref index b0e81056..4f5a9216 100644 --- a/src/compiler/LowLevelRASL-RASL.ref +++ b/src/compiler/LowLevelRASL-RASL.ref @@ -140,7 +140,7 @@ ConvertInterpretCommands { } ConvertOneInterpretCommand-Simple { - (CmdComment e.Text) = /* skip comment command */; + (CmdComment s.FnText) = /* skip comment command */; (CmdUseRes) = /* пусто */; diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 82f716bd..bf611e22 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -1,7 +1,7 @@ $INCLUDE "LibraryEx"; *$FROM Log -$EXTERN Log-PutLine, Log-InlineExpr; +$EXTERN Log-PutLine, Log-PutLine-Lazy, Log-InlineExpr; *$FROM DisplayName $EXTERN DisplayName; @@ -230,8 +230,12 @@ PrintHistories { PrintHistory { ((e.Function) e.History) - = '\n' + = }> +} + +PrintHistory-Aux { + (e.Function) e.History + = 'History of ' '\n' - > } SpecUnit { diff --git a/src/compiler/README.md b/src/compiler/README.md index 57f2747e..5ed2b21f 100644 --- a/src/compiler/README.md +++ b/src/compiler/README.md @@ -433,7 +433,7 @@ | (CmdInitB0) | (CmdInitB0-Lite) | (CmdSave s.OldOffset s.NewOffset) - | (CmdComment e.Text) + | (CmdComment s.FnText) | (CmdVariableDebugTable s.Mode e.Index s.Depth s.Offset) | (CmdResetAllocator) | (CmdCopyVar s.Mode s.VarOffset s.SampleOffset @@ -492,6 +492,7 @@ s.VarOffset, s.SampleOffset ::= s.Offset s.OldOffset, s.NewOffset ::= s.Offset + == s.CHAR* s.LeftOffset, s.RightOffset ::= s.Offset s.SaveOffset ::= s.Offset s.R-Offset ::= ARG-BEGIN | s.Offset | RIGHT-EDGE @@ -566,9 +567,10 @@ сохраняют сопоставленный элемент на контексте по смещению `s.Offset`. * `(CmdSave s.OldOffset s.NewOffset)` — копирование границ диапазона `s.OldOffset` в `s.NewOffset`. - * `(CmdComment e.Text)` — соответствует однострочному комментарию - в сгенерированном коде. Содержимое `e.Text` предваряется `// ` - и выписывается в целевой файл без изменений. + * `(CmdComment s.FnText)` — соответствует однострочному комментарию + в сгенерированном коде. Вызывается функция `` без параметров, + результат вызова предваряется `// ` и выписывается в целевой файл + без изменений. * `(CmdVariableDebugTable s.Mode e.Index s.Depth s.Offset)` — формирует запись отладочной таблицы переменных (для интерактивного просмотра значений переменных в отладчике). From 4afc10f3c8477658a87cbca707ad065b947bb539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 11:38:41 +0300 Subject: [PATCH 073/208] =?UTF-8?q?=D0=9F=D0=BE=D0=B2=D1=8B=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BB=D0=B8=D0=BC=D0=B8=D1=82=20=D0=BF=D0=B0=D0=BC?= =?UTF-8?q?=D1=8F=D1=82=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=B0=D0=BC?= =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BB=D1=8F=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B0=20=D0=B4=D0=BE=C2=A0100=C2=A0000=C2=A0000=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/@refal-5-lambda-diagnostics.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/@refal-5-lambda-diagnostics.ini b/src/compiler/@refal-5-lambda-diagnostics.ini index 2f749f27..4cdb62b3 100644 --- a/src/compiler/@refal-5-lambda-diagnostics.ini +++ b/src/compiler/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 70000000 +memory-limit = 100000000 step-limit = 2000000000 idents-limit = 5000 enable-debugger = false From db1341e131278ef64d4690f3a10c776305aefab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 11:39:36 +0300 Subject: [PATCH 074/208] =?UTF-8?q?=D0=9E=D0=BF=D0=B5=D1=87=D0=B0=D1=82?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B8=C2=A0=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=B2=C2=A0src/compiler/README.md=20(#149)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/README.md b/src/compiler/README.md index 5ed2b21f..04d565ac 100644 --- a/src/compiler/README.md +++ b/src/compiler/README.md @@ -523,7 +523,7 @@ * `(CmdOpenELoop s.Direction s.RangeOffset s.VarOffset e.HiCommands)` — цикл по открытой e-переменной. * `s.Direction` — текущая реализация поддерживает только направление - слева-направо, поэтому всегла `AlgLeft`, + слева-направо, поэтому всегда `AlgLeft`, * `s.RangeOffset` — смещение диапазона, внутри которого находится открытой e-переменная, * `s.VarOffset` — смещение для открытой e-переменной, @@ -614,8 +614,8 @@ должен быть сохранён указатель на этот символ. `CmdVarSave` и `CmdRepeatedSave` используются для сопоставления c t-переменными, при этом они сохраняют начало и конец переменной (отрезка - поля зрения) в смежных ячейках контекста. - с структурной скобкой, сохраняющее указатель на узел в context. + поля зрения) в смежных ячейках контекста со структурной скобкой, + сохраняющее указатель на узел в context. * `(CmdCallSave s.Direction s.Num s.ContextOffset s.Name)` — пропуск скобок конкретизации и имени функции в нулевом диапазоне с сохранением указателей на них в контексте (выполняется после команды `CmdInitB0-Lite`). @@ -816,7 +816,7 @@ e-переменные, распределяемые последователь * `CmdConditionFuncDescrNative` — дескриптор функции-замыкания для режима прямой кодогенерации, завершает рекурсивное вычисление поля зрения. * `t.NativeDeclarationCommand` — объявление или определение чего-то на C++ - для нативного RASL’а, сюда же входят начало и конец регулярных функций + для нативного RASL’а, сюда же входят начало и конец регулярных функций на C++: * `CmdExtern` — создаёт предобъявление для дескриптора функции, * `CmdDefineIndent` — тот же смысл, что и для высокоуровневых команд; From 8f4e7061f3b45f913880c20656e8a136423eadb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 12:56:52 +0300 Subject: [PATCH 075/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B9=20?= =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D0=B3=20=D0=B2=C2=A0back-end=E2=80=99=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Generator-Native.ref | 10 +--------- src/compiler/HighLevelRASL-GenResult-Simple.ref | 2 +- src/compiler/HighLevelRASL-GenSubst-Save.ref | 2 +- src/compiler/HighLevelRASL-GenSubst-Simple.ref | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/compiler/Generator-Native.ref b/src/compiler/Generator-Native.ref index 362be95c..89a6e356 100644 --- a/src/compiler/Generator-Native.ref +++ b/src/compiler/Generator-Native.ref @@ -118,19 +118,11 @@ NameAndCookies { '"' '", COOKIE1_, COOKIE2_'; } -FormatOffsets { - e.Chars Offset s.Offset e.Text - = e.Chars ; - - e.Chars = e.Chars; -} - GenCommand-Native { /* -------------------------------------------------------------------------*/ /* Создания глобальных объектов, общие команды */ - (e.Indent) (CmdComment s.FnText) - = (e.Indent) (e.Indent '//' >); + (e.Indent) (CmdComment s.FnText) = (e.Indent) (e.Indent '//' ); (e.Indent) (CmdCEnum-Start e.Prefix) = (e.Indent) () (e.Indent 'enum ' e.Prefix ' {'); diff --git a/src/compiler/HighLevelRASL-GenResult-Simple.ref b/src/compiler/HighLevelRASL-GenResult-Simple.ref index 0a715e04..f422ae57 100644 --- a/src/compiler/HighLevelRASL-GenResult-Simple.ref +++ b/src/compiler/HighLevelRASL-GenResult-Simple.ref @@ -313,5 +313,5 @@ ReplicateVar { MakeVariableComment { (s.Offset s.Mode e.Index) - = (CmdComment { = Offset s.Offset ': ' }); + = (CmdComment { = ': ' }); } diff --git a/src/compiler/HighLevelRASL-GenSubst-Save.ref b/src/compiler/HighLevelRASL-GenSubst-Save.ref index ec9692a6..e5c0c94e 100644 --- a/src/compiler/HighLevelRASL-GenSubst-Save.ref +++ b/src/compiler/HighLevelRASL-GenSubst-Save.ref @@ -493,7 +493,7 @@ DoGenSubst-GEN { (e.Vars ('e' (e.Index) s.Num)) (e.Commands (CmdComment - { = ' closed ' ' as range ' Offset s.Num } + { = ' closed ' ' as range ' } ) ) >; diff --git a/src/compiler/HighLevelRASL-GenSubst-Simple.ref b/src/compiler/HighLevelRASL-GenSubst-Simple.ref index d4f3f279..383ce109 100644 --- a/src/compiler/HighLevelRASL-GenSubst-Simple.ref +++ b/src/compiler/HighLevelRASL-GenSubst-Simple.ref @@ -470,7 +470,7 @@ DoGenSubst-GEN { (e.Vars ('e' (e.Index) s.Num)) (e.Commands (CmdComment - { = ' closed ' ' as range ' Offset s.Num } + { = ' closed ' ' as range ' } ) ) >; From c734d62dc1c0051a9247cb963be6a8be75d7c8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 19:12:42 +0300 Subject: [PATCH 076/208] =?UTF-8?q?=D0=90=D0=BB=D0=B3=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D1=82=D0=BC=20=D0=BE=D0=B1=D0=BE=D0=B1=D1=89.=20=D1=81=D0=BE?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BA=D0=B8=20=D1=8D=D0=BA=D1=80=D0=B0=D0=BD=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20(#256,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Старый код в ObjectMatch.ref уже не используется, он будет удалён в следующем коммите для более ясной истории. Новый алгоритм выявляет большее количество предупреждений, чем старый. Автотесты демонстрируют такие случаи. --- autotests/screening-1.WARNING.ref | 13 ++++ autotests/screening-2.WARNING.ref | 13 ++++ autotests/screening-3.WARNING.ref | 15 ++++ autotests/screening-4.WARNING.ref | 13 ++++ autotests/screening-5.WARNING.ref | 13 ++++ src/compiler/GenericMatch.ref | 121 +++++++++++++++++++++++++++--- src/compiler/ObjectMatch.ref | 26 +++++++ 7 files changed, 202 insertions(+), 12 deletions(-) create mode 100644 autotests/screening-1.WARNING.ref create mode 100644 autotests/screening-2.WARNING.ref create mode 100644 autotests/screening-3.WARNING.ref create mode 100644 autotests/screening-4.WARNING.ref create mode 100644 autotests/screening-5.WARNING.ref diff --git a/autotests/screening-1.WARNING.ref b/autotests/screening-1.WARNING.ref new file mode 100644 index 00000000..b35598ba --- /dev/null +++ b/autotests/screening-1.WARNING.ref @@ -0,0 +1,13 @@ +* WARNING screening + +$ENTRY AADC { + 2 DCBD e.5 ((ADBA s.10)) e.1 e.9 5 + e.7 + 4 2 AADA (t.2) + = '$1'; + + 2 DCBD e.5 ((ADBA s.10)) e.1 t.4 5 + 10 (7 6 t.11) AD ((s.8) 10 ()) + 4 2 AADA (t.2) + = '$2'; +} diff --git a/autotests/screening-2.WARNING.ref b/autotests/screening-2.WARNING.ref new file mode 100644 index 00000000..550b309f --- /dev/null +++ b/autotests/screening-2.WARNING.ref @@ -0,0 +1,13 @@ +* WARNING screening + +$ENTRY B { + C CCBC 0 (10) () DCAD (s.3 () 1) t.11 5 DA + e.10 + 'c' DBB () e.2 s.12 0 BBB 'd' t.4 () 'd' ABCD 'c' (s.4 (s.7) () (s.7 9 8)) + = '$1'; + + C CCBC 0 (10) () DCAD (s.3 () 1) t.11 5 DA + ('b') s.3 'c' B ((e.6 4 'dc' BCC) 1 7 9) () + 'c' DBB () e.2 s.12 0 BBB 'd' t.4 () 'd' ABCD 'c' (s.4 (s.7) () (s.7 9 8)) + = '$2'; +} diff --git a/autotests/screening-3.WARNING.ref b/autotests/screening-3.WARNING.ref new file mode 100644 index 00000000..c4fa7eb0 --- /dev/null +++ b/autotests/screening-3.WARNING.ref @@ -0,0 +1,15 @@ +* WARNING screening + +$ENTRY CDACA1 { + 2 10 t.13 'b' + e.11 + 'c' + e.2 CDB t.3 2 + = '$1'; + + 2 10 'd' 'b' + e.6 s.3 'd' CD ('ba' 5) 'b' 2 e.6 3 (t.1 C ACD) e.13 CB 3 + 'c' CAD (10) D + e.2 CDB t.3 2 + = '$2'; +} diff --git a/autotests/screening-4.WARNING.ref b/autotests/screening-4.WARNING.ref new file mode 100644 index 00000000..2e2db3c2 --- /dev/null +++ b/autotests/screening-4.WARNING.ref @@ -0,0 +1,13 @@ +* WARNING screening + +$ENTRY CDACA2 { + 2 10 'db' + e.6 + s.3 CAD (10) D e.2 CDB t.3 2 + = '$1'; + + 2 10 'db' + e.6 s.3 'd' CD ('ba' 5) 'b' 2 e.6 3 (t.1 C ACD) e.13 CB 3 + 'c' CAD (10) D e.2 CDB t.3 2 + = '$2'; +} diff --git a/autotests/screening-5.WARNING.ref b/autotests/screening-5.WARNING.ref new file mode 100644 index 00000000..b3129107 --- /dev/null +++ b/autotests/screening-5.WARNING.ref @@ -0,0 +1,13 @@ +* WARNING screening + +$ENTRY BAD { + ((t.10 'b' s.12 s.12)) 10 DD 'ba' ABCB 'c' s.3 0 s.12 + e.8 + (CCCB 2 e.1 3) e.5 2 AA DCDD 1 (t.1 (t.7 8 ('c' 2)) C 'a') DBC + = '$1'; + + ((t.10 'b' s.12 s.12)) 10 DD 'ba' ABCB 'c' s.3 0 s.12 + 'd' s.1 DCCD 'c' ACBD e.8 e.8 + (CCCB 2 e.1 3) e.5 2 AA DCDD 1 (t.1 (t.7 8 ('c' 2)) C 'a') DBC + = '$2'; +} diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index e61d42fb..4df22b1f 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -39,13 +39,33 @@ $ENTRY GenericMatch { ((e.Pattern) ':' (e.LPattern)) > : { - Success (e._ () (e.Assigns)) = Clear ; + /* Если все решения без сужений, то берём первое */ + Success (e._ () (e.Assigns)) e.OtherSolutions + , : True + = Clear ; + Success e.Solutions = Contracted e.Solutions; + Failure = Failure; Undefined = Undefined; } } +AllUncontracted { + e.Solutions + = + : { + /* пусто */ = True; + e._ = False; + } +} + /** == Success t.Result* | Undefined | Failure @@ -362,6 +382,10 @@ DoAddCoordinateLabels { = (Var s.Mode e.Index) ('{'s.CoordNumber'}') >; + ((ScrVar s.Mode e.Index) e.Rest) s.CoordNumber + = (ScrVar s.Mode e.Index) ('{'s.CoordNumber'}') + >; + ((ClosureBrackets e.Inner) e.Rest) s.CoordNumber = (ClosureBrackets e.Inner) ('{'s.CoordNumber'}') >; @@ -470,6 +494,12 @@ Solve-Clashes { ) >; + /* {m} #var {n} : s.X ↦ нет решений */ + (e.UsedVars) (e.Contrs) e.ClashesStart + ((('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Var 's' e.Index))) + e.ClashesEnd (e.Assigns) + = /* нет решений */; + /* {m} (E) {n} : (P) ↦ {m} E {n} : P */ (e.UsedVars) (e.Contrs) e.ClashesStart ((('{'s.M'}') (Brackets e.LBody) ('{'s.N'}')) ':' ((Brackets e.RBody))) @@ -534,6 +564,12 @@ Solve-Clashes { , : True = /* нет решений */; + /* {m} #var {n} : (P) ↦ нет решений */ + (e.UsedVars) (e.Contrs) e.ClashesStart + ((('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Brackets e._))) + e.ClashesEnd (e.Assigns) + = /* нет решений */; + /* {m} Sym {n} : [P] ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((ADT-Brackets e._))) @@ -541,6 +577,12 @@ Solve-Clashes { , : True = /* нет решений */; + /* {m} #var {n} : [X P] ↦ нет решений */ + (e.UsedVars) (e.Contrs) e.ClashesStart + ((('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) + e.ClashesEnd (e.Assigns) + = /* нет решений */; + /* {m} t.X {n} : (P) ↦ t.X → (e.NEW) */ (e.UsedVars) (e.Contrs) e.ClashesStart ((('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) ':' ((Brackets e.PBody))) @@ -628,6 +670,12 @@ Solve-Clashes { e.ClashesEnd (e.Assigns) = /* нет решений */; + /* {m} #var {n} : Y ↦ нет решений */ + (e.UsedVars) (e.Contrs) e.ClashesStart + ((('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Symbol e._))) + e.ClashesEnd (e.Assigns) + = /* нет решений */; + /* {m} {{ &F e.X }} {n} : Pt ↦ нет решений @@ -907,7 +955,7 @@ IsVarInExpr { SplitLeftPart { /* Если E начинается на терм, то точка разбиения добавляется в начало */ ('{'s.BeginCoord'}') t.T e.Rest - , : True + , : True = ; +} + SplitLeftPart-Aux { /* Точки разбиения добавляются между двумя смежными термами */ (e.Begin) (t.T1 t.T2 e.Rest) (e.Parts) - , : True - , : True + , : True + , : True = ) (t.T2 e.Rest) @@ -937,8 +990,8 @@ SplitLeftPart-Aux { /* Точки разбиения добавляются между двумя смежными термами */ (e.Begin) (t.T1 ('{'s.Coord'}') t.T2 e.Rest) (e.Parts) - , : True - , : True + , : True + , : True = ) (t.T2 e.Rest) @@ -947,11 +1000,11 @@ SplitLeftPart-Aux { /* Если E заканчивается на терм, то точка разбиения добавляется в конец */ (e.Begin) (t.T ('{'s.Coord'}')) (e.Parts) - , : True + , : True = (e.Parts (e.Begin t.T ('sp' ('{'s.Coord'}')))); (e.Begin) (t.T e.Rest) (e.Parts) - , : True + , : True = ) (e.Rest) @@ -1014,8 +1067,8 @@ SplitSolve { ':' (t.eX e.P t.eY) ) e.ClashesEnd (e.Assigns) - , : True - , : True + , : True + , : True , t.eX : (Var 'e' e.XIndex) , t.eY : (Var 'e' e.YIndex) = : False - , : True - , : True + , : True + , : True , : False , t.eX : (Var 'e' e.XIndex) , t.eY : (Var 'e' e.YIndex) @@ -1524,6 +1577,48 @@ Solve-SymmClashes-Aux { > >; + /* {a} #var E1 {b} = {c} #var E2 {d} ↦ {a} E1 {b} = {c} E2 {d} */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (('{'s.A'}') t.Var e.E1 ('{'s.B'}') '=' ('{'s.C'}') t.Var e.E2 ('{'s.D'}')) + e.ClashesEnd (e.Assigns) + , t.Var : (ScrVar e.Var) + = + e.ClashesEnd (e.Assigns) + >; + + /* {a} #var1 E1 {b} = {c} #var2 E2 {d} ↦ решений нет */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (('{'s.A'}') t.Var1 e.E1 ('{'s.B'}') '=' ('{'s.C'}') t.Var2 e.E2 ('{'s.D'}')) + e.ClashesEnd (e.Assigns) + , t.Var1 : (ScrVar e._) + , t.Var2 : (ScrVar e._) + = /* решений нет */; + + /* {a} E1 #var {b} = {c} E2 #var {d} ↦ {a} E1 {b} = {c} E2 {d} */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (('{'s.A'}') e.E1 t.Var ('{'s.B'}') '=' ('{'s.C'}') e.E2 t.Var ('{'s.D'}')) + e.ClashesEnd (e.Assigns) + , t.Var : (ScrVar e.Var) + = + e.ClashesEnd (e.Assigns) + >; + + /* {a} E1 #var1 {b} = {c} E2 #var2 {d} ↦ решений нет*/ + (e.UsedVars) (e.Contrs) e.ClashesStart + (('{'s.A'}') e.E1 t.Var1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 t.Var2 ('{'s.D'}')) + e.ClashesEnd (e.Assigns) + , t.Var1 : (ScrVar e._) + , t.Var2 : (ScrVar e._) + = /* решений нет */; + /* ε = {m} e.X E {n} ↦ e.X → ε, ε = {m} E {n} */ (e.UsedVars) (e.Contrs) e.ClashesStart (/* пусто */ '=' ('{'s.M'}') t.eX e.E ('{'s.N'}')) @@ -2082,6 +2177,7 @@ Eq { IsSVarSubset { (Symbol s.Type e.Info) = True; (Var 's' e.Tindex) = True; + (ScrVar 's' e.Tindex) = True; (Closure e.Body) = True; (ClosureBrackets e.Context) = True; @@ -2092,6 +2188,7 @@ IsSVarSubset { IsTerm { (Var 'e' e.Index) = False; + (ScrVar 'e' e.Index) = False; /* Рассматриваем для оптимизаций встраивания, прогонки и специализации */ (CallBrackets e.Nested) = False; diff --git a/src/compiler/ObjectMatch.ref b/src/compiler/ObjectMatch.ref index 27cc9614..80b02a2c 100644 --- a/src/compiler/ObjectMatch.ref +++ b/src/compiler/ObjectMatch.ref @@ -1,5 +1,8 @@ $INCLUDE "LibraryEx"; +*$FROM GenericMatch +$EXTERN GenericMatch; + *$FROM TreeUtils $EXTERN ExtractVariables, NewVarName; @@ -20,6 +23,29 @@ $EXTERN ExtractVariables, NewVarName; */ $ENTRY ObjectMatch { + (e.Pattern) (e.LPattern) + = : e.Pattern^ + = +} + +ScreenVars { + e.Expression + = ); + + (ADT-Brackets (e.Name) e.Nested) + = (ADT-Brackets (e.Name) ); + + t.Other = t.Other; + } + e.Expression + >; +} + +$ENTRY ObjectMatch_ { (e.Pattern) (e.LPattern) = ) From 2c9e765e54ae05b3379fc9478e68d6aed3513924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 19:18:25 +0300 Subject: [PATCH 077/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D1=91=D0=BD=20=D1=81=D1=82=D0=B0=D1=80=D1=8B=D0=B9=20=D0=B0?= =?UTF-8?q?=D0=BB=D0=B3=D0=BE=D1=80=D0=B8=D1=82=D0=BC=20=D0=B2=C2=A0Object?= =?UTF-8?q?Match.ref=20(#256,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/ObjectMatch.ref | 642 ----------------------------------- 1 file changed, 642 deletions(-) diff --git a/src/compiler/ObjectMatch.ref b/src/compiler/ObjectMatch.ref index 80b02a2c..55c95554 100644 --- a/src/compiler/ObjectMatch.ref +++ b/src/compiler/ObjectMatch.ref @@ -3,9 +3,6 @@ $INCLUDE "LibraryEx"; *$FROM GenericMatch $EXTERN GenericMatch; -*$FROM TreeUtils -$EXTERN ExtractVariables, NewVarName; - /** @@ -44,642 +41,3 @@ ScreenVars { e.Expression >; } - -$ENTRY ObjectMatch_ { - (e.Pattern) (e.LPattern) - = ) - ((e.Pattern) ':' (e.LPattern)) - > - : { - Success (() (e.Assigns)) = Clear ; - Success e.Solutions = Contracted e.Solutions; - Failure = Failure; - Undefined = Undefined; - } -} - -/* - - == Success t.Result* | Undefined | Failure - - t.Contr ::= (t.Var ':' e.Val) - t.Equation ::= ((e.Expr) ':' (e.LExpr)) - t.Assign ::= (e.Val ':' t.Var) - t.Result ::= ((t.Contr*) (t.Assign*)) -*/ - -Solve { - (e.UsedVars) ((e.Expr) ':' (e.Lexpr)) - = - : { - = Failure; - e.B Undefined e.A = Undefined; - e.Other = Success - }; -} - -FormatAssigns { - e.Assigns = - -} - -IsSVarSubset { - (Symbol s.Type e.Info) = True; - (Var 's' e.Tindex) = True; - (Closure e.Body) = True; - (ClosureBrackets e.Context) = True; - - t.OtherTerm = False; -} - -/* Преобразует формат результата функции Solve-Aux к формату Solve */ - -CombineResults { - (e.Solutions) Success (e.Contrs) (e.Assigns) e.Rest - = ; - (e.Solutions) /* пусто */ = e.Solutions -} - -Eq { - (e.X) (s.X) = True; - e.Other = False -} - -/* - Проверка наличия повторных переменных в присваиваниях - - == True | False -*/ - -HasRepeatedVarsAssigns { - (e.B (e.Expr ':' t.Var) e.M) (e.L t.Var e.R) = True; - (e.Lexpr) (e.RVars) = False -} - -/* Постобработка результатов решения уравнений - - - == Success (t.Contraction*) (t.Assign*) | Undefined -*/ - -Solution-PostProcess { - /* - если есть идентичные присваивания, то удалаяем их - */ - (e.Contractions) (e.Assigns) - , e.Assigns - : e.B (e.Expr ':' (Var e.HIndex)) e.M (e.Expr ':' (Var e.HIndex)) e.E - = ; - - /* - Если есть непротиворечивые присваивания вида: - (s.A <- v.B) и (s.C <- v.B) то добавляется сужение (s.C -> v.A) - и второе присваивание удаляется - */ - - (e.Contractions) (e.Assigns) - , e.Assigns - : e.B - ((Var 's' e.Index1) ':' (Var e.HIndex)) - e.M - ((Var 's' e.Index2) ':' (Var e.HIndex)) - e.E - = - >; - - /* - Если есть присваивания вида: - (s.A <- v.B) и (X <- v.B) то добавляем сужение (v.A -> X) - и удаляем первое присваивание - */ - - (e.Contractions) (e.Assigns) - , e.Assigns - : e.B - ((Var 's' e.PIndex) ':' (Var e.HIndex)) - e.M - ((Symbol s.Type e.Info) ':' (Var e.HIndex)) - e.E - = - >; - - (e.Contractions) (e.Assigns) - , e.Assigns - : e.B - ((Symbol s.Type e.Info) ':' (Var e.HIndex)) - e.M - ((Var 's' e.PIndex) ':' (Var e.HIndex)) - e.E - = - >; - - /* - Если есть непротиворечивые присваивания вида: - (X <- v.A) (X <- v.A) то удаляем одно из них - */ - - (e.Contractions) (e.Assigns) - , e.Assigns - : e.B - ((Symbol s.Type e.Info) ':' (Var e.HIndex)) - e.M - ((Symbol s.Type e.Info) ':' (Var e.HIndex)) - e.E - = ; - - /* - Если есть противоречивые присваивания вида: - (X <- s.A) и (Y <- s.A) то ничего не возвращаем - */ - - (e.Contractions) (e.Assigns) - , e.Assigns - : e.B - ((Symbol e.Info1) ':' (Var e.HIndex)) - e.M - ((Symbol e.Info2) ':' (Var e.HIndex)) - e.E - = /* пусто, т.к. противоречие */; - - /* - если есть идентичные сужения, то удаляем их - */ - - (e.Contractions) (e.Assigns) - , e.Contractions - : e.B - (e.Expr ':' (Var e.HIndex)) - e.M - (e.Expr ':' (Var e.HIndex)) - e.E - = ; - - - (e.Contractions) (e.Assigns) - , e.Assigns - : e.B - (e.Expr1 ':' (Var e.HIndex)) - e.M - (e.Expr2 ':' (Var e.HIndex)) - e.E - = Undefined; - - /* - Здесь намеренно не рассмотрены случаи вида - {{ &F\1 … }} ← var && s.X ← var, - поскольку они приводят к бессмысленным сужениям вида - s.X → {{ &F\1 … }} - */ - - - (e.Contractions) (e.Assigns) = Success (e.Contractions) (e.Assigns) -} - -/* - - == t.Result* - - t.Contr ::= (t.Var ':' e.Val) - t.Equation ::= ((e.Expr) ':' (e.LExpr)) - t.Assign ::= (e.Val ':' t.Var) - t.Result ::= Success ((t.Contr*) (t.Assign*)) | Undefined -*/ - -Solve-Aux { - /* В начале системы уравнение вида T E : Lt Le */ - (e.UsedVars) (e.Contrs) ((t.Pt e.Pe) ':' (t.Ht e.He)) e.Equations (e.Assigns) - , : True - , : True - = - : { - Success e.PRTC = ; - Failure = - }; - - /* В начале системы уравнение вида E T: Le Lt */ - (e.UsedVars) (e.Contrs) ((e.Pe t.Pt) ':' (e.He t.Ht)) e.Equations (e.Assigns) - , : True - , : True - = - : { - Success e.PRTC = ; - Failure = - }; - - /* Если уравнение имеет вид Expr: e.x, добавляем присванивание - вида Expr <- e.x */ - (e.UsedVars) (e.Contrs) ((e.Pe) ':' ((Var 'e' e.Idx))) - e.Equations (e.Assigns) - = ; - - /* Если уравнение имеет вид e.i* : empty, возвращаем результат, - предварительно добавив пустые сужения - */ - (e.UsedVars) (e.Contrs) ((e.Pt) ':' ()) e.Equations (e.Assigns) - , - : { - True - = : e.NewContrs - = - >; - - False = /* нет решений */; - }; - - /* Уравнения вида E : e.x P' e.y - Перебираем все возможные разбиения - E -> E' E'' - и решаем уравнения - E'' : P' e.Y - */ - (e.UsedVars) - (e.Contrs) - ((e.E) ':' (t.Ex e.Pe t.Ey)) e.Equations - (e.Assigns) - , : True - , : True - = - : { - Success (e.NewContrs) (e.NewAssigns) - = ; - - Undefined = Undefined; - }; - - /* Если уравнение имеет вид empty: Lt Le, ничего не возвращаем */ - (e.UsedVars) (e.Contrs) (() ':' (t.Ht e.He)) e.Equations (e.Assigns) - , : True - = /* противоречие */; - - /* Если уравнение имеет вид empty: Le Lt, ничего не возвращаем */ - (e.UsedVars) (e.Contrs) (() ':' (e.He t.Ht)) e.Equations (e.Assigns) - , : True - = /* противоречие */; - - (e.UsedVars) (e.Contrs) (e.Assigns) - = ; - - e.Other - = Undefined -} - - -/* - Перебираем все возможные разбиения - E -> E' E'' - и решаем уравнения - E'' : P' e.Y -*/ - -Solve-Iter { - (e.UsedVars) - (e.Contrs) - ((t.Ess e.Ess) ':' (e.Pe t.Ey)) - (e.Assigns) - = - : { - /* пусто */ = Undefined; - - Success (e.Contrs^) (e.Assigns^) - = Success (e.Contrs) (e.Assigns); - - Undefined - = ; - }; - - (e.UsedVars) - (e.Contrs) - (() ':' (e.Pe t.Ey)) - (e.Assigns) - = Undefined; -} - - -/* - Решает уравнение вида P:H для термов - - - == t.Result - - t.Result ::= Success t.PRTC | Failure - e.PRTC :: = (t.Contrs*) t.Equations* (t.Assigns*) - - PRTC - partially resolved term clash -*/ - -Solve-TermEquation { - /* H является символом */ - (e.UsedVars) t.Symbol t.Symbol e.PRTC - , t.Symbol : (Symbol s.Type e.Info) - = Success (e.UsedVars) e.PRTC - /* нет подстановок, нет сужений */; - - /* P - символ, H - s-переменная */ - (e.UsedVars) t.Symbol t.Svar (e.Contrs) e.Equations (e.Assigns) - , : True - , t.Svar : (Var 's' e.Hindex) - = Success - (e.UsedVars) - (e.Contrs) e.Equations - (e.Assigns (t.Symbol ':' t.Svar)); - - /* P - s-переменная, H - s-переменная */ - (e.UsedVars) t.PSvar t.HSvar (e.Contrs) e.Equations (e.Assigns) - , t.PSvar t.HSvar - : (Var 's' e.Pindex) (Var 's' e.Hindex) - = Success - (e.UsedVars) - (e.Contrs) - e.Equations - (e.Assigns (t.PSvar ':' t.HSvar)); - - - /* P - s-переменная, H - символ */ - (e.UsedVars) t.Svar t.Symbol (e.Contrs) e.Equations (e.Assigns) - , t.Svar : (Var 's' e.Pindex) - , : True - = Success - (e.UsedVars) - ; - - /* P - терм, H - t-переменная */ - (e.UsedVars) t.PVar t.HVar (e.Contrs) e.Equations (e.Assigns) - , t.HVar: (Var 't' e.Tindex) - = Success - (e.UsedVars) - (e.Contrs) - e.Equations - (e.Assigns (t.PVar':'(Var 't' e.Tindex))); - - /* P - t-переменная, H - скобочный терм */ - (e.UsedVars) t.PTvar (Brackets e.HBody) (e.Contrs) e.Equations (e.Assigns) - , t.PTvar : (Var 't' e.Pindex) - = - : t.NewVars 'e' e.NewIndex - = Success - t.NewVars - ; - - /* P - t-переменная, H - скобочный терм */ - (e.UsedVars) - t.PTvar (ADT-Brackets (e.Name) e.HBody) - (e.Contrs) e.Equations (e.Assigns) - , t.PTvar : (Var 't' e.Pindex) - = - : t.NewVars 'e' e.NewIndex - = Success - t.NewVars - ; - - /* P - t-переменная, H - символ */ - (e.UsedVars) t.PTvar t.Symbol (e.Contrs) e.Equations (e.Assigns) - , t.PTvar t.Symbol - : (Var 't' e.Pindex) (Symbol s.Type e.Info) - = Success - (e.UsedVars) - ; - - /* P - t-переменная, H - s-переменная */ - (e.UsedVars) t.PTvar t.HSvar (e.Contrs) e.Equations (e.Assigns) - , t.PTvar t.HSvar - : (Var 't' e.Pindex) (Var 's' e.Hindex) - = : (e.UsedVars^) 's' e.sIdx - = Success - (e.UsedVars) - ; - - /* H является (H′) */ - (e.UsedVars) - (Brackets e.TBody)(Brackets e.HBody) - (e.Contrs) e.Equations (e.Assigns) - = Success - (e.UsedVars) - (e.Contrs) e.Equations ((e.TBody) ':' (e.HBody)) - (e.Assigns); - - /* H является [H′] */ - (e.UsedVars) - (ADT-Brackets (e.Name) e.TBody)(ADT-Brackets (e.Name) e.HBody) - (e.Contrs) e.Equations (e.Assigns) - = Success - (e.UsedVars) - (e.Contrs) e.Equations ((e.TBody) ':' (e.HBody)) (e.Assigns); - - e.Other = Failure -} - -IsTerm { - (Var 'e' e.Index) = False; - - /* Рассматриваем для оптимизаций встраивания, прогонки и специализации */ - (CallBrackets e.Nested) = False; - (ColdCallBrackets e.Nested) = False; - - /* s-, t-переменная, скобки обоих видов, символ */ - t.OtherTerm = True; -} - -IsEVar { - (Var 'e' e._) = True; - t._ = False; -} - -/* - Добавление нескольких сужений к PRTC - - - == PRTC -*/ - -AddContractions { - (t.toAdd e.Rem) (e.Contractions) e.Equations (e.Assigns) = - - >; - - () e.PRTC = e.PRTC; -} - -/* - Добавление сужения к PRTC - - - == PRTC -*/ -AddContraction { - t.toAdd (e.Contractions) e.Equations (e.Assigns) = - (e.Contractions t.toAdd) - -} - - -/* - Применение сужения к PRTC - - - == t.Equation* (t.Assign*) -*/ - -ApplyContraction { - t.Contraction e.Equations (e.Assigns) = - - () -} - -/* - Применение сужения к присваиванию - - ':' t.Rval); -} - -/* - Применение сужения к уравнению - - == t.Equation -*/ - -ApplyContraction-toEquation { - t.Contraction ((e.Expr) ':' (e.Lexpr)) = - (() ':' (e.Lexpr)) -} - -/* - Применение сужения к выражению - - == e.Expr -*/ - -ApplyContraction-toExpr { - (t.Var ':' e.Lval) e.B t.Var e.E = - - e.Lval - ; - - t.Contraction e.B (Brackets e.M) e.E = - - (Brackets ) - ; - - t.Contraction e.B (ADT-Brackets e.M) e.E = - - (ADT-Brackets ) - ; - - t.Contraction e.Expr = e.Expr -} - -/* Проверка на последовательность свободных переменных */ - -IsFreeVariableSeq { - /* пусто */ = True; - - (Var 'e' e.Idx) e.Rem = ; - - t.Other e.Rem = False -} From 87b68643a59634bb79bae61bbdc4bb0366c94d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 19:19:41 +0300 Subject: [PATCH 078/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=83=D1=82=D0=BE=D1=87=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B5?= =?UTF-8?q?=D0=B2=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker-Screening.ref | 2 +- src/compiler/GenericMatch.ref | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index 9218905b..90c08c9d 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -492,7 +492,7 @@ ReplaceADTBrackets { /* - + == True == False diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 4df22b1f..45724d95 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -511,7 +511,7 @@ Solve-Clashes { e.ClashesEnd (e.Assigns) >; - /* {m} [X E] {n} : [X P] ↦ {m} E {n} : P */ + /* {m} [X E] {n} : [X P] ↦ {m} [X E] {n} : P */ (e.UsedVars) (e.Contrs) e.ClashesStart ( (('{'s.M'}') (ADT-Brackets (e.Name) e.LBody) ('{'s.N'}')) @@ -570,7 +570,7 @@ Solve-Clashes { e.ClashesEnd (e.Assigns) = /* нет решений */; - /* {m} Sym {n} : [P] ↦ нет решений */ + /* {m} Sym {n} : [X P] ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((ADT-Brackets e._))) e.ClashesEnd (e.Assigns) From acebd86bed1226335f371cb535906f2051ddaa63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 19:25:41 +0300 Subject: [PATCH 079/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20ObjectMatch=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=D0=B0=20=D0=B2=C2=A0?= =?UTF-8?q?Checker-Screening.ref=20(#256,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker-Screening.ref | 25 ++++++++++++++--- src/compiler/ObjectMatch.ref | 43 ------------------------------ 2 files changed, 22 insertions(+), 46 deletions(-) delete mode 100644 src/compiler/ObjectMatch.ref diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index 90c08c9d..186c3a0f 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -3,9 +3,6 @@ $INCLUDE "LibraryEx"; *$FROM GenericMatch $EXTERN GenericMatch; -*$FROM ObjectMatch -$EXTERN ObjectMatch; - *$FROM GlobalGen $EXTERN GlobalGen; @@ -522,6 +519,28 @@ CheckEveryMatch { /* пусто */ (e.Assigns) = True (e.Assigns); } +ObjectMatch { + (e.Pattern) (e.LPattern) + = : e.Pattern^ + = +} + +ScreenVars { + e.Expression + = ); + + (ADT-Brackets (e.Name) e.Nested) + = (ADT-Brackets (e.Name) ); + + t.Other = t.Other; + } + e.Expression + >; +} /* diff --git a/src/compiler/ObjectMatch.ref b/src/compiler/ObjectMatch.ref deleted file mode 100644 index 55c95554..00000000 --- a/src/compiler/ObjectMatch.ref +++ /dev/null @@ -1,43 +0,0 @@ -$INCLUDE "LibraryEx"; - -*$FROM GenericMatch -$EXTERN GenericMatch; - - -/** - - == Clear (e.Val ':' t.Var)* - == Contracted ((t.Var ':' e.Val)* (e.Val ':' t.Var))* - == Failure - == Undefined - - e.Pattern, e.LPattern ::= t.PatternTerm* - t.PatternTerm — см. src/compiler/README.md - - e.Val ::= t.PatternTerm* - t.Var ::= (s.VarType e.Index) - s.VarType ::= 's' | 't' | 'e' -*/ - -$ENTRY ObjectMatch { - (e.Pattern) (e.LPattern) - = : e.Pattern^ - = -} - -ScreenVars { - e.Expression - = ); - - (ADT-Brackets (e.Name) e.Nested) - = (ADT-Brackets (e.Name) ); - - t.Other = t.Other; - } - e.Expression - >; -} From 86a852de22bb1a1fe37047c40021a44baafead60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 19:58:24 +0300 Subject: [PATCH 080/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D1=91=D0=BD=20=D0=BA=D0=BE=D1=81=D1=82=D1=8B=D0=BB?= =?UTF-8?q?=D1=8C=20=D1=81=C2=A0=D0=BA=D0=B2=D0=B0=D0=B4=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BD=D1=8B=D0=BC=D0=B8=20=D1=81=D0=BA=D0=BE=D0=B1=D0=BA=D0=B0?= =?UTF-8?q?=D0=BC=D0=B8=20(#256,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker-Screening.ref | 53 ++++++++++++++++++------------ 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index 186c3a0f..d51d5049 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -453,8 +453,6 @@ PatternLanguagesCheck { (e.Pattern-L) (e.Pattern-R) , : e.FlattenedPattern-R , : True - = : e.Pattern-R^ - = : e.Pattern-L^ = : e.Pattern-R^ = : e.Generalized = : e.Generalized^ @@ -468,25 +466,6 @@ PatternLanguagesCheck { = False; } -/* - Заменяет АДТ-скобки -*/ -ReplaceADTBrackets { - e.Pattern - = )); - - (Brackets e.Inner) - = (Brackets (Symbol Char '*') ); - - t.Other = t.Other; - } - e.Pattern - >; -} - /* @@ -618,6 +597,11 @@ RenameVars { s.Count (Brackets e.Other) = (Brackets ) e.Other>); + s.Count (ADT-Brackets (e.Name) e.Other) + = + (ADT-Brackets (e.Name) + ) e.Other> + ); s.Count t.Other = s.Count t.Other; } @@ -661,6 +645,8 @@ DeleteMarkup { (Float t.Item) = t.Item; (Anchor t.Item) = t.Item; (MarkedBrackets e.Brackets) = (Brackets ); + (MarkedADTBrackets (e.Name) e.Brackets) + = (ADT-Brackets (e.Name) ); t.Item = t.Item; } @@ -728,6 +714,15 @@ InsertFakeEVars { e.Suffix >; + e.Prefix + (ADT-Brackets (e.Name) e.Brackets) + e.Suffix + = ) + e.Suffix + >; + e.Other = e.Other; } @@ -761,6 +756,15 @@ MarkupNeighbourHelper { (e.Suffix) >; + (e.Prefix) ((ADT-Brackets (e.Name) e.Brackets) e.Suffix) + = ) + ) + (e.Suffix) + >; + (e.Prefix) (t.Item e.Suffix) = ); + (ADT-Brackets (e.Name) e.Brackets) + = (ADT-Brackets (e.Name) + + ); + t.Other = t.Other; } e.Pattern @@ -982,6 +991,8 @@ FlattenPattern { (Brackets e.Inner) = ; + (ADT-Brackets (e.Name) e.Inner) = ; + t.Other = t.Other; } e.Pattern From 5522663c1ceb83b12d5260fa36b1a3b1dfc84ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 20:49:01 +0300 Subject: [PATCH 081/208] =?UTF-8?q?=D0=A3=D0=BF=D1=80=D0=BE=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B2=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=8F=D0=B7=D1=8B=D0=BA=D0=BE=D0=B2=20=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B7=D1=86=D0=BE=D0=B2=20(#256,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Выделять кортежи и сопоставлять отдельно элементы кортежей нет необходимости. Если два выражения являются уточнением одного жётского выражения, то при обобщённом сопоставлении с образцом их обобщение выделится сразу несколькими «транзитными» шагами. --- src/compiler/Checker-Screening.ref | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index d51d5049..2505c85d 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -454,13 +454,11 @@ PatternLanguagesCheck { , : e.FlattenedPattern-R , : True = : e.Pattern-R^ - = : e.Generalized - = : e.Generalized^ - = : Clear e.Tuple-R - = : Clear e.Tuple-L - = : e.Tuples - = ; - + = + : { + Clear e._ = True; + e._ = False; + }; (e.Pattern-L) (e.Pattern-R) = False; From 4283a70d43be0f6713fa37dd22f4b05114506fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 20:52:41 +0300 Subject: [PATCH 082/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B5=D0=B8=D1=81=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=B7=D1=83=D0=B5=D0=BC=D1=8B=D0=B5=20=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D0=B8=20(#256,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Удаление сделано отдельным коммитом ради упрощения чтения истории. --- src/compiler/Checker-Screening.ref | 160 +---------------------------- 1 file changed, 2 insertions(+), 158 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index 2505c85d..60c7601a 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -3,9 +3,6 @@ $INCLUDE "LibraryEx"; *$FROM GenericMatch $EXTERN GenericMatch; -*$FROM GlobalGen -$EXTERN GlobalGen; - *$FROM Desugaring $EXTERN CreateContext, RemovePos-Expr, ExtractVariables-Expr, Pass-EnumerateVariables, Pass-RemovePos; @@ -454,7 +451,8 @@ PatternLanguagesCheck { , : e.FlattenedPattern-R , : True = : e.Pattern-R^ - = + = : e.Pattern-L^ + = : { Clear e._ = True; e._ = False; @@ -464,44 +462,6 @@ PatternLanguagesCheck { = False; } - -/* - - == True - == False - - t.Tuple ::= (t.Pattern-L t.Pattern-R) - - CheckEveryMatch сверяет пары кортежей. - Возвращает True, если все совпали, иначе False. -*/ -CheckEveryMatch { - ((e.Pattern-L) (e.Pattern-R)) e.Tuples (e.Assigns) - = - : { - Clear e.NewAssigns - = - : { - Success e.UpdatedAssigns - = ; - - Fails - = False; - }; - - e.Other - = False; - }; - - /* пусто */ (e.Assigns) = True (e.Assigns); -} - -ObjectMatch { - (e.Pattern) (e.LPattern) - = : e.Pattern^ - = -} - ScreenVars { e.Expression = ; } -/* - - == Success t.Assign* - == Fails - - AppendAssigns пополняет список присваиваний новыми. - Если новое присваивание содержится в списке, список не изменяется. - Если новое присваивание противоречит старрому, возвращается Fails. -*/ -AppendAssigns { - /* если старое значение совпало с новым */ - (e.Assigns-L (e.Vars-L ':' e.Vars-R) e.Assigns-R) - (e.Vars-L ':' e.Vars-R) e.NewAssignsTail - = ; - - /* если старое не совпало с новым */ - (e.Assigns-L (e.Vars-L ':' e.Vars-R) e.Assigns-R) - (e.Vars-L-Other ':' e.Vars-R) e.NewAssignsTail - = Fails; - - /* если новая переменная */ - (e.Assigns) - (e.Vars-L ':' e.Vars-R) e.NewAssignsTail - = ; - - (e.Assigns) /* пусто */ = Success e.Assigns; -} - -/* - - == t.Tuple* - - t.Assign ::= ((t.Pattern*) ':' (t.Pattern*)) - - CreateTuplePairs сверяет пары кортежей, - возвращает True, если все совпали, иначе False. - Правая часть выражения нормализуется. -*/ -CreateTuplePairs { - (e.Tuple-L) (e.Tuple-R) - = - >; -} - -/* - - == e.Pattern - - RenameVars добавляет суффиксы переменным, полученным из ГСО. -*/ -RenameVars { - (e.Prefix) e.Pattern - = - (Var s.Type e.Index e.Prefix 's' ); - s.Count (Brackets e.Other) - = - (Brackets ) e.Other>); - s.Count (ADT-Brackets (e.Name) e.Other) - = - (ADT-Brackets (e.Name) - ) e.Other> - ); - s.Count t.Other - = s.Count t.Other; - } - 1 e.Pattern - > - >; -} - /* == e.NormalizedPattern @@ -961,21 +832,6 @@ IsPatternLinear { = True; } -/* - - == True - == False - - IsPatternFlat возвращает True, если образец e.Pattern - плоский - (не содержит круглых скобок), иначе False. -*/ -IsPatternFlat { - e._ (Brackets e._) e._ - = False; - e._ - = True; -} - /* == (e.FlatPattern) @@ -997,18 +853,6 @@ FlattenPattern { > } -/* - - == e.GeneralizedPattern - - Generalize реконструирует общий формат двух образцов (ГСО) -*/ -Generalize { - (e.Pattern-L) (e.Pattern-R) - = : e.GlobalComplexGeneralization - = e.GlobalComplexGeneralization -} - /* == t.Warning From bd0b020795b33c8d709996cd0a8822305929634a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 21:00:04 +0300 Subject: [PATCH 083/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2=C2=A0Checker-Screening.ref=20?= =?UTF-8?q?(#256,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker-Screening.ref | 96 +++++++++++------------------- 1 file changed, 36 insertions(+), 60 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index 60c7601a..d1048555 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -416,21 +416,22 @@ CheckPatternPairs { (e.Prefix '$' ) >; - e._ = - : { - True e.Other - = ) - (e.Prefix '$' ) - >; - - False = /* пусто */; - } + e._ + = + : { + True e.Other + = ) + (e.Prefix '$' ) + >; + + False = /* пусто */; + } } } e.Pairs @@ -458,8 +459,7 @@ PatternLanguagesCheck { e._ = False; }; - (e.Pattern-L) (e.Pattern-R) - = False; + (e.Pattern-L) (e.Pattern-R) = False; } ScreenVars { @@ -604,44 +604,40 @@ InsertFakeEVars { */ MarkupNeighbourAnchorTVars { e.MarkedPattern - = ; + = ; } -MarkupNeighbourHelper { +DoMarkupNeighbourAnchorTVars { (e.Prefix) ((Var 't' e.Index) e.Suffix) , : True , : True - = ; (e.Prefix) ((Brackets e.Brackets) e.Suffix) - = ) + (Brackets ) ) (e.Suffix) >; (e.Prefix) ((ADT-Brackets (e.Name) e.Brackets) e.Suffix) - = ) + (ADT-Brackets (e.Name) ) ) (e.Suffix) >; (e.Prefix) (t.Item e.Suffix) - = ; + = ; - (e.Prefix) () - = e.Prefix; + (e.Prefix) () = e.Prefix; } /* @@ -654,21 +650,11 @@ MarkupNeighbourHelper { (2-ая часть определения) */ HasAnchorsPrefix { - e.Prefix (Anchor (Var 't' e.Index)) - = True; - - e.Prefix (Symbol s.Mode e.Index) - = True; - - e.Prefix (Var 'e' e.Index) - = False; - - e.Prefix (Brackets e._) - = True; - - e.Prefix t.Other - = ; - + e.Prefix (Anchor (Var 't' e.Index)) = True; + e.Prefix (Symbol s.Mode e.Index) = True; + e.Prefix (Var 'e' e.Index) = False; + e.Prefix (Brackets e._) = True; + e.Prefix t.Other = ; /* пусто */ = True; } @@ -682,21 +668,11 @@ HasAnchorsPrefix { (2-ая часть определения) */ HasAnchorsSuffix { - (Anchor (Var 't' e.Index)) e.Suffix - = True; - - (Symbol s.Mode e.Index) e.Suffix - = True; - - (Var 'e' e.Index) e.Suffix - = False; - - (Brackets e._) e.Suffix - = True; - - t.Other e.Suffix - = ; - + (Anchor (Var 't' e.Index)) e.Suffix = True; + (Symbol s.Mode e.Index) e.Suffix = True; + (Var 'e' e.Index) e.Suffix = False; + (Brackets e._) e.Suffix = True; + t.Other e.Suffix = ; /* пусто */ = True; } From fe5e525e7113507042b030f5473f872c00e330a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 7 Aug 2021 23:53:42 +0300 Subject: [PATCH 084/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=B1=D0=B5=D1=81=D0=BF=D0=BE=D0=BB=D0=B5?= =?UTF-8?q?=D0=B7=D0=BD=D0=BE=D0=B5=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BB=D0=BE?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=20(#256,=20#369)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker-Screening.ref | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index d1048555..d53bf451 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -401,13 +401,6 @@ CheckPatternPairs { (e.ContextVars e.Pattern-R) > : { - e._, (e.Pattern-L) (e.Pattern-R) : () () - = ) - (e.Prefix '$' ) - >; Clear e._ = Date: Sun, 8 Aug 2021 00:07:26 +0300 Subject: [PATCH 085/208] =?UTF-8?q?=D0=9D=D0=B5=D0=BA=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D1=8B=D0=B9=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20=D0=B2=C2=A0Checker-Screening.ref=20?= =?UTF-8?q?(#256,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker-Screening.ref | 43 +++++++++++------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index d53bf451..b74125f6 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -396,36 +396,24 @@ CheckPatternPairs { (((e.Pattern-L) e._ (e._) (e._)) s.Num-L) (((e.Pattern-R) e._ (e._) (e._)) s.Num-R) ) - = + = e.ContextVars e.Pattern-L : e.Pattern-L^ + = e.ContextVars e.Pattern-R : e.Pattern-R^ + = e.Prefix '$' : e.R-id + = e.Prefix '$' : e.L-id + = /* пусто */ : { - Clear e._ + , : Clear e._ = ) - (e.Prefix '$' ) + t.SrcPos (e.FuncName) (e.R-id) (e.L-id) >; - e._ - = - : { - True e.Other - = ) - (e.Prefix '$' ) - >; - - False = /* пусто */; - } - } + , : True + = ; + + = /* нет предупреждений */; + } } e.Pairs >; @@ -434,8 +422,7 @@ CheckPatternPairs { } /* - - == t.Warning* + == s.Bool PatternLanguagesCheck проверяет пару предложений на экранирование алгоритмом, основанном на языках образцов. From 5b3afb85687869a3dd78aa5d69e29b53e2d1cb90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 8 Aug 2021 09:01:47 +0300 Subject: [PATCH 086/208] =?UTF-8?q?=D0=A1=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0:=20=D0=B4?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD=D0=BD=D0=B0=D1=8F=20=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B2=C2=A0Checker-Screening.ref=20(#256,=20#35?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker-Screening.ref | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index b74125f6..d81799e7 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -165,8 +165,10 @@ FilterConditions { ( t.NumberedSentence-L - ((t.Pattern e._ (e._ (CallBrackets e.1) e._) ((Sentences e.2) e._)) s.Num) - + ( + (t.Pattern e._ (e._ (CallBrackets e._) e._) ((Sentences e._) e._)) + s.Num + ) ) = /* пусто */; From 8ed78e9cc52d476558e49624c519711d3d6ddc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 8 Aug 2021 12:10:47 +0300 Subject: [PATCH 087/208] =?UTF-8?q?=D0=9C=D0=B8=D0=BD=D0=B8=D0=BE=D0=BF?= =?UTF-8?q?=D1=82=D0=B8=D0=BC=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20Solve-SymClashes-Aux=20(?= =?UTF-8?q?#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Вместо трёх разных предложений, рассматривающих случай перем = перем используется одно предложение --- src/compiler/GenericMatch.ref | 165 +++------------------------------- 1 file changed, 14 insertions(+), 151 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 45724d95..b9eba76b 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -1414,163 +1414,26 @@ Solve-SymmClashes { >; } -Solve-SymmClashes-Aux { - /* {a} e.X {b} = {c} e.Y {d} ↦ e.X → e.NEW, e.Y → e.NEW */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.eX ('{'s.B'}') '=' ('{'s.C'}') t.eY ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.eX : (Var 'e' e.XIndex) - , t.eY : (Var 'e' e.YIndex) - = : (e.UsedVars^) 'e' e.New - = (Var 'e' e.New) : t.eNew - = - >; - - /* {a} e.X {b} = {c} t.Y {d} ↦ e.X → t.NEW, t.Y → t.NEW */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.eX ('{'s.B'}') '=' ('{'s.C'}') t.tY ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.eX : (Var 'e' e.XIndex) - , t.tY : (Var 't' e.YIndex) - = : (e.UsedVars^) 't' e.New - = (Var 't' e.New) : t.tNew - = - >; - - /* {a} t.Y {b} = {c} e.X {d} ↦ t.Y → t.NEW, e.X → t.NEW */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.tY ('{'s.B'}') '=' ('{'s.C'}') t.eX ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.eX : (Var 'e' e.XIndex) - , t.tY : (Var 't' e.YIndex) - = : (e.UsedVars^) 't' e.New - = (Var 't' e.New) : t.tNew - = - >; - - /* {a} e.X {b} = {c} s.Y {d} ↦ e.X → s.NEW, s.Y → s.NEW */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.eX ('{'s.B'}') '=' ('{'s.C'}') t.sY ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.eX : (Var 'e' e.XIndex) - , t.sY : (Var 's' e.YIndex) - = : (e.UsedVars^) 's' e.New - = (Var 's' e.New) : t.sNew - = - >; - - /* {a} s.Y {b} = {c} e.X {d} ↦ s.Y → s.NEW, e.X → s.NEW */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.sY ('{'s.B'}') '=' ('{'s.C'}') t.eX ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.eX : (Var 'e' e.XIndex) - , t.sY : (Var 's' e.YIndex) - = : (e.UsedVars^) 's' e.New - = (Var 's' e.New) : t.sNew - = - >; - - /* {a} t.X {b} = {c} t.Y {d} ↦ t.X → t.NEW, t.Y → t.NEW */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.tX ('{'s.B'}') '=' ('{'s.C'}') t.tY ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.tX : (Var 't' e.XIndex) - , t.tY : (Var 't' e.YIndex) - = : (e.UsedVars^) 't' e.New - = (Var 't' e.New) : t.tNew - = - >; - - /* {a} t.X {b} = {c} s.Y {d} ↦ t.X → s.NEW, s.Y → s.NEW */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.tX ('{'s.B'}') '=' ('{'s.C'}') t.sY ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.tX : (Var 't' e.XIndex) - , t.sY : (Var 's' e.YIndex) - = : (e.UsedVars^) 's' e.New - = (Var 's' e.New) : t.sNew - = - >; - - /* {a} s.Y {b} = {c} t.X {d} ↦ s.Y → s.NEW, t.X → s.NEW */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.sY ('{'s.B'}') '=' ('{'s.C'}') t.tX ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.tX : (Var 't' e.XIndex) - , t.sY : (Var 's' e.YIndex) - = : (e.UsedVars^) 's' e.New - = (Var 's' e.New) : t.sNew - = - >; +MinMode { + e._ ('s' e.Index) e._ = 's' e.Index; + e._ ('t' e.Index) e._ = 't' e.Index; + ('e' e.Index) ('e' e._) = 'e' e.Index; +} - /* {a} s.X {b} = {c} s.Y {d} ↦ s.X → s.NEW, s.Y → s.NEW */ +Solve-SymmClashes-Aux { + /* {a} u.X {b} = {c} v.Y {d} ↦ u.X → w.NEW, v.Y → w.NEW, w = min(u,v) */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.sX ('{'s.B'}') '=' ('{'s.C'}') t.sY ('{'s.D'}')) + (('{'s.A'}') t.uX ('{'s.B'}') '=' ('{'s.C'}') t.vY ('{'s.D'}')) e.ClashesEnd (e.Assigns) - , t.sX : (Var 's' e.XIndex) - , t.sY : (Var 's' e.YIndex) - = : (e.UsedVars^) 's' e.New - = (Var 's' e.New) : t.sNew + , t.uX : (Var s.uMode e.XIndex) + , t.vY : (Var s.vMode e.YIndex) + = : s.wMode e.wIndex + = : (e.UsedVars^) e.wNew + = (Var e.wNew) : t.wNew = Date: Sun, 8 Aug 2021 12:39:34 +0300 Subject: [PATCH 088/208] =?UTF-8?q?FIXED:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=B7=D0=B0=D1=86=D0=B8=D0=BA?= =?UTF-8?q?=D0=BB=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B2=C2=A0Solve-?= =?UTF-8?q?SymClashes-Aux=20(#256,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ошибка была в том, что для клэшей вида (ScrVar …) = ‹один-терм› не было ни одного применимого правила, кроме правила отщепления термов. Из-за этого единственный терм отщеплялся в цикле вечно. --- src/compiler/GenericMatch.ref | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index b9eba76b..e8a27229 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -1453,14 +1453,6 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) >; - /* {a} #var1 E1 {b} = {c} #var2 E2 {d} ↦ решений нет */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Var1 e.E1 ('{'s.B'}') '=' ('{'s.C'}') t.Var2 e.E2 ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.Var1 : (ScrVar e._) - , t.Var2 : (ScrVar e._) - = /* решений нет */; - /* {a} E1 #var {b} = {c} E2 #var {d} ↦ {a} E1 {b} = {c} E2 {d} */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.A'}') e.E1 t.Var ('{'s.B'}') '=' ('{'s.C'}') e.E2 t.Var ('{'s.D'}')) @@ -1474,12 +1466,28 @@ Solve-SymmClashes-Aux { e.ClashesEnd (e.Assigns) >; - /* {a} E1 #var1 {b} = {c} E2 #var2 {d} ↦ решений нет*/ + /* {a} #var E1 {b} = {c} E2 {d} ↦ решений нет */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (('{'s.A'}') (ScrVar e._) e.E1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 ('{'s.D'}')) + e.ClashesEnd (e.Assigns) + = /* решений нет */; + + /* {a} E1 {b} = {c} #var E2 {d} ↦ решений нет */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (('{'s.A'}') e.E1 ('{'s.B'}') '=' ('{'s.C'}') (ScrVar e._) e.E2 ('{'s.D'}')) + e.ClashesEnd (e.Assigns) + = /* решений нет */; + + /* {a} E1 #var {b} = {c} E2 {d} ↦ решений нет*/ + (e.UsedVars) (e.Contrs) e.ClashesStart + (('{'s.A'}') e.E1 (ScrVar e._) ('{'s.B'}') '=' ('{'s.C'}') e.E2 ('{'s.D'}')) + e.ClashesEnd (e.Assigns) + = /* решений нет */; + + /* {a} E1 {b} = {c} E2 #var2 {d} ↦ решений нет*/ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') e.E1 t.Var1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 t.Var2 ('{'s.D'}')) + (('{'s.A'}') e.E1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 (ScrVar e._) ('{'s.D'}')) e.ClashesEnd (e.Assigns) - , t.Var1 : (ScrVar e._) - , t.Var2 : (ScrVar e._) = /* решений нет */; /* ε = {m} e.X E {n} ↦ e.X → ε, ε = {m} E {n} */ From 579d202ca54747f67994a80e86c1cc358d0a0986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 8 Aug 2021 13:15:02 +0300 Subject: [PATCH 089/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2=C2=A0Desugaring.ref=20(#315,?= =?UTF-8?q?=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Desugaring.ref | 77 ++++++++++--------------------------- 1 file changed, 20 insertions(+), 57 deletions(-) diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index 6b4d88d5..3d15e0bc 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -4,7 +4,8 @@ $INCLUDE "LibraryEx"; $EXTERN Pass-UnCondition; *$FROM TreeUtils -$EXTERN NewVarName, AddSuffix, CreateContext, CreateSpecPatternForContext; +$EXTERN NewVarName, AddSuffix, CreateContext, CreateSpecPatternForContext, + ExtractVariables-Expr; $ENTRY Desugar { @@ -23,7 +24,6 @@ $ENTRY Desugar { s.ConditionsMode { Conditions-Native = /* no pass */; - Conditions-Transform = (&Pass-UnCondition s.MarkupContext); } > @@ -40,11 +40,9 @@ $ENTRY Pass-RemovePos { (Function t.SrcPos s.ScopeClass (e.Name) e.Body) = (Function s.ScopeClass (e.Name) ); - (Ident t.SrcPos e.Name) - = (Ident e.Name); + (Ident t.SrcPos e.Name) = (Ident e.Name); - (NativeBlock t.SrcPos e.Code) - = (NativeBlock t.SrcPos e.Code); + (NativeBlock t.SrcPos e.Code) = (NativeBlock t.SrcPos e.Code); (Spec t.SrcPos (e.Name) e.Pattern) = (Spec (e.Name) ); @@ -428,9 +426,7 @@ NameNestedBody { > >; - (e.MainName) NativeBody t.SrcPos e.Code - = NativeBody t.SrcPos e.Code; - + (e.MainName) NativeBody t.SrcPos e.Code = NativeBody t.SrcPos e.Code; (e.MainName) Metatable e.Metatable = Metatable e.Metatable; } @@ -522,7 +518,7 @@ Pass-RemoveBlocksAndAssigns { (Function s.ScopeClass (e.Name) e.Body) = (Function s.ScopeClass (e.Name) - + ); t.OtherProgramElement = t.OtherProgramElement; @@ -531,24 +527,16 @@ Pass-RemoveBlocksAndAssigns { >; } -RemoveAssigns-Sentences { - Sentences e.Sentences = - Sentences - ; - - NativeBody t.SrcPos e.Code = - NativeBody t.SrcPos e.Code; - +RemoveAssigns-Body { + Sentences e.Sentences = Sentences ; + NativeBody t.SrcPos e.Code = NativeBody t.SrcPos e.Code; Metatable e.Metatable = Metatable e.Metatable; } RemoveAssigns-Sentence { /* Присваивание есть синтаксический сахар — выражается через блок: - … = R : { B }… P … ---> … = R : { B }… : { P … } + … = R : { B }… : P … ---> … = R : { B }… : { P … } */ ( (e.Pattern) e.Conditions @@ -581,15 +569,10 @@ RemoveAssigns-Conditions { e.Conditions = : (e.Result^) - = (Condition - (e.ConditionName) - () - (e.Pattern) - ); + = : e.Result^ + = (Condition (e.ConditionName) (e.Result) (e.Pattern)); } e.Conditions >; @@ -620,7 +603,7 @@ RemoveAssigns-Result { = (CallBrackets ); (Closure (e.ClosureName) e.Sentences) - = (Closure (e.ClosureName) ); + = (Closure (e.ClosureName) ); t.OtherTerm = t.OtherTerm; } @@ -712,7 +695,7 @@ ExtractNested-Conditions { = : (e.BorrowedVars^) e.PatternLocalVars - = : e.LocalVars^ + = : e.LocalVars^ = + > >; } -ExtractAllVars { - (Var s.Mode e.Index) e.Tail = - (s.Mode e.Index) ; - - (Brackets e.Inner) e.Tail = ; - (ADT-Brackets e.Inner) e.Tail = ; - - t.OtherTerm e.Tail = ; - - /* пусто */ = /* пусто */; -} - -Uniq { - e.Uniqs t.Repeated e.NotScanned-M t.Repeated e.NotScanned-E = - e.Uniqs ; - - e.Uniqs = e.Uniqs; -} - UpdateBorrowedVars { e.ScopeVars (e.BorrowedVars-B (s.Mode e.Index) e.BorrowedVars-E) @@ -889,8 +853,7 @@ CheckBorrowed { (s.Mode e.Index) = (e.BorrowedVars (s.Mode e.Index)); - (e.ScopeVars) (e.BorrowedVars) (s.Mode e.Index) = - (e.BorrowedVars); + (e.ScopeVars) (e.BorrowedVars) (s.Mode e.Index) = (e.BorrowedVars); } Pass-CleanupRedudandExterns { @@ -939,7 +902,7 @@ Pass-CleanupRedudandExterns { e.AST > : (e.DefinedFunctions) e.AST^ - = + = : (e.DefinedFunctions^) e.AST^ = Date: Sun, 8 Aug 2021 14:13:37 +0300 Subject: [PATCH 090/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D1=83=D1=81=D1=82=D0=B0=D1=80=D0=B5=D0=B2?= =?UTF-8?q?=D1=88=D0=B5=D0=B5=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BB=D0=BE=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20(#315,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/HighLevelRASL.ref | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/compiler/HighLevelRASL.ref b/src/compiler/HighLevelRASL.ref index c3e8e96e..83da1f2d 100644 --- a/src/compiler/HighLevelRASL.ref +++ b/src/compiler/HighLevelRASL.ref @@ -60,8 +60,6 @@ $ENTRY HighLevelRASL { (NativeBlock t.SrcPos e.Code) = (CmdEmitNativeCode t.SrcPos e.Code); - - (Spec t.Name e.Pattern) = ; } e.ProgramElements >; From 5b869b3f04ce4ad53cf8aecca51a91c984177b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 8 Aug 2021 14:56:18 +0300 Subject: [PATCH 091/208] =?UTF-8?q?(Swap=20s.Scope=20e.Name)=20=E2=86=92?= =?UTF-8?q?=20(Function=20s.Scope=20(e.Name)=20Swap)=20(#315)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Desugaring.ref | 52 ++++++++++++++++------------------ src/compiler/HighLevelRASL.ref | 2 +- src/compiler/Log-AST.ref | 6 ++-- src/compiler/README.md | 2 +- 4 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index 3d15e0bc..e42a5978 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -14,6 +14,7 @@ $ENTRY Desugar { e.AST &Pass-CleanupRedudandExterns - &Pass-UnfoldEnums > >; } @@ -135,6 +135,22 @@ $ENTRY RemovePos-Expr { >; } +Pass-UnfoldEnumsAndSwaps { + e.AST + = ; +} + Pass-AttachEntries { e.AST = ; NativeBody t.SrcPos e.Code = NativeBody t.SrcPos e.Code; Metatable e.Metatable = Metatable e.Metatable; + Swap = Swap; } RemoveAssigns-Sentence { @@ -655,6 +666,10 @@ ExtractNestedRec { s.MarkupContext (e.ScopeVars) Metatable e.Metatable = (/* нет заимстовованных переменных */) (/* нет вложенных функций */) Metatable e.Metatable; + + s.MarkupContext (e.ScopeVars) Swap + = (/* нет заимстовованных переменных */) (/* нет вложенных функций */) + Swap; } ExtractNested-Sentence { @@ -871,12 +886,6 @@ Pass-CleanupRedudandExterns { = (e.DefinedFunctions (e.Name)) (Function s.ScopeClass (e.Name) e.Body); - (e.DefinedFunctions) (Enum s.ScopeClass e.Name) - = (e.DefinedFunctions (e.Name)) (Enum s.ScopeClass e.Name); - - (e.DefinedFunctions) (Swap s.ScopeClass e.Name) - = (e.DefinedFunctions (e.Name)) (Swap s.ScopeClass e.Name); - (e.DefinedFunctions) (Inline e.Name) = (e.DefinedFunctions) (Inline e.Name); @@ -933,16 +942,3 @@ RemoveRedundantDeclarations { (e.DefinedFunctions) t.OtherItem = (e.DefinedFunctions) t.OtherItem; } - -Pass-UnfoldEnums { - e.AST - = ; -} diff --git a/src/compiler/HighLevelRASL.ref b/src/compiler/HighLevelRASL.ref index 83da1f2d..5f2bebfe 100644 --- a/src/compiler/HighLevelRASL.ref +++ b/src/compiler/HighLevelRASL.ref @@ -50,7 +50,7 @@ $ENTRY HighLevelRASL { (Function s.ScopeClass (e.Name) Metatable e.Metatable) = (CmdMetatable s.ScopeClass (e.Name) e.Metatable); - (Swap s.ScopeClass e.Name) = + (Function s.ScopeClass (e.Name) Swap) = (CmdSwap s.ScopeClass e.Name); (Declaration s.ScopeClass e.Name) = diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index c1a4b1fa..db0e7439 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -28,9 +28,6 @@ Element { (ColdFunction s.ColdBy s.Scope (e.Name) e.Body) = ; - (Swap GN-Entry e.Name) = ('$ESWAP ' ';'); - (Swap GN-Local e.Name) = ('$SWAP ' ';'); - (Declaration GN-Entry e.Name) = ('$EXTERN ' ';'); (Declaration GN-Local e.Name) = ('$FORWARD ' ';'); @@ -111,6 +108,9 @@ Function-Aux { > ('}') (); + + (e.Name) GN-Entry Swap = ('$ESWAP ' ';'); + (e.Name) GN-Local Swap = ('$SWAP ' ';'); }; Entry { diff --git a/src/compiler/README.md b/src/compiler/README.md index 04d565ac..e5dac12d 100644 --- a/src/compiler/README.md +++ b/src/compiler/README.md @@ -320,7 +320,6 @@ t.ReducedProgramElement ::= (Function s.ScopeClass (e.Name) e.ReducedBody) - | (Swap s.ScopeClass e.Name) | (Declaration s.ScopeClass e.Name) | (Ident e.Name) | (NativeBlock t.SrcPos e.Code) @@ -330,6 +329,7 @@ Sentences t.ReducedSentence* | NativeBody t.SrcPos e.Code | Metatable e.ReducedMetatable + | Swap t.ReducedSentence ::= ((e.ReducedPattern) t.ReducedCondition* (e.ReducedResult)) t.ReducedCondition ::= From b45c4ff5a6ee981caea9079d4b9ec929c7e3f2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 8 Aug 2021 18:59:18 +0300 Subject: [PATCH 092/208] =?UTF-8?q?=D0=A1=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0:=20=D0=B4?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD=D0=BD=D0=B0=D1=8F=20=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B2=C2=A0Engine.ref=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Engine.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/Engine.ref b/src/compiler/Engine.ref index 8b1045a1..739ef912 100644 --- a/src/compiler/Engine.ref +++ b/src/compiler/Engine.ref @@ -436,7 +436,7 @@ PatchAST-Item { s.FnPatch (Include t.SrcPos e.IncludeName) = /* пропускаем */; s.FnPatch (s.Label t.SrcPos s.ScopeClass e.Name) - , : True + , Enum Swap Declaration Entry Inline Drive Intrinsic Meta : e._ s.Label e._ = (s.Label s.ScopeClass From 43016ec47a0b5898d9d05e2cf9760b0c9c932b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 8 Aug 2021 20:14:57 +0300 Subject: [PATCH 093/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2=C2=A0LowLevelRASL*.ref=20(#35?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/LowLevelRASL-RASL.ref | 6 +----- src/compiler/LowLevelRASL.ref | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/compiler/LowLevelRASL-RASL.ref b/src/compiler/LowLevelRASL-RASL.ref index 4f5a9216..53531615 100644 --- a/src/compiler/LowLevelRASL-RASL.ref +++ b/src/compiler/LowLevelRASL-RASL.ref @@ -17,11 +17,7 @@ $INCLUDE "LibraryEx"; $ENTRY LowLevelRASL-RASL { s.DebugInfo s.Hash1 s.Hash2 (t.FuncTable t.IdentTable) e.Items - = + = : (e.FuncScopeClass) e.Definitions = diff --git a/src/compiler/LowLevelRASL.ref b/src/compiler/LowLevelRASL.ref index 22997d12..e5a764ce 100644 --- a/src/compiler/LowLevelRASL.ref +++ b/src/compiler/LowLevelRASL.ref @@ -323,8 +323,8 @@ MarkFunctionGenMode { OnlyDirect (Function s.ScopeClass (e.Name) e.Commands) = (Function-ToNative s.ScopeClass (e.Name) e.Commands); - OnlyInterpret (CmdConditionFunc s.ScopeClass e.Name)= - (CmdConditionFunc-ToRASL s.ScopeClass e.Name); + OnlyInterpret (CmdConditionFunc s.ScopeClass e.Name) = + (CmdConditionFunc-ToRASL s.ScopeClass e.Name); OnlyDirect (CmdConditionFunc s.ScopeClass e.Name) = (CmdConditionFunc-ToNative s.ScopeClass e.Name); From bd98604b4d6a33017d2920406a14af6cd51a07eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 8 Aug 2021 23:28:31 +0300 Subject: [PATCH 094/208] =?UTF-8?q?=D0=A3=D0=B7=D0=B5=D0=BB=20=D0=B4=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B2=D0=B0=20(Entries=20=E2=80=A6),=20=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20s.ScopeClass=20?= =?UTF-8?q?=D0=B8=D0=B7=C2=A0=D0=BE=D1=81=D1=82=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D1=83=D0=B7=D0=BB=D0=BE=D0=B2=20(#315)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Рефакторингом это назвать нельзя, т.к. как минимум изменился подсчёт хешей единиц трансляции. Также, возможно, есть другие нейтральные изменения в сгенерированном коде (не проверял). --- src/compiler/Checker-Screening.ref | 7 +- src/compiler/Desugaring-UnCondition.ref | 14 +-- src/compiler/Desugaring.ref | 76 +++++------- src/compiler/Generator-RASL.ref | 12 +- src/compiler/HighLevelRASL-ConjointFunc.ref | 4 +- src/compiler/HighLevelRASL-DisjointFunc.ref | 5 +- src/compiler/HighLevelRASL.ref | 46 ++++--- src/compiler/Log-AST.ref | 72 +++++++---- src/compiler/Log.ref | 56 +++++---- src/compiler/LowLevelRASL-Native.ref | 49 ++++---- src/compiler/LowLevelRASL-RASL.ref | 99 +++++++++------ src/compiler/LowLevelRASL.ref | 126 ++++++++++---------- src/compiler/OptTree-AutoMarkup-Drive.ref | 46 ++++--- src/compiler/OptTree-AutoMarkup-Spec.ref | 8 +- src/compiler/OptTree-Drive-Expr.ref | 2 +- src/compiler/OptTree-Drive.ref | 56 ++++----- src/compiler/OptTree-Spec.ref | 24 ++-- src/compiler/OptTree.ref | 15 +-- src/compiler/README.md | 22 ++-- 19 files changed, 391 insertions(+), 348 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index d81799e7..659bb513 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -5,7 +5,7 @@ $EXTERN GenericMatch; *$FROM Desugaring $EXTERN CreateContext, RemovePos-Expr, ExtractVariables-Expr, - Pass-EnumerateVariables, Pass-RemovePos; + Pass-EnumerateVariables, Pass-RemovePos, Pass-ExtractEntries; /* : (e.FunctionsPos) e.AST^ = : e.AST^ - = : e.AST^ + = : e.AST-B (Entries e.Entries) e.AST-E + = : e.AST^ = : e.FunctionsWithPos = ; @@ -73,7 +74,7 @@ MakePairs { CheckFunction проверяет тело функции на экранирование. */ CheckFunction { - ((Function s.ScopeClass (e.Name) Sentences e.Sentences) t.SrcPos) + ((Function (e.Name) Sentences e.Sentences) t.SrcPos) = ) () (e.Sentences)> } diff --git a/src/compiler/Desugaring-UnCondition.ref b/src/compiler/Desugaring-UnCondition.ref index 5c8a426e..aa71c0e0 100644 --- a/src/compiler/Desugaring-UnCondition.ref +++ b/src/compiler/Desugaring-UnCondition.ref @@ -18,11 +18,11 @@ $ENTRY Pass-UnCondition { ** НАМЕРЕННО ОТКАЗЫВАЕМСЯ ОТ ОТСЛЕЖИВАНИЯ КОПИРОВАНИЯ ПОВТОРНЫХ ПЕРЕМЕННЫХ /** - + == e.NewFunctions */ UnCondition-Unit { - s.MarkupContext (Function s.Scope (e.Name) Sentences e.Sentences) + s.MarkupContext (Function (e.Name) Sentences e.Sentences) = 1 : s.SkipNo = /* пусто */ : e.RemNames @@ -34,7 +34,7 @@ UnCondition-Unit { > : (s.SkipNo^ e.RemNames^ (e.NewFunctions^)) e.Sentences^ - = (Function s.Scope (e.Name) Sentences e.Sentences) + = (Function (e.Name) Sentences e.Sentences) ; @@ -63,7 +63,7 @@ UnCondition-RemFunctions { t.RemainderName { (e.RemainderName) - = (Function GN-Local (e.RemainderName) Sentences e.Sentences); + = (Function (e.RemainderName) Sentences e.Sentences); '-' = /* пусто */; } @@ -447,7 +447,7 @@ UnCondition-Sentence { e.PatternSteps > : (e.ContSentence) e.OpenEFunctions - , (Function GN-Local (e.CheckFunction) Sentences + , (Function (e.CheckFunction) Sentences ((e.Context e.CondPattern) e.SentenceTail) e.ContSentence ) @@ -539,12 +539,12 @@ MakeOpenE-ForwardNext { (e.T1) (e.T2) (e.T3) (e.T4) (e.T5) (e.T5-sub) (e.T6) (e.T7) , e.ConditionName '?' <+ 1 s.CurrentForwardId> : e.NextName , : e.CheckFuncArgSubst - = (Function GN-Local (e.CurrentForwardName) Sentences + = (Function (e.CurrentForwardName) Sentences ((e.T1) ((CallBrackets (Symbol Name e.NextName) e.T2))) ((e.T3) ((CallBrackets (Symbol Name e.ContName) e.T4))) ) (Drive e.CurrentForwardName) - (Function GN-Local (e.NextName) Sentences + (Function (e.NextName) Sentences ( (e.T5) ((CallBrackets (Symbol Name e.CheckFunction) e.CheckFuncArgSubst)) diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index e42a5978..b6ab8f5e 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -15,7 +15,7 @@ $ENTRY Desugar { ; } -Pass-AttachEntries { +$ENTRY Pass-ExtractEntries { e.AST = ) + (Function (e.Name) e.Body); + + (e.Entries) (Drive s.ScopeClass e.Name) = (e.Entries) (Drive e.Name); + (e.Entries) (Inline s.ScopeClass e.Name) = (e.Entries) (Inline e.Name); + (e.Entries) (Intrinsic s.ScopeClass e.Name) + = (e.Entries) (Intrinsic e.Name); + (e.Entries) t.Other = (e.Entries) t.Other; } - (/* entries */) e.AST + (/* имена entry-функций */) + e.AST > : (e.Entries) e.AST^ - = ) e.AST; +} - t.Other = t.Other; - } - e.AST - >; +Entry { + GN-Entry e.Name = (e.Name); + GN-Local e.Name = /* пропускаем */; } Pass-RemoveRedundantDriveInlineIntrinsic { @@ -248,11 +246,8 @@ $ENTRY Pass-EnumerateVariables { e.AST = - ); + (Function (e.Name) e.Body) + = (Function (e.Name) ); t.OtherProgramElement = t.OtherProgramElement; } @@ -392,11 +387,8 @@ Pass-NameNestedFuncs { e.AST = ) e.Body> - ); + (Function (e.Name) e.Body) + = (Function (e.Name) ) e.Body>); t.OtherProgramElement = t.OtherProgramElement; } @@ -525,11 +517,8 @@ Pass-RemoveBlocksAndAssigns { e.AST = - ); + (Function (e.Name) e.Body) + = (Function (e.Name) ); t.OtherProgramElement = t.OtherProgramElement; } @@ -626,10 +615,10 @@ Pass-FlatNestedFuncs { s.MarkupContext e.AST = : (e.NestedFuncs) e.Body^ = e.NestedFuncs - (Function s.ScopeClass (e.Name) e.Body); + (Function (e.Name) e.Body); t.OtherProgramElement = t.OtherProgramElement; } @@ -820,7 +809,7 @@ ExtractNested-Result-Term { NativeBody e.NativeBody = /* нет меток */; } : e.DriveLabelOpt - = (Function GN-Local (e.ClosureName) e.Body) + = (Function (e.ClosureName) e.Body) e.DriveLabelOpt (e.BorrowedVars) (Symbol Name e.ClosureName); @@ -829,7 +818,7 @@ ExtractNested-Result-Term { (e.NestedBorrowedVars^) Sentences e.Sentences = : e.Context = (Function - GN-Local (e.ClosureName) + (e.ClosureName) Sentences >; - (e.Labels) (CmdMetatable s.ScopeClass (e.Name) e.Table) + (e.Labels) (CmdMetatable (e.Name) e.Table) = : s.Count e.Table^ = (e.Labels) + >; - (e.Labels) (CmdConditionFuncDecsrRasl s.ScopeClass e.Name) + (e.Labels) (CmdConditionFuncDecsrRasl e.Name) = (e.Labels) - >; + >; - (e.Labels) (CmdConditionFuncDecsrNative s.ScopeClass e.Name) + (e.Labels) (CmdConditionFuncDecsrNative e.Name) = (e.Labels) - >; + >; (e.Labels) (CmdNativeFuncDescr s.ScopeClass e.Name) = (e.Labels) diff --git a/src/compiler/HighLevelRASL-ConjointFunc.ref b/src/compiler/HighLevelRASL-ConjointFunc.ref index 7cddb109..3019c05c 100644 --- a/src/compiler/HighLevelRASL-ConjointFunc.ref +++ b/src/compiler/HighLevelRASL-ConjointFunc.ref @@ -12,7 +12,7 @@ $EXTERN BuildImage, BuildImage-Term, Generalization, Generalization-Term, $ENTRY HighLevelRASL-Function-Conjoint { - s.FnGenSubst s.FnGenResult s.ScopeClass (e.Name) e.Sentences + s.FnGenSubst s.FnGenResult (e.Name) e.Sentences /* Функция FindDivisionAndGenerate работает с подстановками, @@ -47,7 +47,7 @@ $ENTRY HighLevelRASL-Function-Conjoint { : e.ResultCommands^ = (Function - s.ScopeClass (e.Name) + (e.Name) (CmdIssueMemory s.MaxContextSize) e.CommonMatchCommands e.ResultCommands diff --git a/src/compiler/HighLevelRASL-DisjointFunc.ref b/src/compiler/HighLevelRASL-DisjointFunc.ref index 1fa076a9..0604c9e6 100644 --- a/src/compiler/HighLevelRASL-DisjointFunc.ref +++ b/src/compiler/HighLevelRASL-DisjointFunc.ref @@ -5,8 +5,7 @@ $EXTERN GenResult, GenPattern; $ENTRY HighLevelRASL-Function-Disjoint { - s.FnGenSubst s.FnGenResult - s.ScopeClass (e.Name) e.Sentences + s.FnGenSubst s.FnGenResult (e.Name) e.Sentences = ; - (Function s.ScopeClass (e.Name) NativeBody t.SrcPos e.Code) = - (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code); + (Function (e.Name) NativeBody t.SrcPos e.Code) + = (CmdNativeFunction (e.Name) t.SrcPos e.Code); - (Function s.ScopeClass (e.Name) Metatable e.Metatable) = - (CmdMetatable s.ScopeClass (e.Name) e.Metatable); + (Function (e.Name) Metatable e.Metatable) + = (CmdMetatable (e.Name) e.Metatable); - (Function s.ScopeClass (e.Name) Swap) = - (CmdSwap s.ScopeClass e.Name); + (Function (e.Name) Swap) = (CmdSwap e.Name); (Declaration s.ScopeClass e.Name) = (CmdDeclaration s.ScopeClass e.Name); @@ -66,7 +67,7 @@ $ENTRY HighLevelRASL { } HighLevelRASL-Function { - s.Joint s.OptResult s.ScopeClass (e.Name) e.Sentences + s.Joint s.OptResult (e.Name) e.Sentences /* Исправляем суффиксы функций-условий. @@ -112,14 +113,14 @@ HighLevelRASL-Function { = > - s.ScopeClass (e.Name) e.Sentences + (e.Name) e.Sentences >; } @@ -138,23 +139,18 @@ FixupName-Suf { } HighLevelRASL-Function-Aux { - s.FnGenFunction s.FnGenSubst s.FnGenResult - s.ScopeClass (e.Name) /* нет предложений */ - = (CmdEnum s.ScopeClass e.Name); + s.FnGenFunction s.FnGenSubst s.FnGenResult (e.Name) /* нет предложений */ + = (CmdEnum e.Name); - s.FnGenFunction s.FnGenSubst s.FnGenResult - s.ScopeClass (e.Name) t.OneSentence + s.FnGenFunction s.FnGenSubst s.FnGenResult (e.Name) t.OneSentence /* Нет смысла вызывать оптимизацию совместного сопоставления с образцом */ = ; - s.FnGenFunction s.FnGenSubst s.FnGenResult - s.ScopeClass (e.Name) e.Sentences + s.FnGenFunction s.FnGenSubst s.FnGenResult (e.Name) e.Sentences = ; } diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index db0e7439..a28fec4f 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -24,9 +24,11 @@ UndoubleEmtpyLines { } Element { - (Function s.Scope (e.Name) e.Body) = ; - (ColdFunction s.ColdBy s.Scope (e.Name) e.Body) - = ; + (Entries e.Names) = (); + + (Function (e.Name) e.Body) = ; + (ColdFunction s.ColdBy (e.Name) e.Body) + = ; (Declaration GN-Entry e.Name) = ('$EXTERN ' ';'); (Declaration GN-Local e.Name) = ('$FORWARD ' ';'); @@ -62,14 +64,48 @@ LongLine { } +$ENTRY Log-EntryList { + e.Names = ; +} + +NameList { + (e.OutLine) e.Names + , : True + = (e.OutLine) ; + + (e.OutLine) (e.Name) e.Names + = : s.SEP + = e.OutLine ' ' e.Name s.SEP : e.NewOutLine + = + : { + True = (e.OutLine) ; + False = ; + }; + + (e.OutLine) /* пусто */ = (e.OutLine); +} + +CommaOrSemicolon { + /* empty */ = ';'; + e.Names = ','; +} + +NameList-Next { + (e.NextName) e.Names + = : s.SEP + = ; + + /* пусто */ = /* пусто */; +} + + Function { - (e.Name) s.Scope e.Body - = ) s.Scope e.Body>; + (e.Name) e.Body = ) e.Body>; } ColdFunction { - s.ColdBy (e.Name) s.Scope e.Body - = + s.ColdBy (e.Name) e.Body + = : { () e.FunctionLines = () @@ -82,22 +118,20 @@ ColdFunction { } Function-Aux { - (e.Name) s.Scope Sentences /* пусто */ - = ( e.Name ' { /* empty */ }'); + (e.Name) Sentences /* пусто */ = (e.Name ' { /* empty */ }'); - (e.Name) s.Scope Sentences e.Sentences + (e.Name) Sentences e.Sentences = () - ( e.Name ' {') + (e.Name ' {') ('}') (); - (e.Name) s.Scope NativeBody t.SrcPos e.NativeBody - = ( e.Name ' { %% native %% }'); + (e.Name) NativeBody t.SrcPos e.NativeBody = (e.Name ' { %% native %% }'); - (e.Name) s.Scope Metatable e.Metatable + (e.Name) Metatable e.Metatable = () - ( e.Name ' {') + (e.Name ' {') ('* metatable function') ';'); - (e.Name) GN-Local Swap = ('$SWAP ' ';'); + (e.Name) Swap = ('$SWAP ' ';'); }; -Entry { - GN-Entry = '$ENTRY '; - GN-Local = /* пусто */; -} - Sentences { (e.Indent) (e.Sentence) = ; diff --git a/src/compiler/Log.ref b/src/compiler/Log.ref index 02deee22..1585156f 100644 --- a/src/compiler/Log.ref +++ b/src/compiler/Log.ref @@ -10,7 +10,7 @@ $EXTERN DisplayName; $EXTERN EscapeString; *$FROM Log-AST -$EXTERN Log-TextFromAST, Log-FormatIdentFuncMapTableLines; +$EXTERN Log-TextFromAST, Log-FormatIdentFuncMapTableLines, Log-EntryList; /** @@ -92,17 +92,16 @@ $ENTRY Log-AST { s.FileHandle = - ; - (e.Line) = ; - } - - > + > e.AST; }; } +IndentedPutout { + s.FileHandle () = ; + s.FileHandle (e.Line) = ; +} + /** == e.RASL @@ -122,18 +121,22 @@ $ENTRY Log-HighLevelRASL { PutProgramElement { s.FileHandle - (Function s.ScopeClass (e.Name) e.Commands) - = ; + (Entries e.Names) + = >; + + s.FileHandle + (Function (e.Name) e.Commands) + = ; s.FileHandle - (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code) - = ' :: native {'> + (CmdNativeFunction (e.Name) t.SrcPos e.Code) + = ' :: native {'> ; s.FileHandle - (CmdMetatable s.ScopeClass (e.Name) e.Metatable) - = ' :: metatable {'> + (CmdMetatable (e.Name) e.Metatable) + = ' :: metatable {'> ; - s.FileHandle (CmdEnum s.ScopeClass e.Name) - = ' :: enum'>; + s.FileHandle (CmdEnum e.Name) + = ' :: enum'>; - s.FileHandle (CmdSwap s.ScopeClass e.Name) - = ' :: swap'>; + s.FileHandle (CmdSwap e.Name) + = ' :: swap'>; - s.FileHandle (CmdConditionFunc s.ScopeClass e.Name) - = ' :: condition'>; + s.FileHandle (CmdConditionFunc e.Name) + = ' :: condition'>; - s.FileHandle (CmdDeclaration s.ScopeClass e.Name) - = ' :: extern'>; + s.FileHandle (CmdDeclaration e.Name) + = ' :: extern'>; s.FileHandle (CmdDefineIdent e.Name) = >; @@ -169,17 +172,12 @@ PutProgramElement { } PutRASLFunction { - s.FileHandle s.ScopeClass (e.Name) e.Commands - = ' {'> + s.FileHandle (e.Name) e.Commands + = ' {'> ; } -FnName { - GN-Local e.Name = ' ' ; - GN-Entry e.Name = ' $ENTRY ' ; -} - PutRASLCommands { s.FileHandle (e.Indent) e.Commands = + = : (e.Entries) e.Items^ + = : { /* нет нативных определений */ = /* нет нативного RASL’а */; @@ -30,6 +31,10 @@ $ENTRY LowLevelRASL-Native { }; } +GetEntries { + e.Items-B (Entries e.Entries) e.Items-E = (e.Entries) e.Items-B e.Items-E +} + PrepareTable { e.Prefix (0 /* пусто */) = /* пусто */; @@ -40,54 +45,54 @@ PrepareTable { } SetCookies { - s.Hash1 s.Hash2 (UnitName e.SrcName) = /* пропускаем */; + e.Entries s.Hash1 s.Hash2 (UnitName e.SrcName) = /* пропускаем */; - s.Hash1 s.Hash2 - (Function-ToRASL s.ScopeClass (e.Name) e.Commands) = + e.Entries s.Hash1 s.Hash2 + (Function-ToRASL (e.Name) e.Commands) = /* пропускаем */; - s.Hash1 s.Hash2 - (Function-ToNative s.ScopeClass (e.Name) e.Commands) = + e.Entries s.Hash1 s.Hash2 + (Function-ToNative (e.Name) e.Commands) = (Function-ToNative - () + () e.Commands ); - s.Hash1 s.Hash2 - (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code) = + e.Entries s.Hash1 s.Hash2 + (CmdNativeFunction (e.Name) t.SrcPos e.Code) = (CmdNativeFunction - () + () t.SrcPos e.Code ); - s.Hash1 s.Hash2 - (CmdMetatable s.ScopeClass (e.Name) e.Metatable) = + e.Entries s.Hash1 s.Hash2 + (CmdMetatable (e.Name) e.Metatable) = /* пропускаем */; - s.Hash1 s.Hash2 (CmdEnum s.ScopeClass e.Name) = + e.Entries s.Hash1 s.Hash2 (CmdEnum e.Name) = /* пропускаем */; - s.Hash1 s.Hash2 (CmdSwap s.ScopeClass e.Name) = + e.Entries s.Hash1 s.Hash2 (CmdSwap e.Name) = /* пропускаем */; - s.Hash1 s.Hash2 - (CmdConditionFunc-ToRASL s.ScopeClass e.Name) = + e.Entries s.Hash1 s.Hash2 + (CmdConditionFunc-ToRASL e.Name) = /* пропускаем */; - s.Hash1 s.Hash2 - (CmdConditionFunc-ToNative s.ScopeClass e.Name) = + e.Entries s.Hash1 s.Hash2 + (CmdConditionFunc-ToNative e.Name) = /* пропускаем */; - s.Hash1 s.Hash2 (CmdDeclaration s.ScopeClass e.Name) = + e.Entries s.Hash1 s.Hash2 (CmdDeclaration e.Name) = /* пропускаем */; - s.Hash1 s.Hash2 (CmdEmitNativeCode t.SrcPos e.Code) = + e.Entries s.Hash1 s.Hash2 (CmdEmitNativeCode t.SrcPos e.Code) = (CmdEmitNativeCode t.SrcPos e.Code); } MingleName { - GN-Entry e.Name s.Hash1 s.Hash2 = e.Name Hash 0 0; - GN-Local e.Name s.Hash1 s.Hash2 = e.Name Hash s.Hash1 s.Hash2; + (e._ (e.Name) e._) e.Name s.Hash1 s.Hash2 = e.Name Hash 0 0; + (e.Entries) e.Name s.Hash1 s.Hash2 = e.Name Hash s.Hash1 s.Hash2; } PrepareFunctionsRASL { diff --git a/src/compiler/LowLevelRASL-RASL.ref b/src/compiler/LowLevelRASL-RASL.ref index 53531615..8f6ccb19 100644 --- a/src/compiler/LowLevelRASL-RASL.ref +++ b/src/compiler/LowLevelRASL-RASL.ref @@ -16,11 +16,14 @@ $INCLUDE "LibraryEx"; */ $ENTRY LowLevelRASL-RASL { s.DebugInfo s.Hash1 s.Hash2 (t.FuncTable t.IdentTable) e.Items + = : (e.Entries) e.Items^ = - : (e.FuncScopeClass) e.Definitions + : (e.DefinedFunctions) e.Definitions - = + = : e.FuncScopeClass + + = : s.MaxLabel e.Definitions^ = ( @@ -31,52 +34,66 @@ $ENTRY LowLevelRASL-RASL { ); } +GetEntries { + e.Items-B (Entries e.Entries) e.Items-E = (e.Entries) e.Items-B e.Items-E +} + ClassifyItems { - (e.FuncScopeClass) (UnitName e.SrcName) = - (e.FuncScopeClass) (UnitName e.SrcName); + (e.DefinedFunctions) (UnitName e.SrcName) + = (e.DefinedFunctions) (UnitName e.SrcName); - (e.FuncScopeClass) (Function-ToRASL s.ScopeClass (e.Name) e.FunctionBody) = - (e.FuncScopeClass (s.ScopeClass e.Name)) - (Function-ToRASL s.ScopeClass (e.Name) e.FunctionBody); + (e.DefinedFunctions) (Function-ToRASL (e.Name) e.FunctionBody) + = (e.DefinedFunctions (e.Name)) + (Function-ToRASL (e.Name) e.FunctionBody); - (e.FuncScopeClass) (Function-ToNative s.ScopeClass (e.Name) e.Commands) = - (e.FuncScopeClass (s.ScopeClass e.Name)) - (CmdNativeFuncDescr s.ScopeClass e.Name); + (e.DefinedFunctions) (Function-ToNative (e.Name) e.Commands) + = (e.DefinedFunctions (e.Name)) + (CmdNativeFuncDescr e.Name); - (e.FuncScopeClass) (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code) = - (e.FuncScopeClass (s.ScopeClass e.Name)) - (CmdNativeFuncDescr s.ScopeClass e.Name); + (e.DefinedFunctions) (CmdNativeFunction (e.Name) t.SrcPos e.Code) + = (e.DefinedFunctions (e.Name)) + (CmdNativeFuncDescr e.Name); - (e.FuncScopeClass) (CmdMetatable s.ScopeClass (e.Name) e.Metatable) = - (e.FuncScopeClass (s.ScopeClass e.Name)) - (CmdMetatable s.ScopeClass (e.Name) e.Metatable); + (e.DefinedFunctions) (CmdMetatable (e.Name) e.Metatable) + = (e.DefinedFunctions (e.Name)) + (CmdMetatable (e.Name) e.Metatable); - (e.FuncScopeClass) (CmdEnum s.ScopeClass e.Name) = - (e.FuncScopeClass (s.ScopeClass e.Name)) - (CmdEnumDescr s.ScopeClass e.Name); + (e.DefinedFunctions) (CmdEnum e.Name) + = (e.DefinedFunctions (e.Name)) + (CmdEnumDescr e.Name); - (e.FuncScopeClass) (CmdSwap s.ScopeClass e.Name) = - (e.FuncScopeClass (s.ScopeClass e.Name)) - (CmdSwapDescr s.ScopeClass e.Name); + (e.DefinedFunctions) (CmdSwap e.Name) + = (e.DefinedFunctions (e.Name)) + (CmdSwapDescr e.Name); - (e.FuncScopeClass) (CmdConditionFunc-ToRASL s.ScopeClass e.Name) = - (e.FuncScopeClass (s.ScopeClass e.Name)) - (CmdConditionFuncDecsrRasl s.ScopeClass e.Name); + (e.DefinedFunctions) (CmdConditionFunc-ToRASL e.Name) + = (e.DefinedFunctions (e.Name)) + (CmdConditionFuncDecsrRasl e.Name); - (e.FuncScopeClass) (CmdConditionFunc-ToNative s.ScopeClass e.Name) = - (e.FuncScopeClass (s.ScopeClass e.Name)) - (CmdConditionFuncDecsrNative s.ScopeClass e.Name); + (e.DefinedFunctions) (CmdConditionFunc-ToNative e.Name) + = (e.DefinedFunctions (e.Name)) + (CmdConditionFuncDecsrNative e.Name); - (e.FuncScopeClass) (CmdDeclaration s.ScopeClass e.Name) = - (e.FuncScopeClass (s.ScopeClass e.Name)) /* skip */; + (e.DefinedFunctions) (CmdDeclaration e.Name) + = (e.DefinedFunctions (e.Name)) /* skip */; - (e.FuncScopeClass) (CmdEmitNativeCode t.SrcPos e.Code) = - (e.FuncScopeClass) /* skip */; + (e.DefinedFunctions) (CmdEmitNativeCode t.SrcPos e.Code) + = (e.DefinedFunctions) /* skip */; +} + +MarkEntries { + (e.Entries) e.Names + = e.Name); + } + e.Names + > } PrepareFunctionsRASL { - s.DebugInfo s.NextLabel - (Function-ToRASL s.ScopeClass (e.Name) e.FunctionBody) + s.DebugInfo e.Entries s.NextLabel + (Function-ToRASL (e.Name) e.FunctionBody) = : e.FunctionBody^ @@ -89,6 +106,8 @@ PrepareFunctionsRASL { = : e.RASLCommands^ + = : s.ScopeClass + = s.NextLabel (CmdInterpretFuncDescr s.ScopeClass @@ -99,7 +118,12 @@ PrepareFunctionsRASL { e.RASLCommands ); - s.DebugInfo s.NextLabel t.OtherItem = s.NextLabel t.OtherItem; + s.DebugInfo e.Entries s.NextLabel (s.CmdDescr e.Name) + , CmdNativeFuncDescr CmdEnumDescr CmdSwapDescr : e._ s.CmdDescr e._ + = : s.ScopeClass + = s.NextLabel (s.CmdDescr s.ScopeClass e.Name); + + s.DebugInfo e.Entries s.NextLabel t.OtherItem = s.NextLabel t.OtherItem; } RemoveDebugInfo { @@ -213,6 +237,11 @@ AddFunctionNameComment { >; } +Scope { + e._ (e.Name) e._ (e.Name) = GN-Entry; + e.Entries (e.Name) = GN-Local; +} + PrepareCommonRASL { (e.FuncScopeClass) (s.FunctionCount e.Functions) (s.IdentCount e.Idents) diff --git a/src/compiler/LowLevelRASL.ref b/src/compiler/LowLevelRASL.ref index e5a764ce..93e9de8a 100644 --- a/src/compiler/LowLevelRASL.ref +++ b/src/compiler/LowLevelRASL.ref @@ -65,38 +65,49 @@ gen_t__ { e.arg = } gen_e__ { e.arg = e.arg } CalcDigest-Aux { - (s.Hash1 s.Hash2) (UnitName e.SrcName) = - () - (UnitName e.SrcName); + (s.Hash1 s.Hash2) (Entries e.Names) + = ) (e.Name); + } + (s.Hash1 s.Hash2) e.Names + > + : (s.Hash1^ s.Hash2^) e.Names^ + = (s.Hash1 s.Hash2) (Entries e.Names); + + (s.Hash1 s.Hash2) (UnitName e.SrcName) + = () + (UnitName e.SrcName); - (s.Hash1 s.Hash2) (Function s.ScopeClass (e.Name) e.Commands) = - () - (Function s.ScopeClass (e.Name) e.Commands); + (s.Hash1 s.Hash2) (Function (e.Name) e.Commands) + = () + (Function (e.Name) e.Commands); (s.Hash1 s.Hash2) - (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code) = - () - (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code); + (CmdNativeFunction (e.Name) t.SrcPos e.Code) + = () + (CmdNativeFunction (e.Name) t.SrcPos e.Code); (s.Hash1 s.Hash2) - (CmdMetatable s.ScopeClass (e.Name) e.Metatable) = - () - (CmdMetatable s.ScopeClass (e.Name) e.Metatable); + (CmdMetatable (e.Name) e.Metatable) + = () + (CmdMetatable (e.Name) e.Metatable); - (s.Hash1 s.Hash2) (CmdEnum s.ScopeClass e.Name) = - () - (CmdEnum s.ScopeClass e.Name); + (s.Hash1 s.Hash2) (CmdEnum e.Name) + = () + (CmdEnum e.Name); - (s.Hash1 s.Hash2) (CmdSwap s.ScopeClass e.Name) = - () - (CmdSwap s.ScopeClass e.Name); + (s.Hash1 s.Hash2) (CmdSwap e.Name) + = () + (CmdSwap e.Name); - (s.Hash1 s.Hash2) (CmdConditionFunc s.ScopeClass e.Name) = - () - (CmdConditionFunc s.ScopeClass e.Name); + (s.Hash1 s.Hash2) (CmdConditionFunc e.Name) + = () + (CmdConditionFunc e.Name); (s.Hash1 s.Hash2) (CmdDeclaration s.ScopeClass e.Name) = - () + () (CmdDeclaration s.ScopeClass e.Name); (s.Hash1 s.Hash2) (CmdDefineIdent e.Name) = @@ -107,24 +118,13 @@ CalcDigest-Aux { } HashFuncName { - s.Hash1 s.Hash2 s.ScopeClass e.Name s.Sign = - s.Sign - >; -} - -CharFromScopeClass { - GN-Entry = 'E'; - GN-Local = 'L'; + s.Hash1 s.Hash2 e.Name s.Sign + = s.Sign ','>; } SetScopeIDs { - s.Hash1 s.Hash2 (Function s.ScopeClass (e.Name) e.Commands) - = (Function - s.ScopeClass (e.Name) - - ); + s.Hash1 s.Hash2 (Function (e.Name) e.Commands) + = (Function (e.Name) ); s.Hash1 s.Hash2 t.OtherItem = t.OtherItem; } @@ -180,36 +180,42 @@ SelectConstantsOutliner { = &OutlineConstants-WithNative e.Items-B (NativeBlock t.SrcPos e.Code) e.Items-E; - e.Items-B (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code) e.Items-E + e.Items-B (CmdNativeFunction (e.Name) t.SrcPos e.Code) e.Items-E = &OutlineConstants-WithNative e.Items-B - (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code) + (CmdNativeFunction (e.Name) t.SrcPos e.Code) e.Items-E; e.Items = &OutlineConstants-RASLOnly e.Items; } OutlineConstants-WithNative { + t.Tables (Entries e.Entries) = t.Tables (Entries e.Entries); + t.Tables (UnitName e.SrcName) = t.Tables (UnitName e.SrcName); - t.Tables (Function s.ScopeClass (e.Name) e.Commands) + t.Tables (Function (e.Name) e.Commands) = : t.Tables^ s.Id = : t.Tables^ e.Commands^ - = t.Tables (Function s.ScopeClass (e.Name) e.Commands); + = t.Tables (Function (e.Name) e.Commands); - t.Tables (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code) + t.Tables (CmdNativeFunction (e.Name) t.SrcPos e.Code) = : t.Tables^ s.Id - = t.Tables (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code); + = t.Tables (CmdNativeFunction (e.Name) t.SrcPos e.Code); - t.Tables (CmdMetatable s.ScopeClass (e.Name) e.Metatable) + t.Tables (CmdMetatable (e.Name) e.Metatable) = : t.Tables^ e.Metatable^ = t.Tables - (CmdMetatable s.ScopeClass (e.Name) e.Metatable); + (CmdMetatable (e.Name) e.Metatable); + + t.Tables (s.Definition e.Name) + , : True + = : t.Tables^ s.Id + = t.Tables (s.Definition e.Name); - t.Tables (s.Definition s.ScopeClass e.Name) - , : True + t.Tables (CmdDeclaration s.ScopeClass e.Name) = : t.Tables^ s.Id - = t.Tables (s.Definition s.ScopeClass e.Name); + = t.Tables (CmdDeclaration s.ScopeClass e.Name); t.Tables (CmdDefineIdent e.Name) = : t.Tables^ s.Id @@ -220,16 +226,16 @@ OutlineConstants-WithNative { } OutlineConstants-RASLOnly { - t.Tables (Function s.ScopeClass (e.Name) e.Commands) + t.Tables (Function (e.Name) e.Commands) = : t.Tables^ e.Commands^ - = t.Tables (Function s.ScopeClass (e.Name) e.Commands); + = t.Tables (Function (e.Name) e.Commands); t.Tables (CmdDefineIdent e.Name) = t.Tables /* пропускаем */; - t.Tables (CmdMetatable s.ScopeClass (e.Name) e.Metatable) + t.Tables (CmdMetatable (e.Name) e.Metatable) = : t.Tables^ e.Metatable^ = t.Tables - (CmdMetatable s.ScopeClass (e.Name) e.Metatable); + (CmdMetatable (e.Name) e.Metatable); t.Tables t.OtherItem = t.Tables t.OtherItem; } @@ -317,17 +323,17 @@ UpdateTable { } MarkFunctionGenMode { - OnlyInterpret (Function s.ScopeClass (e.Name) e.Commands) = - (Function-ToRASL s.ScopeClass (e.Name) e.Commands); + OnlyInterpret (Function (e.Name) e.Commands) + = (Function-ToRASL (e.Name) e.Commands); - OnlyDirect (Function s.ScopeClass (e.Name) e.Commands) = - (Function-ToNative s.ScopeClass (e.Name) e.Commands); + OnlyDirect (Function (e.Name) e.Commands) + = (Function-ToNative (e.Name) e.Commands); - OnlyInterpret (CmdConditionFunc s.ScopeClass e.Name) = - (CmdConditionFunc-ToRASL s.ScopeClass e.Name); + OnlyInterpret (CmdConditionFunc e.Name) + = (CmdConditionFunc-ToRASL e.Name); - OnlyDirect (CmdConditionFunc s.ScopeClass e.Name) = - (CmdConditionFunc-ToNative s.ScopeClass e.Name); + OnlyDirect (CmdConditionFunc e.Name) + = (CmdConditionFunc-ToNative e.Name); s.GenMode (s.Type e.Info) = (s.Type e.Info); } diff --git a/src/compiler/OptTree-AutoMarkup-Drive.ref b/src/compiler/OptTree-AutoMarkup-Drive.ref index bf15f4c6..ff7c0746 100644 --- a/src/compiler/OptTree-AutoMarkup-Drive.ref +++ b/src/compiler/OptTree-AutoMarkup-Drive.ref @@ -42,8 +42,8 @@ BuldCallGraph { MetaInfo { e.AST - = ((/* forbidden list */) (/* inlines */) (/* drives */) (/* entries */)) - : t.InitMetaInfo + = e.AST : e.AST-B (Entries e.Entries) e.AST-E + = ((/* forbidden list */) (/* inlines */) (/* drives */)) : t.InitMetaInfo = : True = (Function - GN-Local (e.FuncName) Sentences + (e.FuncName) Sentences (((Var 'e' e.Index)) /*=*/ ((Var 'e' e.Index))) ); - t.MetaInfo (Function s.Scope (e.FuncName) Sentences e.Body) + t.MetaInfo (Function (e.FuncName) Sentences e.Body) = : s.SentencesCount e.Body^ = /* пусто */ : { @@ -80,28 +80,30 @@ MetaInfo { /* пусто */ = t.MetaInfo; } : t.MetaInfo^ - = - (Function s.Scope (e.FuncName) Sentences e.Body); + = t.MetaInfo (Function (e.FuncName) Sentences e.Body); t.MetaInfo t.Other = t.MetaInfo t.Other; } - t.InitMetaInfo e.AST + t.InitMetaInfo e.AST-B e.AST-E > + : ((e.Forbidden) (e.Inlines) (e.Drives)) e.AST^ + = ((e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)) + (Entries e.Entries) e.AST } MetaInfo-AddInline { - ((e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)) e.Name - = ((e.Forbidden (e.Name)) (e.Inlines (e.Name)) (e.Drives) (e.Entries)); + ((e.Forbidden) (e.Inlines) (e.Drives)) e.Name + = ((e.Forbidden (e.Name)) (e.Inlines (e.Name)) (e.Drives)); } MetaInfo-AddDrive { - ((e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)) e.Name - = ((e.Forbidden) (e.Inlines) (e.Drives (e.Name)) (e.Entries)); + ((e.Forbidden) (e.Inlines) (e.Drives)) e.Name + = ((e.Forbidden) (e.Inlines) (e.Drives (e.Name))); } MetaInfo-AddForbidden { - ((e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)) e.Name - = ((e.Forbidden (e.Name)) (e.Inlines) (e.Drives) (e.Entries)); + ((e.Forbidden) (e.Inlines) (e.Drives)) e.Name + = ((e.Forbidden (e.Name)) (e.Inlines) (e.Drives)); } Pseudofunction-gen_e { @@ -113,14 +115,6 @@ Pseudofunction-gen_e { e._ = False; } -MetaInfo-AddEntry { - ((e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)) GN-Entry e.Name - = ((e.Forbidden) (e.Inlines) (e.Drives) (e.Entries (e.Name))); - - ((e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)) GN-Local e.Name - = ((e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)); -} - SeparateMetatables { e.AST = )); t._ = /* пропускаем */; @@ -620,11 +614,11 @@ UnsuffixedFunctions { RemoveUnused { (e.Unused-B (e.Name) e.Unused-E) - (Function s.ScopeClass (e.Name) Sentences e._) + (Function (e.Name) Sentences e._) = (e.Unused-B e.Unused-E) /* пропускаем */; (e.Unused-B (e.Name) e.Unused-E) - (Function s.ScopeClass (e.Name) Metatable e._) + (Function (e.Name) Metatable e._) = (e.Unused-B e.Unused-E) /* пропускаем */; (e.Unused) t.OtherItem = (e.Unused) t.OtherItem; /* оставляем */ diff --git a/src/compiler/OptTree-AutoMarkup-Spec.ref b/src/compiler/OptTree-AutoMarkup-Spec.ref index 003760f8..34e5d35c 100644 --- a/src/compiler/OptTree-AutoMarkup-Spec.ref +++ b/src/compiler/OptTree-AutoMarkup-Spec.ref @@ -19,10 +19,10 @@ $ENTRY OptTree-AutoMarkup-Spec { = : (e.Forbidden) e.AST^ = ':' (ColdCallBrackets (Symbol Name e.Name) e.Args)) - ((NewFunction GN-Local (e.Name) s.BodyLabel e.Body)) + ((NewFunction (e.Name) s.BodyLabel e.Body)) ); (e.UsedVars) (s.FuncMode (e.Name) s.BodyLabel e.Body) e.Args diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index a7dcac1c..5ae7b696 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -172,9 +172,9 @@ ExtractMetatableNames { e.AST = : s.SentencesCount e.Sentences^ = (e.Lengths (e.Name s.SentencesCount)) - (Function s.ScopeClass (e.Name) Sentences e.Sentences); + (Function (e.Name) Sentences e.Sentences); (e.Lengths) t.Other = (e.Lengths) t.Other; } @@ -262,16 +262,16 @@ FormatOptFunctions { = ) e.Functions @@ -332,9 +332,9 @@ DriveInlineOptimizerTick { = ((e.OptNames) ) : t.OptInfo = ; @@ -347,13 +347,13 @@ DriveInlineOptimizerTick { = + (e.Name) Sentences ); (t.OptInfo^ (e.Sentences^) (e.NewFunctions)) = t.OptInfo - (Function s.ScopeClass (e.Name) Sentences e.Sentences) + (Function (e.Name) Sentences e.Sentences) e.NewFunctions; } } @@ -471,9 +471,9 @@ $ENTRY OptTree-Drive-CleanupColdCalls { e.AST = + (e.Name) Sentences ); t.OtherItem = t.OtherItem; diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index bf611e22..bc03e8ff 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -79,13 +79,13 @@ Prepare-Aux { (&MapAccum { ((e.Names) e.Info-B (t.Name (e.Pattern)) e.Info-E (e.Histories)) - (Function s.ScopeClass t.Name Sentences e.Body) + (Function t.Name Sentences e.Body) = ( (e.Names) e.Info-B (t.Name (e.Pattern) (e.Body) 1) e.Info-E (e.Histories) ) - (Function s.ScopeClass t.Name Sentences e.Body); + (Function t.Name Sentences e.Body); ((e.Names) e.Info) t.Other = ((e.Names) e.Info) t.Other; } @@ -142,8 +142,8 @@ AddGuardEnums { e.AST = ; + (Function (e.Name) e.Body) + = (Function (e.Name) e.Body) ; (Declaration s.ScopeClass e.Name) = (Declaration s.ScopeClass e.Name) ; @@ -159,7 +159,7 @@ GuardEnumName { } MakeGuardEnum { - e.Name = (Function GN-Local () Sentences /* пусто */) + e.Name = (Function () Sentences /* пусто */) } * Обеспечивает специализацию функций Func*n. Такие функции могут получаться @@ -215,8 +215,8 @@ ColdAll { e.AST = : (e.SpecInfo^ (e.Histories) (e.History^) (e.NewFunctions^)) e.Sentences^ = (e.SpecInfo (e.Histories) (e.NewFunctions)) - (ColdFunction SPEC s.ScopeClass t.Name Sentences e.Sentences); + (ColdFunction SPEC t.Name Sentences e.Sentences); (e.SpecInfo (e.Histories) (e.NewFunctions)) - (Function s.ScopeClass t.Name Sentences e.Sentences) + (Function t.Name Sentences e.Sentences) = (e.Sg)> ) - (Function GN-Local (e.InstanceName) Sentences e.NewSentences) + (Function (e.InstanceName) Sentences e.NewSentences) ( ((e.InstanceName) e.History ((e.InstanceName) e.Signature)) ); diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index 9a8c0f19..e5040df1 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -122,9 +122,7 @@ WarmColdFunctions { s.ColdBy e.AST = - ); + (Function (e.Name) Sentences e.Body) + = (Function (e.Name) Sentences ); t.OtherItem = t.OtherItem; } @@ -285,9 +280,9 @@ Int-LoopForWarmFunctions { (e.Defines) e.Code 0 (e.AST) = 0 e.AST; (e.Defines) e.Code s.Cycles - (e.AST-B (Function s.Scope (e.Name) Sentences e.Sentences) e.AST-E) + (e.AST-B (Function (e.Name) Sentences e.Sentences) e.AST-E) - = e.AST-B (Function s.Scope (e.Name) Sentences e.Sentences) e.AST-E : e.AST + = e.AST-B (Function (e.Name) Sentences e.Sentences) e.AST-E : e.AST = : s.Cycles^ e.AST^ diff --git a/src/compiler/README.md b/src/compiler/README.md index e5dac12d..04e64353 100644 --- a/src/compiler/README.md +++ b/src/compiler/README.md @@ -319,7 +319,8 @@ e.ReducedAST ::= t.ReducedProgramElement* t.ReducedProgramElement ::= - (Function s.ScopeClass (e.Name) e.ReducedBody) + (Entries (e.Name)*) + | (Function (e.Name) e.ReducedBody) | (Declaration s.ScopeClass e.Name) | (Ident e.Name) | (NativeBlock t.SrcPos e.Code) @@ -402,18 +403,19 @@ e.RASLAST ::= t.RASLAST-Item* t.RASLAST-Item ::= - (Function s.ScopeClass (e.Name) e.HiCommands) - | (CmdNativeFunction s.ScopeClass (e.Name) t.SrcPos e.Code) + (Entries (e.Name)*) + | (Function (e.Name) e.HiCommands) + | (CmdNativeFunction (e.Name) t.SrcPos e.Code) | t.CmdTopLevelItem t.CmdTopLevelItem ::= - (CmdEnum s.ScopeClass e.Name) - | (CmdSwap s.ScopeClass e.Name) + (CmdEnum e.Name) + | (CmdSwap e.Name) | (CmdDeclaration s.ScopeClass e.Name) - | (CmdConditionFunc s.ScopeClass e.Name) + | (CmdConditionFunc e.Name) | (CmdDefineIdent e.Name) | (CmdEmitNativeCode t.SrcPos e.Code) - | (CmdMetatable s.ScopeClass (e.Name) e.ReducedMetatable) + | (CmdMetatable (e.Name) e.ReducedMetatable) e.HiCommands ::= t.HiCommand* t.HiCommand ::= @@ -691,9 +693,9 @@ e-переменные, распределяемые последователь | (CmdInterpretFuncDescr e.CookiedName s.LabelId) | (CmdSwapDescr e.CookiedName) | (CmdNativeFuncDescr s.ScopeClass e.Name) - | (CmdConditionFuncDescrRasl s.ScopeClass e.Name) - | (CmdConditionFuncDescrNative s.ScopeClass e.Name) - | (CmdMetatable s.ScopeClass (e.Name) e.LowMetatable) + | (CmdConditionFuncDescrRasl e.Name) + | (CmdConditionFuncDescrNative e.Name) + | (CmdMetatable (e.Name) e.LowMetatable) e.CookiedName ::= e.Name Hash s.Cookie1 s.Cookie2 s.Cookie1, s.Cookie2 ::= s.NUMBER From 3d41447b2904e18ab6f9832107920295794162e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 8 Aug 2021 23:38:23 +0300 Subject: [PATCH 095/208] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20(#315,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Исправлены нечётные отступы. • Убраны пробелы в концах строк в недавно менявшихся строчках (или рядом с ними). • Удалены лишние ссылки в списках $EXTERN. • $EXTERN’ы упорядочены в порядке использования. Коммит рекомендуется смотреть также с опцией игнорирования пробельных символов. --- src/compiler/Checker-Screening.ref | 24 ++++++------ src/compiler/HighLevelRASL.ref | 7 ++-- src/compiler/Log.ref | 2 +- src/compiler/LowLevelRASL-Native.ref | 57 ++++++++++------------------ src/compiler/LowLevelRASL.ref | 22 +++++------ 5 files changed, 47 insertions(+), 65 deletions(-) diff --git a/src/compiler/Checker-Screening.ref b/src/compiler/Checker-Screening.ref index 659bb513..e79835a9 100644 --- a/src/compiler/Checker-Screening.ref +++ b/src/compiler/Checker-Screening.ref @@ -4,8 +4,8 @@ $INCLUDE "LibraryEx"; $EXTERN GenericMatch; *$FROM Desugaring -$EXTERN CreateContext, RemovePos-Expr, ExtractVariables-Expr, - Pass-EnumerateVariables, Pass-RemovePos, Pass-ExtractEntries; +$EXTERN Pass-RemovePos, Pass-EnumerateVariables, Pass-ExtractEntries, + ExtractVariables-Expr, CreateContext; /* : (e.FunctionsPos) e.AST^ - = : e.AST^ - = : e.AST-B (Entries e.Entries) e.AST-E - = : e.AST^ - = : e.FunctionsWithPos - = ; + (e._ screening e._) (e.AST) + = : (e.FunctionsPos) e.AST^ + = : e.AST^ + = : e.AST-B (Entries e.Entries) e.AST-E + = : e.AST^ + = : e.FunctionsWithPos + = ; - (e._) (e.AST) = /* пусто */ + (e._) (e.AST) = /* пусто */ } /* @@ -39,7 +39,7 @@ FindFunctionsPosInAST { (e.Positions) (Function t.SrcPos s.ScopeClass (e.Name) Sentences e.Sentences) = (e.Positions t.SrcPos) - (Function t.SrcPos s.ScopeClass (e.Name) Sentences e.Sentences); + (Function t.SrcPos s.ScopeClass (e.Name) Sentences e.Sentences); (e.Positions) t.Other = (e.Positions) /* пусто */ } @@ -575,7 +575,7 @@ InsertFakeEVars { e.Suffix >; - e.Other = e.Other; + e.Other = e.Other; } /* diff --git a/src/compiler/HighLevelRASL.ref b/src/compiler/HighLevelRASL.ref index 874a4d25..893eba1b 100644 --- a/src/compiler/HighLevelRASL.ref +++ b/src/compiler/HighLevelRASL.ref @@ -54,13 +54,12 @@ $ENTRY HighLevelRASL { (Function (e.Name) Swap) = (CmdSwap e.Name); - (Declaration s.ScopeClass e.Name) = - (CmdDeclaration s.ScopeClass e.Name); + (Declaration s.ScopeClass e.Name) + = (CmdDeclaration s.ScopeClass e.Name); (Ident e.Name) = (CmdDefineIdent e.Name); - (NativeBlock t.SrcPos e.Code) = - (CmdEmitNativeCode t.SrcPos e.Code); + (NativeBlock t.SrcPos e.Code) = (CmdEmitNativeCode t.SrcPos e.Code); } e.ProgramElements >; diff --git a/src/compiler/Log.ref b/src/compiler/Log.ref index 1585156f..0f04287a 100644 --- a/src/compiler/Log.ref +++ b/src/compiler/Log.ref @@ -10,7 +10,7 @@ $EXTERN DisplayName; $EXTERN EscapeString; *$FROM Log-AST -$EXTERN Log-TextFromAST, Log-FormatIdentFuncMapTableLines, Log-EntryList; +$EXTERN Log-TextFromAST, Log-EntryList; /** diff --git a/src/compiler/LowLevelRASL-Native.ref b/src/compiler/LowLevelRASL-Native.ref index 26ebd612..d3bc72b4 100644 --- a/src/compiler/LowLevelRASL-Native.ref +++ b/src/compiler/LowLevelRASL-Native.ref @@ -48,46 +48,31 @@ SetCookies { e.Entries s.Hash1 s.Hash2 (UnitName e.SrcName) = /* пропускаем */; e.Entries s.Hash1 s.Hash2 - (Function-ToRASL (e.Name) e.Commands) = - /* пропускаем */; + (Function-ToRASL (e.Name) e.Commands) + = /* пропускаем */; e.Entries s.Hash1 s.Hash2 - (Function-ToNative (e.Name) e.Commands) = - (Function-ToNative - () - e.Commands - ); + (Function-ToNative (e.Name) e.Commands) + = (Function-ToNative + () + e.Commands + ); e.Entries s.Hash1 s.Hash2 - (CmdNativeFunction (e.Name) t.SrcPos e.Code) = - (CmdNativeFunction - () - t.SrcPos e.Code - ); - - e.Entries s.Hash1 s.Hash2 - (CmdMetatable (e.Name) e.Metatable) = - /* пропускаем */; - - e.Entries s.Hash1 s.Hash2 (CmdEnum e.Name) = - /* пропускаем */; - - e.Entries s.Hash1 s.Hash2 (CmdSwap e.Name) = - /* пропускаем */; - - e.Entries s.Hash1 s.Hash2 - (CmdConditionFunc-ToRASL e.Name) = - /* пропускаем */; - - e.Entries s.Hash1 s.Hash2 - (CmdConditionFunc-ToNative e.Name) = - /* пропускаем */; - - e.Entries s.Hash1 s.Hash2 (CmdDeclaration e.Name) = - /* пропускаем */; - - e.Entries s.Hash1 s.Hash2 (CmdEmitNativeCode t.SrcPos e.Code) = - (CmdEmitNativeCode t.SrcPos e.Code); + (CmdNativeFunction (e.Name) t.SrcPos e.Code) + = (CmdNativeFunction + () + t.SrcPos e.Code + ); + + e.Entries s.Hash1 s.Hash2 (CmdMetatable (e.Name) e.Metatable) = /* пропускаем */; + e.Entries s.Hash1 s.Hash2 (CmdEnum e.Name) = /* пропускаем */; + e.Entries s.Hash1 s.Hash2 (CmdSwap e.Name) = /* пропускаем */; + e.Entries s.Hash1 s.Hash2 (CmdConditionFunc-ToRASL e.Name) = /* пропускаем */; + e.Entries s.Hash1 s.Hash2 (CmdConditionFunc-ToNative e.Name) = /* пропускаем */; + e.Entries s.Hash1 s.Hash2 (CmdDeclaration e.Name) = /* пропускаем */; + e.Entries s.Hash1 s.Hash2 (CmdEmitNativeCode t.SrcPos e.Code) + = (CmdEmitNativeCode t.SrcPos e.Code); } MingleName { diff --git a/src/compiler/LowLevelRASL.ref b/src/compiler/LowLevelRASL.ref index 93e9de8a..ceafac4e 100644 --- a/src/compiler/LowLevelRASL.ref +++ b/src/compiler/LowLevelRASL.ref @@ -84,13 +84,11 @@ CalcDigest-Aux { = () (Function (e.Name) e.Commands); - (s.Hash1 s.Hash2) - (CmdNativeFunction (e.Name) t.SrcPos e.Code) + (s.Hash1 s.Hash2) (CmdNativeFunction (e.Name) t.SrcPos e.Code) = () (CmdNativeFunction (e.Name) t.SrcPos e.Code); - (s.Hash1 s.Hash2) - (CmdMetatable (e.Name) e.Metatable) + (s.Hash1 s.Hash2) (CmdMetatable (e.Name) e.Metatable) = () (CmdMetatable (e.Name) e.Metatable); @@ -106,20 +104,20 @@ CalcDigest-Aux { = () (CmdConditionFunc e.Name); - (s.Hash1 s.Hash2) (CmdDeclaration s.ScopeClass e.Name) = - () - (CmdDeclaration s.ScopeClass e.Name); + (s.Hash1 s.Hash2) (CmdDeclaration s.ScopeClass e.Name) + = () + (CmdDeclaration s.ScopeClass e.Name); - (s.Hash1 s.Hash2) (CmdDefineIdent e.Name) = - (s.Hash1 s.Hash2) (CmdDefineIdent e.Name); + (s.Hash1 s.Hash2) (CmdDefineIdent e.Name) + = (s.Hash1 s.Hash2) (CmdDefineIdent e.Name); - (s.Hash1 s.Hash2) (CmdEmitNativeCode t.SrcPos e.Code) = - (s.Hash1 s.Hash2) (CmdEmitNativeCode t.SrcPos e.Code); + (s.Hash1 s.Hash2) (CmdEmitNativeCode t.SrcPos e.Code) + = (s.Hash1 s.Hash2) (CmdEmitNativeCode t.SrcPos e.Code); } HashFuncName { s.Hash1 s.Hash2 e.Name s.Sign - = s.Sign ','>; + = s.Sign>; } SetScopeIDs { From 9e53bc7ab860f73d878687bfc2c626c6765ae1d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 9 Aug 2021 09:45:59 +0300 Subject: [PATCH 096/208] =?UTF-8?q?FIXED:=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=82=D0=B5=D1=80=D0=BC=D0=BE=D0=B2?= =?UTF-8?q?=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=BD=D0=B5=C2=A0?= =?UTF-8?q?=D0=BD=D0=B0=D1=80=D1=83=D1=88=D0=B0=D1=8E=D1=82=20=D0=B8=D0=BD?= =?UTF-8?q?=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD=D1=82=20(#322,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В заявке #318 рассматривается возможность удаления рассахаривателя условий -OC-. А ведь эта ошибка была найдена именно при компиляции рассахаренного кода. --- autotests/opt-tree-match3.ref | 17 +++++++++++++++++ src/compiler/GenericMatch.ref | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 autotests/opt-tree-match3.ref diff --git a/autotests/opt-tree-match3.ref b/autotests/opt-tree-match3.ref new file mode 100644 index 00000000..df0024bf --- /dev/null +++ b/autotests/opt-tree-match3.ref @@ -0,0 +1,17 @@ +* TREE + +$ENTRY Go { + /* empty */ + = : e.A + = : e.B + = : e.C + + = ((x) e.A) (x) e.A (e.B) (x) e.A e.C + : { + (e.X) e.X (e.Y) t.Z e.T = (e.X) (e.Y) t.Z (e.T) + } + : ((x) 'aa') ('bb') (x) ('aacc') + = /* empty */; +} + +gen_e__ { e.arg = e.arg } diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index e8a27229..bda993dc 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -1338,7 +1338,7 @@ SeparateTermLeft { = (('{'s.A'}') t.T ('{'s.B'}')) (/* пусто */); ('{'s.A'}') t.T ('{'s.B'}') e.E - = (('{'s.A'}') t.T ('{'s.B'}')) (('{'s.B'}') e.E); + = (('{'s.A'}') t.T ('{'s.B'}')) (); * {a} T E1* {b} E2 ↦ {a} T {b}, {a} E1* {b} E2 ('{'s.A'}') t.T e.E1 ('{'s.B'}') e.E2 @@ -1353,7 +1353,7 @@ SeparateTermRight { * E {a} T {b} ↦ E {a}, {a} T {b} e.E ('{'s.A'}') t.T ('{'s.B'}') - = (e.E ('{'s.A'}')) (('{'s.A'}') t.T ('{'s.B'}')); + = () (('{'s.A'}') t.T ('{'s.B'}')); * E1 {a} E2* T {b} ↦ E1 {a} E2* {b}, {a} T {b} e.Expr t.T ('{'s.B'}') From b444e2732d6fc1f14b03cc2f198da302d3de9291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 9 Aug 2021 12:04:24 +0300 Subject: [PATCH 097/208] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=81=D0=B2=D0=BE=D0=B1=D0=BE=D0=B4=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BC=D0=B5=D1=81=D1=82=D0=B0=20=D0=BD=D0=B0?= =?UTF-8?q?=C2=A0=D1=81=D0=B5=D1=80=D0=B2=D0=B5=D1=80=D0=B5=20CI=20(#361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI-posix.yml | 5 +++++ .github/workflows/CI-windows.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/CI-posix.yml b/.github/workflows/CI-posix.yml index 979d4088..ef9d31af 100644 --- a/.github/workflows/CI-posix.yml +++ b/.github/workflows/CI-posix.yml @@ -28,6 +28,11 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Check free space + run: | + df -h + shell: bash + - name: Bootstrapping on ${{ matrix.os }} with ${{ matrix.ccomp }} run: | cp .github/workflows/conf-template-${{ matrix.ccomp }}.bash c-plus-plus.conf.sh diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index d75946c3..4427307f 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -19,6 +19,11 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Check free space + run: | + dir + shell: cmd + - name: Bootstrapping with ${{ matrix.ccomp }} run: | copy .github\workflows\conf-template-${{ matrix.ccomp }}.bat c-plus-plus.conf.bat From aef60db02bcbac9bcadcb1f9bb7ba1e140de10e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 9 Aug 2021 14:10:05 +0300 Subject: [PATCH 098/208] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D0=BC=D0=B5=D1=80?= =?UTF-8?q?=D1=8B=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20=D0=B8=C2=A0?= =?UTF-8?q?=D1=81=D0=B2=D0=BE=D0=B1=D0=BE=D0=B4=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=81=D1=82=D1=80=D0=B0=D0=BD=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D0=B0=D0=B9=D0=BD=D1=8B=D1=85=20=D1=82=D0=B5=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=20(#361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit На Windows команда dir также выводит объём свободного места. --- autotests/positive-random-test/run.bat | 2 ++ autotests/positive-random-test/run.sh | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/autotests/positive-random-test/run.bat b/autotests/positive-random-test/run.bat index 204f1ab0..c28b92fa 100644 --- a/autotests/positive-random-test/run.bat +++ b/autotests/positive-random-test/run.bat @@ -14,6 +14,7 @@ goto :EOF :REGRESSION setlocal + dir saved-test-*.ref for %%r in (saved-test-*.ref) do ( call :RUN_TEST "%%r" ^ && call :RUN_TEST "%%r" -Wall ^ @@ -63,6 +64,7 @@ setlocal set NOW=%NOW:/=-% ..\..\bin\nemytykh-random-program-generator.exe %LOOPS% _%NOW% echo gen (%NOW%) %TIME%>>time.txt + dir test-*.ref for %%r in (test-*.ref) do ( call :RUN_TEST "%%r" ^ && call :RUN_TEST "%%r" -Wall ^ diff --git a/autotests/positive-random-test/run.sh b/autotests/positive-random-test/run.sh index bca40ea7..585fa342 100755 --- a/autotests/positive-random-test/run.sh +++ b/autotests/positive-random-test/run.sh @@ -14,6 +14,8 @@ main() { } regression() { + ls -l saved-test-*.ref + df -h . for r in saved-test-*.ref; do if run_test "$r" \ && run_test "$r" -Wall \ @@ -62,6 +64,9 @@ new_tests() { ../../bin/nemytykh-random-program-generator "$LOOPS" "_$NOW" echo "gen ($NOW) $(date)" >> time.txt + ls -l test-*.ref + df -h . + for r in test-*.ref; do if run_test "$r" \ && run_test "$r" -Wall \ From 0266e6f336f928930cd8f363cdf68c053e5157b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 13 Aug 2021 14:52:38 +0300 Subject: [PATCH 099/208] =?UTF-8?q?=D0=9F=D0=BE=D1=87=D1=82=D0=B8=20=D1=80?= =?UTF-8?q?=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:?= =?UTF-8?q?=20back-end=20=D0=BD=D0=B5=C2=A0=D0=B8=D1=81=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=B7=D1=83=D0=B5=D1=82=20=D0=BE=D0=B1=D1=8A=D1=8F=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=84=D1=83=D0=BD=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D0=B9=20(#315)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Почти рефакторинг, т.к. правка влияет на вычисления хешей областей видимости. Но фактически это совершенно нейтральное изменение. --- src/compiler/HighLevelRASL.ref | 5 ++--- src/compiler/LowLevelRASL-Native.ref | 1 - src/compiler/LowLevelRASL-RASL.ref | 3 --- src/compiler/LowLevelRASL.ref | 8 -------- src/compiler/README.md | 2 -- 5 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/compiler/HighLevelRASL.ref b/src/compiler/HighLevelRASL.ref index 893eba1b..86c51548 100644 --- a/src/compiler/HighLevelRASL.ref +++ b/src/compiler/HighLevelRASL.ref @@ -29,7 +29,7 @@ $EXTERN GenResult-Opt; | (s.SingularItem e.Name) | (CmdDefineIdent e.Name) | (CmdEmitNativeCode t.SrcPos e.Code) - s.SingularItem ::= CmdEnum | CmdSwap | CmdDeclaration + s.SingularItem ::= CmdEnum | CmdSwap t.HiRASLCommand ::= (Cmd… e.Value) | (CmdSentence t.HiRASLCommand*) @@ -54,8 +54,7 @@ $ENTRY HighLevelRASL { (Function (e.Name) Swap) = (CmdSwap e.Name); - (Declaration s.ScopeClass e.Name) - = (CmdDeclaration s.ScopeClass e.Name); + (Declaration s.ScopeClass e.Name) = /* пусто */; (Ident e.Name) = (CmdDefineIdent e.Name); diff --git a/src/compiler/LowLevelRASL-Native.ref b/src/compiler/LowLevelRASL-Native.ref index d3bc72b4..5e21b3b8 100644 --- a/src/compiler/LowLevelRASL-Native.ref +++ b/src/compiler/LowLevelRASL-Native.ref @@ -70,7 +70,6 @@ SetCookies { e.Entries s.Hash1 s.Hash2 (CmdSwap e.Name) = /* пропускаем */; e.Entries s.Hash1 s.Hash2 (CmdConditionFunc-ToRASL e.Name) = /* пропускаем */; e.Entries s.Hash1 s.Hash2 (CmdConditionFunc-ToNative e.Name) = /* пропускаем */; - e.Entries s.Hash1 s.Hash2 (CmdDeclaration e.Name) = /* пропускаем */; e.Entries s.Hash1 s.Hash2 (CmdEmitNativeCode t.SrcPos e.Code) = (CmdEmitNativeCode t.SrcPos e.Code); } diff --git a/src/compiler/LowLevelRASL-RASL.ref b/src/compiler/LowLevelRASL-RASL.ref index 8f6ccb19..26da2071 100644 --- a/src/compiler/LowLevelRASL-RASL.ref +++ b/src/compiler/LowLevelRASL-RASL.ref @@ -74,9 +74,6 @@ ClassifyItems { = (e.DefinedFunctions (e.Name)) (CmdConditionFuncDecsrNative e.Name); - (e.DefinedFunctions) (CmdDeclaration e.Name) - = (e.DefinedFunctions (e.Name)) /* skip */; - (e.DefinedFunctions) (CmdEmitNativeCode t.SrcPos e.Code) = (e.DefinedFunctions) /* skip */; } diff --git a/src/compiler/LowLevelRASL.ref b/src/compiler/LowLevelRASL.ref index ceafac4e..223237f4 100644 --- a/src/compiler/LowLevelRASL.ref +++ b/src/compiler/LowLevelRASL.ref @@ -104,10 +104,6 @@ CalcDigest-Aux { = () (CmdConditionFunc e.Name); - (s.Hash1 s.Hash2) (CmdDeclaration s.ScopeClass e.Name) - = () - (CmdDeclaration s.ScopeClass e.Name); - (s.Hash1 s.Hash2) (CmdDefineIdent e.Name) = (s.Hash1 s.Hash2) (CmdDefineIdent e.Name); @@ -211,10 +207,6 @@ OutlineConstants-WithNative { = : t.Tables^ s.Id = t.Tables (s.Definition e.Name); - t.Tables (CmdDeclaration s.ScopeClass e.Name) - = : t.Tables^ s.Id - = t.Tables (CmdDeclaration s.ScopeClass e.Name); - t.Tables (CmdDefineIdent e.Name) = : t.Tables^ s.Id = t.Tables; diff --git a/src/compiler/README.md b/src/compiler/README.md index 04e64353..5229e960 100644 --- a/src/compiler/README.md +++ b/src/compiler/README.md @@ -411,7 +411,6 @@ t.CmdTopLevelItem ::= (CmdEnum e.Name) | (CmdSwap e.Name) - | (CmdDeclaration s.ScopeClass e.Name) | (CmdConditionFunc e.Name) | (CmdDefineIdent e.Name) | (CmdEmitNativeCode t.SrcPos e.Code) @@ -510,7 +509,6 @@ * (`CmdNativeFunction` — функция, написанная на целевом коде), * `CmdEnum` — пустая функция, * `CmdSwap` — статический ящик, - * `CmdDeclaration` — объявление функции, * `CmdConditionFunc` — определение функции-замыкания, * `CmdDefineIdent` — определение идентификатора, * `CmdEmitNativeCode` — кусок целевого кода, выводимый как есть. From 978002d9dd0cce0fcb787a1b4429dc4e0543381b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 13 Aug 2021 16:48:30 +0300 Subject: [PATCH 100/208] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B5=20=D1=83?= =?UTF-8?q?=D0=B7=D0=BB=D1=8B=20=D0=B4=D0=B5=D1=80=D0=B5=D0=B2=D0=B0=20Ext?= =?UTF-8?q?erns,=20Drives,=20Inlines,=20Intrinsics=20(#315)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Формально это не рефакторинг, т.к. в режиме -OS может измениться порядок пустых функций F@0, созданных для $EXTERN’ов, также изменился вывод дерева в лог. Но фактически правки нейтральные. --- src/compiler/Desugaring.ref | 177 +++++++--------------- src/compiler/HighLevelRASL.ref | 2 +- src/compiler/Log-AST.ref | 16 +- src/compiler/Log.ref | 9 +- src/compiler/OptTree-AutoMarkup-Drive.ref | 66 +++----- src/compiler/OptTree-Drive.ref | 26 ++-- src/compiler/OptTree-Spec.ref | 5 +- src/compiler/OptTree.ref | 6 +- src/compiler/README.md | 9 +- 9 files changed, 115 insertions(+), 201 deletions(-) diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index b6ab8f5e..ddccc81a 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -16,7 +16,6 @@ $ENTRY Desugar { &Pass-RemovePos &Pass-UnfoldEnumsAndSwaps &Pass-ExtractEntries - &Pass-RemoveRedundantDriveInlineIntrinsic &Pass-EnumerateVariables &Pass-NameNestedFuncs &Pass-RemoveBlocksAndAssigns @@ -28,7 +27,7 @@ $ENTRY Desugar { Conditions-Transform = (&Pass-UnCondition s.MarkupContext); } > - &Pass-CleanupRedudandExterns + &Pass-CollectDeclarations > >; } @@ -181,67 +180,6 @@ Entry { GN-Local e.Name = /* пропускаем */; } -Pass-RemoveRedundantDriveInlineIntrinsic { - e.AST - = - : (e.Labels) e.AST^ - - = - : () e.AST^ - = e.AST; -} - $ENTRY Pass-EnumerateVariables { e.AST = - : (e.DefinedFunctions) e.AST^ - = - : (e.DefinedFunctions^) e.AST^ + : e.AST^ - = + : e.AST^ + (GROUP Externs e.Externs) + (GROUP Drives e.Drives) + (GROUP Inlines e.Inlines) + (GROUP Intrinsics e.Intrinsics) + (GROUP DefinedFunctions e.DefinedFunctions) + + = : e.Externs^ + = : e.Drives^ + = : e.Inlines^ + = : e.Intrinsics^ + + = : e.Externs^ + = : e.Inlines^ + = : e.Intrinsics^ + + = (Externs e.Externs) + (Drives e.Drives) (Inlines e.Inlines) (Intrinsics e.Intrinsics) + e.AST +} - (e.DeclaredFunctions) (Declaration s.ScopeClass e.Name) - = (e.DeclaredFunctions (e.Name)) - (Declaration s.ScopeClass e.Name); +CollectDeclarations-Group { + e.AST-B (GROUP s.Group e.Names-B) e.AST-M (GROUP s.Group e.Names-E) e.AST-E + = e.AST-B + ; - (e.DeclaredFunctions) t.Other - = (e.DeclaredFunctions) t.Other; - } - (/* declared functions */) e.AST - > - : (e._) e.AST^ - = e.AST; + e.AST = e.AST; } -RemoveRedundantDeclarations { - (e.DefinedFunctions-B (e.Name) e.DefinedFunctions-E) - (Declaration s.ScopeClass e.Name) - = (e.DefinedFunctions-B (e.Name) e.DefinedFunctions-E) - /* пусто */; +Set-Reject { + (e.Minuent-B t.Repeated e.Minuent-E) (e.Subtr-B t.Repeated e.Subtr-E) + = e.Minuent-B ; - (e.DefinedFunctions) t.OtherItem = (e.DefinedFunctions) t.OtherItem; + (e.Minuent) (e.Subtrahend) = e.Minuent; } diff --git a/src/compiler/HighLevelRASL.ref b/src/compiler/HighLevelRASL.ref index 86c51548..5e9814cd 100644 --- a/src/compiler/HighLevelRASL.ref +++ b/src/compiler/HighLevelRASL.ref @@ -54,7 +54,7 @@ $ENTRY HighLevelRASL { (Function (e.Name) Swap) = (CmdSwap e.Name); - (Declaration s.ScopeClass e.Name) = /* пусто */; + (Externs e.Names) = /* пусто */; (Ident e.Name) = (CmdDefineIdent e.Name); diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index a28fec4f..e1c8344c 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -30,14 +30,10 @@ Element { (ColdFunction s.ColdBy (e.Name) e.Body) = ; - (Declaration GN-Entry e.Name) = ('$EXTERN ' ';'); - (Declaration GN-Local e.Name) = ('$FORWARD ' ';'); - - (Inline e.Name) = ('$INLINE ' ';'); - - (Drive e.Name) = ('$DRIVE ' ';'); - - (Intrinsic e.Name) = ('$INTRINSIC ' ';'); + (Externs e.Names) = (); + (Inlines e.Names) = (); + (Drives e.Names) = (); + (Intrinsics e.Names) = (); (Ident e.Name) = ('$LABEL ' ';'); @@ -68,6 +64,10 @@ $ENTRY Log-EntryList { e.Names = ; } +$ENTRY Log-ExternList { + e.Names = ; +} + NameList { (e.OutLine) e.Names , : True diff --git a/src/compiler/Log.ref b/src/compiler/Log.ref index 0f04287a..4f943078 100644 --- a/src/compiler/Log.ref +++ b/src/compiler/Log.ref @@ -10,7 +10,7 @@ $EXTERN DisplayName; $EXTERN EscapeString; *$FROM Log-AST -$EXTERN Log-TextFromAST, Log-EntryList; +$EXTERN Log-TextFromAST, Log-EntryList, Log-ExternList; /** @@ -124,6 +124,10 @@ PutProgramElement { (Entries e.Names) = >; + s.FileHandle + (Externs e.Names) + = >; + s.FileHandle (Function (e.Name) e.Commands) = ; @@ -155,9 +159,6 @@ PutProgramElement { s.FileHandle (CmdConditionFunc e.Name) = ' :: condition'>; - s.FileHandle (CmdDeclaration e.Name) - = ' :: extern'>; - s.FileHandle (CmdDefineIdent e.Name) = >; diff --git a/src/compiler/OptTree-AutoMarkup-Drive.ref b/src/compiler/OptTree-AutoMarkup-Drive.ref index ff7c0746..1833c6d0 100644 --- a/src/compiler/OptTree-AutoMarkup-Drive.ref +++ b/src/compiler/OptTree-AutoMarkup-Drive.ref @@ -42,19 +42,13 @@ BuldCallGraph { MetaInfo { e.AST - = e.AST : e.AST-B (Entries e.Entries) e.AST-E - = ((/* forbidden list */) (/* inlines */) (/* drives */)) : t.InitMetaInfo + = : (e.Entries) e.AST^ + = : (e.Drives) e.AST^ + = : (e.Inlines) e.AST^ + = : (e.Intrinsics) e.AST^ + = (/* forbidden list */) : t.InitMetaInfo = (Inline e.Name); - - t.MetaInfo (Drive e.Name) - = (Drive e.Name); - - t.MetaInfo (Intrinsic e.Name) - = (Intrinsic e.Name); - t.MetaInfo (Function (e.FuncName) Sentences @@ -84,26 +78,24 @@ MetaInfo { t.MetaInfo t.Other = t.MetaInfo t.Other; } - t.InitMetaInfo e.AST-B e.AST-E + t.InitMetaInfo e.AST > - : ((e.Forbidden) (e.Inlines) (e.Drives)) e.AST^ - = ((e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)) - (Entries e.Entries) e.AST + : (e.Forbidden) e.AST^ + = ((e.Intrinsics e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)) + (Entries e.Entries) + (Drives e.Drives) + (Inlines e.Inlines) + (Intrinsics e.Intrinsics) + e.AST } -MetaInfo-AddInline { - ((e.Forbidden) (e.Inlines) (e.Drives)) e.Name - = ((e.Forbidden (e.Name)) (e.Inlines (e.Name)) (e.Drives)); -} - -MetaInfo-AddDrive { - ((e.Forbidden) (e.Inlines) (e.Drives)) e.Name - = ((e.Forbidden) (e.Inlines) (e.Drives (e.Name))); +MetaInfo-ExtractNode { + s.Node e.AST-B (s.Node e.Names) e.AST-E = (e.Names) e.AST-B e.AST-E; + s.Node e.AST = (/* пусто */) e.AST; } MetaInfo-AddForbidden { - ((e.Forbidden) (e.Inlines) (e.Drives)) e.Name - = ((e.Forbidden (e.Name)) (e.Inlines) (e.Drives)); + (e.Forbidden) e.Name = (e.Forbidden (e.Name)); } Pseudofunction-gen_e { @@ -499,26 +491,10 @@ SetDifference { } UpdateAST { - e.AST (e.FunctionsToDrive) (e.BasisVertexes) - = - : (e._) e.AST^ - = e.AST - + e.AST-B (Drives e.Drives) e.AST-E (e.NewDrives) (e.BasisVertexes) + = e.AST-B + (Drives e.NewDrives) + e.AST-E } /** diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index 5ae7b696..50b17ffc 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -70,9 +70,9 @@ BaseName { UpdateDriveInfo { s.OptDrive s.OptIntrinsic ((e.KnownNames) e.KnownFunctions) e.AST - = : (e.Drives) e.AST^ - = : (e.Inlines) e.AST^ - = : (e.Intrinsics) e.AST^ + = : (e.Drives) e.AST^ + = : (e.Inlines) e.AST^ + = : (e.Intrinsics) e.AST^ = : (e.Metatables) e.AST^ = : e.Drives^ @@ -155,17 +155,17 @@ UpdateDriveInfo { } ExtractLabels { - s.Label e.AST - = ; -} - -DoExtractLabels { - s.Label (e.FoundLabels) (e.Scanned) e.AST-B (s.Label e.Name) e.AST-E - = ; + s.Label s.Node e.AST-B (s.Node e.Names) e.AST-E + = + : e.Names^ + = (e.Names) e.AST-B e.AST-E; - s.Label (e.FoundLabels) (e.Scanned) e.AST = (e.FoundLabels) e.Scanned e.AST; + s.Label s.Node e.AST = (/* пусто */) e.AST; } ExtractMetatableNames { diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index bc03e8ff..f4d688de 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -145,8 +145,9 @@ AddGuardEnums { (Function (e.Name) e.Body) = (Function (e.Name) e.Body) ; - (Declaration s.ScopeClass e.Name) - = (Declaration s.ScopeClass e.Name) ; + (Externs e.Names) + = (Externs e.Names) + } e.Names>; t.OtherItem = t.OtherItem; } diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index e5040df1..3c1d369d 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -103,9 +103,9 @@ $ENTRY OptTree-CleanupMarkup { e.AST = Date: Fri, 13 Aug 2021 17:02:44 +0300 Subject: [PATCH 101/208] =?UTF-8?q?=D0=A1=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0:=20=D0=B2?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BD=D0=BD=D1=83=D1=8E=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E=20=D0=BE=D0=B1=D1=8A=D1=8F?= =?UTF-8?q?=D0=B2=D0=BB=D1=8F=D1=82=D1=8C=20=D0=BD=D0=B5=C2=A0=D0=BD=D1=83?= =?UTF-8?q?=D0=B6=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Log.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/Log.ref b/src/compiler/Log.ref index 4f943078..63ee1978 100644 --- a/src/compiler/Log.ref +++ b/src/compiler/Log.ref @@ -1,5 +1,5 @@ *$FROM Library -$EXTERN Open-Auto, Close; +$EXTERN Open-Auto; $INCLUDE "LibraryEx"; From 979c2dc7d36588be13effdf35ef9d1bd4fdb0147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 13 Aug 2021 18:06:35 +0300 Subject: [PATCH 102/208] =?UTF-8?q?=D0=A1=D0=BF=D0=B5=D1=86=D0=B8=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B7=D0=B0=D1=82=D0=BE=D1=80=20=D0=B8=D0=B3=D0=BD?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D1=80=D1=83=D0=B5=D1=82=20=D1=88=D0=B0=D0=B1?= =?UTF-8?q?=D0=BB=D0=BE=D0=BD=20=D1=81=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B2=C2=A0=D0=B4=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B2=D0=B5=20(#314,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • На дно истории кладётся ГСО от образцов функции. • Шаблон специализации удалён из всех форматов за ненадобностью. --- src/compiler/GlobalGen.ref | 35 ++++++++++++++ src/compiler/OptTree-Spec.ref | 91 +++++++++++++++++++---------------- 2 files changed, 84 insertions(+), 42 deletions(-) diff --git a/src/compiler/GlobalGen.ref b/src/compiler/GlobalGen.ref index 12988c0f..df4fc4fa 100644 --- a/src/compiler/GlobalGen.ref +++ b/src/compiler/GlobalGen.ref @@ -278,3 +278,38 @@ CalcTermComplexity { (Brackets e.Terms) = 2>; (ADT-Brackets t.Name e.Terms) = 2>; } + + +/** + == e.Pattern + + Аналогично GlobalGen, но переменные получают последовательные числовые + индексы: s.1 e.2 t.3... +*/ +$ENTRY GlobalGen-NamedVars { + e.Patterns = >; +} + +NameVariables { + e.Pattern + = : s._ e.Pattern^ + = e.Pattern +} + +NameVariables-Rec { + s.NextId e.Terms = +} + +NameVariables-Term { + s.NextId (Var s.Mode) = (Var s.Mode ); + + s.NextId (Brackets e.Nested) + = : s.NextId^ e.Nested^ + = s.NextId (Brackets e.Nested); + + s.NextId (ADT-Brackets (e.Name) e.Nested) + = : s.NextId^ e.Nested^ + = s.NextId (ADT-Brackets (e.Name) e.Nested); + + s.NextId t.Other = s.NextId t.Other; +} diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index f4d688de..937f3a9e 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -17,7 +17,7 @@ $EXTERN Solve-Spec, GenericMatch; $EXTERN OptTree-CanonizeExpr, OptTree-CheckExprStopRelation; *$FROM GlobalGen -$EXTERN GlobalGen; +$EXTERN GlobalGen-NamedVars, GlobalGen; /** @@ -30,7 +30,7 @@ $EXTERN GlobalGen; e.SpecInfo ::= (e.SpecFuncNames) e.SpecInfo-Specific e.SpecFuncNames ::= (e.FuncName)* e.SpecInfo-Specific ::= t.FunctionInfo* (e.Histories) - t.FunctionInfo ::= ((e.Name) (e.Pattern) (e.Body) s.NextCounter t.Signature*) + t.FunctionInfo ::= ((e.Name) (e.Body) s.NextCounter t.Signature*) t.Signature ::= ((e.InstanceName) e.Expression) e.InstanceName ::= e.Name e.Histories ::= ((e.InstanceName) e.History)* @@ -43,8 +43,7 @@ $ENTRY OptTree-Spec-Prepare { = ; OptSpec e.AST - = (/* no names */) /* no info */ (/* no histories */) - : e.EmptyInfo + = (/* no names */) /* no info */ (/* no histories */) : e.EmptyInfo = ; } @@ -56,21 +55,17 @@ Prepare-Aux { (&MapAccum { /* Игнорируем новые $SPEC’и для известных функций */ - ((e.Names) e.Info (e.Histories)) (Spec t.Name e.Pattern) + ((e.Names) e.Info (e.Histories)) (Spec t.Name e._Pattern) , e.KnownNames : e._B t.Name e._E = ((e.Names) e.Info (e.Histories)) /* пропускаем */; - ((e.Names) e.Info (e.Histories)) (Spec t.Name e.Pattern) + ((e.Names) e.Info (e.Histories)) (Spec t.Name e._Pattern) = t.Name : (e.Name) = ( (e.Names t.Name) - e.Info (t.Name (e.Pattern)) - (e.Histories ) + e.Info (t.Name) (e.Histories) ) - ' ' - - >; + >; ((e.Names) e.Info (e.Histories)) t.Other = ((e.Names) e.Info (e.Histories)) t.Other; @@ -78,12 +73,14 @@ Prepare-Aux { ) (&MapAccum { - ((e.Names) e.Info-B (t.Name (e.Pattern)) e.Info-E (e.Histories)) + ((e.Names) e.Info-B (t.Name) e.Info-E (e.Histories)) (Function t.Name Sentences e.Body) + = t.Name : (e.Name) + = : e.Pattern = ( (e.Names) - e.Info-B (t.Name (e.Pattern) (e.Body) 1) e.Info-E - (e.Histories) + e.Info-B (t.Name (e.Body) 1) e.Info-E + (e.Histories ) ) (Function t.Name Sentences e.Body); @@ -115,6 +112,18 @@ TrivialHistory { = ((e.Name) (e.HistoryRecord)); } +BottomSignature { + e.Sentences + = + > +} + * Добавляет вызов аварийной функции Func@0 в конец каждой специализируемой * функции.Этот вызов облегчает отладку при аварийном завершении программы * в специализированной функции. @@ -122,14 +131,13 @@ AddGuardSentences { e.Info = : e.GuardName - = (e.SpecPattern) - ((CallBrackets (Symbol Name e.GuardName) e.SpecPattern)) + = ((Var 'eARG')) + ((CallBrackets (Symbol Name e.GuardName) (Var 'eARG'))) : e.GuardSentence = ( (e.Name) - (e.SpecPattern) (e.Sentences (e.GuardSentence)) e.Signatures ) @@ -172,20 +180,20 @@ CreateRemainderFunctions { } CreateRemainderFunctions-OneFunction { - s.Count ((e.Name) (e.SpecPattern) ((e.GuardSentence)) 1 /* нет сигнатур */) + s.Count ((e.Name) ((e.GuardSentence)) 1 /* нет сигнатур */) = /* пусто */; - s.Count ((e.Name) (e.SpecPattern) (e.Sentences) 1 /* нет сигнатур */) + s.Count ((e.Name) (e.Sentences) 1 /* нет сигнатур */) = s.Count : { 0 = e.Name; s._ = ; } : e.RemainderName - = ((e.RemainderName) (e.SpecPattern) (e.Sentences) 1 /* нет сигнатур */) + = ((e.RemainderName) (e.Sentences) 1 /* нет сигнатур */) - ((e.Name) (e.SpecPattern) () 1 /* нет сигнатур */) + ((e.Name) () 1 /* нет сигнатур */) >; } @@ -515,10 +523,9 @@ TrySpecCall { /** - == ((e.SpecPattern) (e.Body) s.NextNumber e.Signatures t.NewSignature) + == ((e.Body) s.NextNumber e.Signatures t.NewSignature) t.NewCall t.NewFunction (e.NewHistory) Функция пытается выполнить специализацию для заданного вызова: @@ -534,14 +541,14 @@ TrySpecCall { SpecCall { /* TODO: убрать этот хак в рамках задачи #332 */ - (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.Argument) (e.History) , s.NextNumber : 100 - = ((e.SpecPattern) (e.Body) s.NextNumber e.Signatures) + = ((e.Body) s.NextNumber e.Signatures) (CallBrackets (Symbol Name e.Name) e.Argument) /* пусто */ (/* пусто */); - (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.Argument) (e.History) = : e.UsedVars @@ -559,7 +566,7 @@ SpecCall { : (e.NewArgument^) (e.Sg^) (e.Solutions) = ; @@ -693,16 +700,16 @@ RemoveAssignByLeftPart { SpecCall-Aux { /* тривиальная сигнатура */ - (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) s.NeedRelationCheck , : True - = ((e.SpecPattern) (e.Body) s.NextNumber e.Signatures) + = ((e.Body) s.NextNumber e.Signatures) (CallBrackets (Symbol Name e.Name) e.OldArg) /* пусто */ (/* пусто */); /* проверяем, известна ли сигнатура */ - (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) s.NeedRelationCheck = @@ -710,7 +717,7 @@ SpecCall-Aux { = : { Found e.InstanceName (e.Signatures^) - = ((e.SpecPattern) (e.Body) s.NextNumber e.Signatures) + = ((e.Body) s.NextNumber e.Signatures) (CallBrackets (Symbol Name e.InstanceName) (e.Sg)> @@ -720,7 +727,7 @@ SpecCall-Aux { /* проверяем на зацикливание */ NotFound e.Signatures^ = ; @@ -728,7 +735,7 @@ SpecCall-Aux { } SpecCall-NewSignature { - (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) s.NeedRelationCheck (e.Signature) = s.NeedRelationCheck @@ -743,21 +750,21 @@ SpecCall-NewSignature { : { True e.HistorySignature = ; False = ; } } SpecCall-NewSignature-Generalize { - (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) (e.HistorySignature) /* Получает обобщённую сигнатуру для двух сигнатур */ @@ -790,20 +797,20 @@ SpecCall-NewSignature-Generalize { > : (e.NewArg^) (e.Sg^) (e.Solutions^) = ; } SpecCall-NewSignature-MakeFunction { - (e.Name) (e.SpecPattern) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) = : e.NewSentences = : e.InstanceName = ( - (e.SpecPattern) (e.Body) + (e.Body) e.Signatures ((e.InstanceName) e.Signature) ) (CallBrackets From e4155864f1b0b0da234f273be2ef7e7e6afdd97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 13 Aug 2021 18:25:14 +0300 Subject: [PATCH 103/208] =?UTF-8?q?=D0=9F=D0=BE=D1=87=D1=82=D0=B8=20=D1=80?= =?UTF-8?q?=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:?= =?UTF-8?q?=20=D1=83=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=B4=D1=83=D0=B1=D0=BB=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4=D0=B0=20(#314,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Почти рефакторинг, т.к. в HighLevelRASL-ConjointFunc.ref переменные получали индексы v.newNN, а теперь просто v.NN. Так что содержимое лога изменилось. Но изменение нейтральное. --- src/compiler/GlobalGen.ref | 19 +++++++------- src/compiler/HighLevelRASL-ConjointFunc.ref | 29 +++------------------ src/compiler/OptTree-Spec.ref | 17 ++++++------ 3 files changed, 22 insertions(+), 43 deletions(-) diff --git a/src/compiler/GlobalGen.ref b/src/compiler/GlobalGen.ref index df4fc4fa..a5c21eea 100644 --- a/src/compiler/GlobalGen.ref +++ b/src/compiler/GlobalGen.ref @@ -281,22 +281,21 @@ CalcTermComplexity { /** - == e.Pattern + == e.Pattern^ + == s.NextId^ e.Pattern^ + + s.NextId ::= s.NUMBER Аналогично GlobalGen, но переменные получают последовательные числовые индексы: s.1 e.2 t.3... */ -$ENTRY GlobalGen-NamedVars { - e.Patterns = >; -} - -NameVariables { +$ENTRY GlobalGen-NameVariables { e.Pattern - = : s._ e.Pattern^ + = : s._ e.Pattern^ = e.Pattern } -NameVariables-Rec { +$ENTRY GlobalGen-NameVariables-Rec { s.NextId e.Terms = } @@ -304,11 +303,11 @@ NameVariables-Term { s.NextId (Var s.Mode) = (Var s.Mode ); s.NextId (Brackets e.Nested) - = : s.NextId^ e.Nested^ + = : s.NextId^ e.Nested^ = s.NextId (Brackets e.Nested); s.NextId (ADT-Brackets (e.Name) e.Nested) - = : s.NextId^ e.Nested^ + = : s.NextId^ e.Nested^ = s.NextId (ADT-Brackets (e.Name) e.Nested); s.NextId t.Other = s.NextId t.Other; diff --git a/src/compiler/HighLevelRASL-ConjointFunc.ref b/src/compiler/HighLevelRASL-ConjointFunc.ref index 3019c05c..aed589df 100644 --- a/src/compiler/HighLevelRASL-ConjointFunc.ref +++ b/src/compiler/HighLevelRASL-ConjointFunc.ref @@ -7,8 +7,8 @@ $EXTERN GenPattern, MakeSavers, GenResult; $EXTERN GenericMatch; *$FROM GlobalGen -$EXTERN BuildImage, BuildImage-Term, Generalization, Generalization-Term, - Collapse, Collapse-Term; +$EXTERN GlobalGen-NameVariables-Rec, BuildImage, BuildImage-Term, + Generalization, Generalization-Term, Collapse, Collapse-Term; $ENTRY HighLevelRASL-Function-Conjoint { @@ -177,34 +177,13 @@ ComposeVars { (e.MarkedPattern) () = (Junk e.MarkedPattern); } -/* Добавляет уникальные индексы */ -EnumerateVarsRec { - s.NextNumber e.Expr - = (Var s.Type 'new' ); - - s.Next (Brackets e.Nested) - = : s.Next^ e.Nested^ - = s.Next (Brackets e.Nested); - - s.Next (ADT-Brackets (e.Name) e.Nested) - = : s.Next^ e.Nested^ - = s.Next (ADT-Brackets (e.Name) e.Nested); - - s.Next t.OtherTerm = s.Next t.OtherTerm; - } - s.NextNumber e.Expr - >; -} - EnumerateVars-Subst { s.StartNumber s.Depth e.Substitute = : s.NextNumber^ e.Value^ + = + : s.NextNumber^ e.Value^ = s.NextNumber (e.Value ':' (e.Var)) } s.StartNumber e.Substitute diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 937f3a9e..14fbe5b2 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -17,7 +17,7 @@ $EXTERN Solve-Spec, GenericMatch; $EXTERN OptTree-CanonizeExpr, OptTree-CheckExprStopRelation; *$FROM GlobalGen -$EXTERN GlobalGen-NamedVars, GlobalGen; +$EXTERN GlobalGen-NameVariables, GlobalGen; /** @@ -114,14 +114,15 @@ TrivialHistory { BottomSignature { e.Sentences - = + = + : e.Patterns + = : e.GlobalGen + = } * Добавляет вызов аварийной функции Func@0 в конец каждой специализируемой From 32db05efd1892151e999f62448526089f83bddf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 13 Aug 2021 18:43:00 +0300 Subject: [PATCH 104/208] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=BE=D0=B9=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20=D0=B2=C2=A0OptTree-Spec.ref=20(#314?= =?UTF-8?q?,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 87 ++++++++++++++++------------------- 1 file changed, 39 insertions(+), 48 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 14fbe5b2..f85f0f0c 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -49,47 +49,46 @@ $ENTRY OptTree-Spec-Prepare { Prepare-Aux { ((e.KnownNames) e.KnownInfo (e.KnownHistories)) e.AST - = >; - - ((e.Names) e.Info (e.Histories)) t.Other - = ((e.Names) e.Info (e.Histories)) t.Other; - } - ) - (&MapAccum - { - ((e.Names) e.Info-B (t.Name) e.Info-E (e.Histories)) - (Function t.Name Sentences e.Body) - = t.Name : (e.Name) - = : e.Pattern - = ( - (e.Names) - e.Info-B (t.Name (e.Body) 1) e.Info-E - (e.Histories ) - ) - (Function t.Name Sentences e.Body); - - ((e.Names) e.Info) t.Other = ((e.Names) e.Info) t.Other; - } - ) - > + = >; + + (e.Names) t.Other = (e.Names) t.Other; + } + (/* no names */) e.AST > - : ((e.NewNames) e.NewInfo (e.NewHistories)) e.AST^ + : (e.NewNames) e.AST^ + + = + : (e.NewInfo) e.AST^ + + = : e.Pattern + = () e.Pattern : e.HistoryRecord + = ((e.Name) (e.HistoryRecord)); + } + e.NewInfo + > + : e.NewHistories = : e.NewInfo^ = : e.AST^ @@ -104,14 +103,6 @@ Prepare-Aux { e.AST } -TrivialHistory { - e.Name (e.Pattern) - = () - e.Pattern - : e.HistoryRecord - = ((e.Name) (e.HistoryRecord)); -} - BottomSignature { e.Sentences = Date: Fri, 13 Aug 2021 19:39:44 +0300 Subject: [PATCH 105/208] =?UTF-8?q?=D0=A8=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=20?= =?UTF-8?q?=D1=81=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D1=83=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20?= =?UTF-8?q?=D0=B8=D0=B7=C2=A0=D1=80=D0=B0=D1=81=D1=81=D0=B0=D1=85=D0=B0?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B4=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B2=D0=B0=20(#314,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Почти рефакторинг, т.к. изменился вывод в отладочный лог. В этом коммите OptTree-AutoMarkup-Spec тем не менее вычисляет шаблоны специализации, но в дерево они не добавляются. Смысл в том, чтобы сделать этот коммит почти рефакторингом — OptTree-AutoMarkup-Spec должен помечать для специализации те же функции, что и раньше. P.S. Этот коммит перезаписывает коммит ca86b6bb031, ошибочно приписанный к заявке #315. --- src/compiler/Desugaring-UnCondition.ref | 4 ++-- src/compiler/Desugaring.ref | 13 ++++++---- src/compiler/Log-AST.ref | 3 +-- src/compiler/Log.ref | 4 ---- src/compiler/OptTree-AutoMarkup-Spec.ref | 18 +++++++++----- src/compiler/OptTree-Spec.ref | 30 +++++++++++++++--------- src/compiler/OptTree.ref | 2 +- src/compiler/README.md | 1 + src/compiler/TreeUtils.ref | 19 --------------- 9 files changed, 44 insertions(+), 50 deletions(-) diff --git a/src/compiler/Desugaring-UnCondition.ref b/src/compiler/Desugaring-UnCondition.ref index aa71c0e0..a1e5f9e4 100644 --- a/src/compiler/Desugaring-UnCondition.ref +++ b/src/compiler/Desugaring-UnCondition.ref @@ -1,7 +1,7 @@ $INCLUDE "LibraryEx"; *$FROM TreeUtils -$EXTERN AddSuffix, ExtractVariables, CreateSpecPatternForContext, +$EXTERN AddSuffix, ExtractVariables, CreateContext, ExtractVariables-Expr, NewVarName; @@ -461,7 +461,7 @@ UnCondition-Sentence { ) ) (Drive e.CheckFunction) - (Spec (e.CheckFunction) ) + (Spec e.CheckFunction) t.CheckFunction e.OpenEFunctions; } diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index ddccc81a..035abcec 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -4,8 +4,7 @@ $INCLUDE "LibraryEx"; $EXTERN Pass-UnCondition; *$FROM TreeUtils -$EXTERN NewVarName, AddSuffix, CreateContext, CreateSpecPatternForContext, - ExtractVariables-Expr; +$EXTERN NewVarName, AddSuffix, CreateContext, ExtractVariables-Expr; $ENTRY Desugar { @@ -43,8 +42,7 @@ $ENTRY Pass-RemovePos { (NativeBlock t.SrcPos e.Code) = (NativeBlock t.SrcPos e.Code); - (Spec t.SrcPos (e.Name) e.Pattern) - = (Spec (e.Name) ); + (Spec t.SrcPos (e.Name) e.Pattern) = (Spec e.Name); (s.EnumSwapDeclaration t.SrcPos s.ScopeClass e.Name) = (s.EnumSwapDeclaration s.ScopeClass e.Name); @@ -767,7 +765,7 @@ ExtractNested-Result-Term { > ) (Drive e.ClosureName) - (Spec (e.ClosureName) ) + (Spec e.ClosureName) : e.AST^ @@ -831,12 +831,14 @@ Pass-CollectDeclarations { (GROUP Drives e.Drives) (GROUP Inlines e.Inlines) (GROUP Intrinsics e.Intrinsics) + (GROUP Specs e.Specs) (GROUP DefinedFunctions e.DefinedFunctions) = : e.Externs^ = : e.Drives^ = : e.Inlines^ = : e.Intrinsics^ + = : e.Specs^ = : e.Externs^ = : e.Inlines^ @@ -844,6 +846,7 @@ Pass-CollectDeclarations { = (Externs e.Externs) (Drives e.Drives) (Inlines e.Inlines) (Intrinsics e.Intrinsics) + (Specs e.Specs) e.AST } diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index e1c8344c..4679c7a4 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -39,8 +39,7 @@ Element { (NativeBlock t.SrcPos e.Code) = ('%% native block %%'); - (Spec (e.Name) e.Pattern) - = ('$SPEC ' ' ' ';'); + (Specs e.Names) = (); (DriveInfo e.DriveInfo) = ('(DriveInfo ...)'); (SpecInfo e.SpecInfo) = ('(SpecInfo ...)'); diff --git a/src/compiler/Log.ref b/src/compiler/Log.ref index 63ee1978..50049f1a 100644 --- a/src/compiler/Log.ref +++ b/src/compiler/Log.ref @@ -166,10 +166,6 @@ PutProgramElement { = ; - - s.FileHandle (Spec (e.Name) e.Pattern) - = > - } PutRASLFunction { diff --git a/src/compiler/OptTree-AutoMarkup-Spec.ref b/src/compiler/OptTree-AutoMarkup-Spec.ref index 34e5d35c..8a6ff4bc 100644 --- a/src/compiler/OptTree-AutoMarkup-Spec.ref +++ b/src/compiler/OptTree-AutoMarkup-Spec.ref @@ -37,18 +37,24 @@ $ENTRY OptTree-AutoMarkup-Spec { e.AST > : e.SpecPatterns - = e.AST - ; + = + > } ForbiddenToSpecFunctions { e.AST = >; + (e.Name), e.KnownNames : e._B (e.Name) e._E = /* пропускаем */; + (e.Name) = (e.Name); + } + e.NewNames + > + : e.NewNames^ - (e.Names) t.Other = (e.Names) t.Other; + = > } - (/* no names */) e.AST + e.NewNames > - : (e.NewNames) e.AST^ + : /* пусто */ = ; } -/** - == e.Expression -*/ -$ENTRY CreateSpecPatternForContext { - e.Context - = - (Var 'edyn') -} - /** == e.Name From b2321e2bdb38667d4e24ff39f186fc57edabee59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 14 Aug 2021 08:22:28 +0300 Subject: [PATCH 106/208] =?UTF-8?q?FIXED:=20=D0=BA=D0=B2=D0=B0=D0=B4=D1=80?= =?UTF-8?q?=D0=B0=D1=82=D0=B8=D1=87=D0=BD=D1=8B=D0=B9=20=D1=80=D0=B0=D0=B7?= =?UTF-8?q?=D0=BC=D0=B5=D1=80=20=D0=B4=D0=B0=D0=BC=D0=BF=D0=B0=20=D0=BE?= =?UTF-8?q?=D1=82=C2=A0=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=8F=20=D0=B7=D1=80=D0=B5=D0=BD=D0=B8=D1=8F=20(#3?= =?UTF-8?q?59,=20#361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В дампе поля зрения вложенные вызовы печатаются с отступом, поэтому в случае нехвостовой рекурсии размер дампа квадратично зависел от глубины вложенности (отступы росли «треугольником»). В случае, если в такой рекурсии происходило зацикливание, объём лога мог быть неадекватно большим, что приводило к проблемам на сервере CI. Теперь уровень вложенности ограничен 80 колонками, так что объём дампа имеет линейную сложность от глубины вложенности. --- src/lib/refalrts-vm.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/refalrts-vm.cpp b/src/lib/refalrts-vm.cpp index 27c0cd0f..a6abb4ed 100644 --- a/src/lib/refalrts-vm.cpp +++ b/src/lib/refalrts-vm.cpp @@ -225,6 +225,11 @@ void print_indent(FILE *output, int level) { putc('!', output); return; } + + if (level > 80) { + level = 80; + } + for (int i = 0; i < level; ++i) { // Каждые cPERIOD позиций вместо пробела ставим точку. bool put_marker = ((i % cPERIOD) == (cPERIOD - 1)); From 7f3f4f7142f60a78ff228c9b3053e09acf9675bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 14 Aug 2021 09:16:24 +0300 Subject: [PATCH 107/208] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2=20=D0=B8=D0=BC=D1=91=D0=BD=20=D0=B2=C2=A0?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B5=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Log-AST.ref | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index 4679c7a4..81b8ac7a 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -24,22 +24,22 @@ UndoubleEmtpyLines { } Element { - (Entries e.Names) = (); + (Entries e.Names) = ; (Function (e.Name) e.Body) = ; (ColdFunction s.ColdBy (e.Name) e.Body) = ; - (Externs e.Names) = (); - (Inlines e.Names) = (); - (Drives e.Names) = (); - (Intrinsics e.Names) = (); + (Externs e.Names) = ; + (Inlines e.Names) = ; + (Drives e.Names) = ; + (Intrinsics e.Names) = ; (Ident e.Name) = ('$LABEL ' ';'); (NativeBlock t.SrcPos e.Code) = ('%% native block %%'); - (Specs e.Names) = (); + (Specs e.Names) = ; (DriveInfo e.DriveInfo) = ('(DriveInfo ...)'); (SpecInfo e.SpecInfo) = ('(SpecInfo ...)'); @@ -68,17 +68,22 @@ $ENTRY Log-ExternList { } NameList { + (e.Keyword) /* нет имён */ = /* пусто */; + (e.Keyword) e.Names = (); +} + +DoNameList { (e.OutLine) e.Names , : True - = (e.OutLine) ; + = (e.OutLine) ; (e.OutLine) (e.Name) e.Names = : s.SEP - = e.OutLine ' ' e.Name s.SEP : e.NewOutLine - = + = e.OutLine ' ' : e.NewOutLine + = : { - True = (e.OutLine) ; - False = ; + True = (e.OutLine) ; + False = ; }; (e.OutLine) /* пусто */ = (e.OutLine); @@ -89,10 +94,10 @@ CommaOrSemicolon { e.Names = ','; } -NameList-Next { +DoNameList-Next { (e.NextName) e.Names = : s.SEP - = ; + = s.SEP) e.Names>; /* пусто */ = /* пусто */; } From 37209c733ddfdf1f8bc2027f416ee8ee6d26752b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 14 Aug 2021 09:34:45 +0300 Subject: [PATCH 108/208] =?UTF-8?q?FIXED:=20=D1=81=D0=BF=D0=B5=D1=86=D0=B8?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D0=B7=D0=B8=D1=80=D1=83=D0=B5=D0=BC=20=D1=82?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D1=84=D1=83=D0=BD=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D1=81=C2=A0=D1=85=D0=BE=D1=82=D1=8F=C2=A0=D0=B1?= =?UTF-8?q?=D1=8B=20=D0=BE=D0=B4=D0=BD=D0=B8=D0=BC=20=D0=BF=D1=80=D0=B5?= =?UTF-8?q?=D0=B4=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 57e5ca84..70676ab7 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -76,16 +76,31 @@ Prepare-Aux { = - : (e.NewInfo) e.AST^ + : ((e.NewNames^) e.NewInfo) e.AST^ = Date: Sat, 14 Aug 2021 10:58:00 +0300 Subject: [PATCH 109/208] =?UTF-8?q?=D0=97=D0=B0=D0=BF=D1=80=D0=B5=D1=89?= =?UTF-8?q?=D0=B0=D0=B5=D0=BC=20=D0=B2=C2=A0=D0=BB=D0=BE=D0=B3=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=B1=D0=B5=D0=B7=20=D0=B8=D0=BD=D0=B4=D0=B5=D0=BA=D1=81=D0=B0?= =?UTF-8?q?=20(#315)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/TreeUtils.ref | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index 0b6364d3..511ec72d 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -54,6 +54,8 @@ $ENTRY ExtractVariables-Expr { e.Variable ::= s.Mode e.Index */ $ENTRY NewVarName { + (e.Vars) s.Mode /* нет индекса */ = ; + (e.Vars-B (e.Variable) e.Vars-E) e.Variable = ; From d7e729b010945e03e93747e63aab90983ade4f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 14 Aug 2021 12:21:38 +0300 Subject: [PATCH 110/208] =?UTF-8?q?FIXED:=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D0=B4=D0=B8=D0=BD=D0=B0=D0=BC=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D1=81=D0=BA=D0=BE=D0=BC=20=D0=BE=D0=B1=D0=BE=D0=B1?= =?UTF-8?q?=D1=89=D0=B5=D0=BD=D0=B8=D0=B8=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Проблема была в том, что присваивания в динамическом обобщении теперь последовательные, поэтому нужно тщательно выбирать имена переменных, чтобы не зациклиться. --- autotests/opt-tree-spec17.ref | 20 ++++++++++++++++++++ src/compiler/OptTree-Spec.ref | 20 ++++++++++++-------- 2 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 autotests/opt-tree-spec17.ref diff --git a/autotests/opt-tree-spec17.ref b/autotests/opt-tree-spec17.ref new file mode 100644 index 00000000..c364f76a --- /dev/null +++ b/autotests/opt-tree-spec17.ref @@ -0,0 +1,20 @@ +* TREE + +$ENTRY Go { + /* empty */ + = : e.B + = : e.D + = : e.0 + = : () ('ABB') ('Czzz') + = : ('BB') ('zzz') + = /* empty */ +} + +gen_e__ { e.arg = e.arg } + +$SPEC S e.arg; + +S { + (e.Y e.Z) e.R e.R = (e.Y) (e.Z) (e.R); + (e.X) e.Y = (e.X) (e.Y); +} diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 70676ab7..804ef6e7 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -577,7 +577,9 @@ SpecCall { = e.Sg e.ExtractedCalls : e.Sg^ /* ищем динамическое обобщение для аргумента и образцов */ - = + = : (e.NewArgument^) (e.Sg^) (e.Solutions) = : e.UsedVars + = e.UsedVars : e.UsedVars^ + = : e.UsedVars^ = : (e.UsedVars^) e.eNew = e.Arg (Brackets (Var e.eNew)) : e.Arg^ = : e.WrappedCondVars @@ -651,7 +654,7 @@ DynGenArg { = e.ArgNew : e.ArgNew^ (Brackets e._) = e.Pat : e.Pat^ (Brackets e._) = ; @@ -661,7 +664,7 @@ DynGenArg { = e.SgNew e.Sg : e.Sg^ = : e.Sg^ = ; @@ -669,12 +672,12 @@ DynGenArg { = e.Arg : e.Arg^ (Brackets e._) = e.Pat : e.Pat^ (Brackets e._) = ; }; - (e.Arg) (e.Sg) (e.Sol) (e.Begin) /* пусто */ + (e.UsedVars) (e.Arg) (e.Sg) (e.Sol) (e.Begin) /* пусто */ = (e.Arg) (e.Sg) (e.Sol); } @@ -808,7 +811,8 @@ SpecCall-NewSignature-Generalize { > : e.NewSg^ = : (e.NewArg^) (e.Sg^) (e.Solutions^) = Date: Sat, 14 Aug 2021 15:36:35 +0300 Subject: [PATCH 111/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=D0=B8=20=D0=B8=C2=A0=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BB=D0=B5=D0=B2=D1=8B=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 24 ++++--------- src/compiler/OptTree-Drive-Expr.ref | 10 ------ src/compiler/OptTree-Spec.ref | 55 +++++++++++++---------------- 3 files changed, 31 insertions(+), 58 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index bda993dc..8d5ad82e 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -44,9 +44,10 @@ $ENTRY GenericMatch { , : True = Clear ; + Success /* пусто */ = Failure; + Success e.Solutions = Contracted e.Solutions; - Failure = Failure; Undefined = Undefined; } } @@ -68,7 +69,7 @@ AllUncontracted { /** - == Success t.Result* | Undefined | Failure + == Success t.Result* | Undefined t.Contr ::= (t.Var ':' e.Val) t.Equation ::= ((e.Expr) ':' (e.LExpr)) @@ -87,16 +88,9 @@ $ENTRY Solve-Drive { > : { e._ (Generalize (e.Intervals)) e._ = Undefined; + e._ (Success (e._) AfterOpen (e._) (e._)) e._ = Undefined; - /* пусто */ = Failure; - - e.Success - = - : { - True = Undefined; - - False = Success ; - }; + e.Success = Success ; }; } @@ -136,8 +130,7 @@ CombineResults-Drive { /** - == Success ((t.Contr*) (t.Assign*))* (t.Assign*) (e.Left^) - | Failure + == ((t.Contr*) (t.Assign*))* (t.Assign*) (e.Left^) t.Contr ::= (t.Var ':' e.Val) t.Assign ::= (e.Val ':' t.Var) @@ -172,11 +165,8 @@ Solve-Spec-DoFindGeneralization { (e.UsedVars) ((e.L) ':' (e.R)) (e.GenAssigns) >; - /* пусто */ = Failure; - e.Success - = Success - + = (e.GenAssigns) (); } diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index c3480e6c..d95402c4 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -338,16 +338,6 @@ DoOptExpr-MakeSubstitutions { (Function () Sentences e.Rest) >; - /* - При неудаче переходим к следующему предложению, к подстановкам - ничего не добавляем. - */ - Failure - = ) Sentences e.Rest) - >; - /* Здесь либо Undefined, либо грязное решение в режиме встраивания, в обоих случаях добавляем холодный вызов остаточной функции. diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 804ef6e7..496b668e 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -577,9 +577,7 @@ SpecCall { = e.Sg e.ExtractedCalls : e.Sg^ /* ищем динамическое обобщение для аргумента и образцов */ - = + = : (e.NewArgument^) (e.Sg^) (e.Solutions) = ; +} + +DoDynGenArg { + (e.UsedVars) (e.Arg) (e.Sg) (e.Sol) + (e.Begin) ((e.Pat) e.Tail) e.Sentences = e.UsedVars : e.UsedVars^ = : e.UsedVars^ = : (e.UsedVars^) e.eNew @@ -650,31 +656,23 @@ DynGenArg { = e.Pat (Brackets e.WrappedCondVars) : e.Pat^ = : { - Success e.Solutions (/* нет обобщений */) (e.ArgNew) + e.Solutions (/* нет обобщений */) (e.ArgNew) = e.ArgNew : e.ArgNew^ (Brackets e._) = e.Pat : e.Pat^ (Brackets e._) - = ; - Success e.Solutions (e.SgNew) (e.ArgNew) + e.Solutions (e.SgNew) (e.ArgNew) = e.ArgNew : e.ArgNew^ (Brackets e._) = e.Pat : e.Pat^ (Brackets e._) = e.SgNew e.Sg : e.Sg^ = : e.Sg^ = ; - - Failure - = e.Arg : e.Arg^ (Brackets e._) - = e.Pat : e.Pat^ (Brackets e._) - = ; }; (e.UsedVars) (e.Arg) (e.Sg) (e.Sol) (e.Begin) /* пусто */ @@ -788,9 +786,12 @@ SpecCall-NewSignature-Generalize { /* Получает обобщённую сигнатуру для двух сигнатур */ = : e.GenSignature = : e.ArgVars + = : t._ e.GenSignature^ + = : Clear e.NewSg + = : { /* @@ -803,6 +804,7 @@ SpecCall-NewSignature-Generalize { False = True; } : s.NeedRelationCheck + = : e.NewSg^ - = + + = : (e.NewArg^) (e.Sg^) (e.Solutions^) + = : e.Pat^ = : e.Tail^ = (e.NewSentences ((e.Pat) e.Tail)); - - (e.NewSentences^) Failure - = (e.NewSentences); } (e.NewSentences) e.Sol > : (e.NewSentences^) - = ; + = ; - (e.Arg) (e.NewSentences) - (/* пусто */) (/* пусто */) - = e.NewSentences; + (e.Arg) (e.NewSentences) (/* пусто */) (/* пусто */) = e.NewSentences; } ApplySubst-Tail { From 6c79552abb9b0ba1495ad487c44962331328874f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 14 Aug 2021 23:54:52 +0300 Subject: [PATCH 112/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D1=82=D0=BE=D1=87?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=BE=20=D0=B8=D0=BC=D1=8F=20=D0=B0=D0=B2?= =?UTF-8?q?=D1=82=D0=BE=D1=82=D0=B5=D1=81=D1=82=D0=B0=20(#160)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e-drive-spec3-closure.ref => opt-tree-drive-spec4-closure.ref} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename autotests/{opt-tree-drive-spec3-closure.ref => opt-tree-drive-spec4-closure.ref} (100%) diff --git a/autotests/opt-tree-drive-spec3-closure.ref b/autotests/opt-tree-drive-spec4-closure.ref similarity index 100% rename from autotests/opt-tree-drive-spec3-closure.ref rename to autotests/opt-tree-drive-spec4-closure.ref From ff803b5c19ffbcd35c050c74fa3282d912613ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 14 Aug 2021 23:55:52 +0300 Subject: [PATCH 113/208] =?UTF-8?q?FIXED:=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D0=B4=D0=B8=D0=BD=D0=B0=D0=BC=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D1=81=D0=BA=D0=BE=D0=BC=20=D0=BE=D0=B1=D0=BE=D0=B1?= =?UTF-8?q?=D1=89=D0=B5=D0=BD=D0=B8=D0=B8=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Проблема была в том, что присваивания в динамическом обобщении теперь последовательные, поэтому нужно тщательно выбирать имена переменных, чтобы не зациклиться. Коммит d7e729b010945 данную ошибку исправлял не полностью. Нужно было таскать используемые имена вместе с обобщённым аргументом и e.Sg. --- autotests/opt-tree-drive-spec5.ref | 11 +++++++++ src/compiler/GenericMatch.ref | 5 ++-- src/compiler/OptTree-Spec.ref | 37 +++++++++++++++--------------- 3 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 autotests/opt-tree-drive-spec5.ref diff --git a/autotests/opt-tree-drive-spec5.ref b/autotests/opt-tree-drive-spec5.ref new file mode 100644 index 00000000..70dd1639 --- /dev/null +++ b/autotests/opt-tree-drive-spec5.ref @@ -0,0 +1,11 @@ +* TREE + +$ENTRY Go { + (e.A) (e.B) (e.C) (e.D) (e.E) (e.F) (e.G 'a' H e.H e.H) e.K e.E + , : e.G + , e.B e.A ADAC : e.H + , : G + = /* empty */; + + /* empty */ = /* empty */; +} diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 8d5ad82e..c1e00a4e 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -130,7 +130,7 @@ CombineResults-Drive { /** - == ((t.Contr*) (t.Assign*))* (t.Assign*) (e.Left^) + == (e.UsedVars^) ((t.Contr*) (t.Assign*))* (t.Assign*) (e.Left^) t.Contr ::= (t.Var ':' e.Val) t.Assign ::= (e.Val ':' t.Var) @@ -166,7 +166,8 @@ Solve-Spec-DoFindGeneralization { >; e.Success - = + = (e.UsedVars) + (e.GenAssigns) (); } diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 496b668e..4409a629 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -578,10 +578,10 @@ SpecCall { /* ищем динамическое обобщение для аргумента и образцов */ = - : (e.NewArgument^) (e.Sg^) (e.Solutions) + : (e.UsedVars^) (e.NewArgument^) (e.Sg^) (e.Solutions) = ; @@ -656,7 +656,7 @@ DoDynGenArg { = e.Pat (Brackets e.WrappedCondVars) : e.Pat^ = : { - e.Solutions (/* нет обобщений */) (e.ArgNew) + (e.UsedVars^) e.Solutions (/* нет обобщений */) (e.ArgNew) = e.ArgNew : e.ArgNew^ (Brackets e._) = e.Pat : e.Pat^ (Brackets e._) = ; - e.Solutions (e.SgNew) (e.ArgNew) + (e.UsedVars^) e.Solutions (e.SgNew) (e.ArgNew) = e.ArgNew : e.ArgNew^ (Brackets e._) = e.Pat : e.Pat^ (Brackets e._) = e.SgNew e.Sg : e.Sg^ @@ -676,7 +676,7 @@ DoDynGenArg { }; (e.UsedVars) (e.Arg) (e.Sg) (e.Sol) (e.Begin) /* пусто */ - = (e.Arg) (e.Sg) (e.Sol); + = (e.UsedVars) (e.Arg) (e.Sg) (e.Sol); } WrappedCondVars { @@ -716,7 +716,7 @@ RemoveAssignByLeftPart { SpecCall-Aux { /* тривиальная сигнатура */ - (e.Name) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) s.NeedRelationCheck , : True @@ -725,7 +725,7 @@ SpecCall-Aux { /* пусто */ (/* пусто */); /* проверяем, известна ли сигнатура */ - (e.Name) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) s.NeedRelationCheck = @@ -743,7 +743,7 @@ SpecCall-Aux { /* проверяем на зацикливание */ NotFound e.Signatures^ = ; @@ -751,7 +751,7 @@ SpecCall-Aux { } SpecCall-NewSignature { - (e.Name) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) s.NeedRelationCheck (e.Signature) = s.NeedRelationCheck @@ -766,7 +766,7 @@ SpecCall-NewSignature { : { True e.HistorySignature = ; @@ -780,15 +780,14 @@ SpecCall-NewSignature { } SpecCall-NewSignature-Generalize { - (e.Name) (e.Body) s.NextNumber e.Signatures + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) (e.HistorySignature) /* Получает обобщённую сигнатуру для двух сигнатур */ = : e.GenSignature - = : e.ArgVars - = - : t._ e.GenSignature^ + = + : (e.UsedVars^) e.GenSignature^ = : Clear e.NewSg @@ -813,13 +812,13 @@ SpecCall-NewSignature-Generalize { > : e.NewSg^ - = - : (e.NewArg^) (e.Sg^) (e.Solutions^) + = + : (e.UsedVars^) (e.NewArg^) (e.Sg^) (e.Solutions^) = ; } From 1c1bd888dec372ba485bca86e2fd39a00a7ff871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 00:45:30 +0300 Subject: [PATCH 114/208] =?UTF-8?q?=D0=A2=D1=8E=D0=BD=D0=B8=D0=BD=D0=B3=20?= =?UTF-8?q?=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BA=20=D0=B0=D0=B2?= =?UTF-8?q?=D1=82=D0=BE=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Подрегулированы пределы числа шагов и объёма памяти. Теперь они имеют минимально возможное значение, при котором выполняются тесты, вида 100…0, 200…0 или 500…0. • Для некоторых тестов указан файл дампа. Файл дампа формируется быстрее, чем перенаправленный stderr, во всяком случае на Windows. --- autotests/@refal-5-lambda-diagnostics.ini | 6 +++--- .../Library/@refal-5-lambda-diagnostics.ini | 6 +++--- .../@refal-5-lambda-diagnostics.ini | 6 +++--- .../@refal-5-lambda-diagnostics.ini | 6 +++--- .../@refal-5-lambda-diagnostics.ini | 7 ++++--- autotests/positive-random-test/run.bat | 4 ++++ autotests/positive-random-test/run.sh | 3 ++- ...lc-core.exe@refal-5-lambda-diagnostics.ini | 1 + .../rlc-core@refal-5-lambda-diagnostics.ini | 1 + autotests/run.bat | 21 ++++++++++++------- autotests/run.sh | 20 +++++++++++------- 11 files changed, 51 insertions(+), 30 deletions(-) create mode 100644 autotests/rlc-core.exe@refal-5-lambda-diagnostics.ini create mode 100644 autotests/rlc-core@refal-5-lambda-diagnostics.ini diff --git a/autotests/@refal-5-lambda-diagnostics.ini b/autotests/@refal-5-lambda-diagnostics.ini index 0e30eab1..8872a726 100644 --- a/autotests/@refal-5-lambda-diagnostics.ini +++ b/autotests/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 20000000 -step-limit = 60000000 -idents-limit = 5000 +memory-limit = 2000000 +step-limit = 20000000 +idents-limit = 5000 enable-debugger = false diff --git a/autotests/Library/@refal-5-lambda-diagnostics.ini b/autotests/Library/@refal-5-lambda-diagnostics.ini index 400dfce4..9d875059 100644 --- a/autotests/Library/@refal-5-lambda-diagnostics.ini +++ b/autotests/Library/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 10000000 -step-limit = 100000000 -idents-limit = 5000 +memory-limit = 500000 +step-limit = 2000000 +idents-limit = 5000 enable-debugger = false diff --git a/autotests/any-random-test/@refal-5-lambda-diagnostics.ini b/autotests/any-random-test/@refal-5-lambda-diagnostics.ini index 400dfce4..12dc6ac1 100644 --- a/autotests/any-random-test/@refal-5-lambda-diagnostics.ini +++ b/autotests/any-random-test/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 10000000 -step-limit = 100000000 -idents-limit = 5000 +memory-limit = 500000 +step-limit = 50000000 +idents-limit = 5000 enable-debugger = false diff --git a/autotests/compatibility/@refal-5-lambda-diagnostics.ini b/autotests/compatibility/@refal-5-lambda-diagnostics.ini index 400dfce4..297f1fa7 100644 --- a/autotests/compatibility/@refal-5-lambda-diagnostics.ini +++ b/autotests/compatibility/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 10000000 -step-limit = 100000000 -idents-limit = 5000 +memory-limit = 1000000 +step-limit = 2000000 +idents-limit = 5000 enable-debugger = false diff --git a/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini b/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini index 4dd0cdad..26566f4b 100644 --- a/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini +++ b/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,5 @@ -memory-limit = 20000000 -step-limit = 1000000000 -idents-limit = 5000 +memory-limit = 5000000 +step-limit = 50000000 +idents-limit = 5000 enable-debugger = false +dump-file = __dump.txt diff --git a/autotests/positive-random-test/run.bat b/autotests/positive-random-test/run.bat index c28b92fa..bf86286e 100644 --- a/autotests/positive-random-test/run.bat +++ b/autotests/positive-random-test/run.bat @@ -7,6 +7,7 @@ goto :EOF :MAIN setlocal + if exist __dump.txt erase __dump.txt call :REGRESSION || exit /b 1 call :NEW_TESTS || exit /b 1 endlocal @@ -118,6 +119,9 @@ setlocal if not exist %FILE%.rasl ( exit /b 1 ) + if exist __dump.txt ( + exit /b 1 + ) erase %FILE%.rasl endlocal goto :EOF diff --git a/autotests/positive-random-test/run.sh b/autotests/positive-random-test/run.sh index 585fa342..bbe596e6 100755 --- a/autotests/positive-random-test/run.sh +++ b/autotests/positive-random-test/run.sh @@ -9,6 +9,7 @@ if [[ -n "$1" ]]; then fi main() { + rm -f __dump.txt regression || return 1 new_tests || return 1 } @@ -118,7 +119,7 @@ run_test() { ../../bin/rlc-core --classic -C "$FILE" --prelude=prelude-for-test "$FLAGS" \ 2>"$FILE.err$FLAGS" >"$FILE.out$FLAGS" - if [[ ! -e "$FILE.rasl" ]]; then + if [[ ! -e "$FILE.rasl" ]] || [[ -e __dump.txt ]]; then return 1 fi rm -f "$FILE.rasl" diff --git a/autotests/rlc-core.exe@refal-5-lambda-diagnostics.ini b/autotests/rlc-core.exe@refal-5-lambda-diagnostics.ini new file mode 100644 index 00000000..d9cad389 --- /dev/null +++ b/autotests/rlc-core.exe@refal-5-lambda-diagnostics.ini @@ -0,0 +1 @@ +dump-file = __dump_rlc-core.txt diff --git a/autotests/rlc-core@refal-5-lambda-diagnostics.ini b/autotests/rlc-core@refal-5-lambda-diagnostics.ini new file mode 100644 index 00000000..d9cad389 --- /dev/null +++ b/autotests/rlc-core@refal-5-lambda-diagnostics.ini @@ -0,0 +1 @@ +dump-file = __dump_rlc-core.txt diff --git a/autotests/run.bat b/autotests/run.bat index a545aa3c..f423af1f 100644 --- a/autotests/run.bat +++ b/autotests/run.bat @@ -26,7 +26,7 @@ goto :EOF ..\bin\rlc-core -o _test_prefix.exe-prefix ^ %COMMON_SRFLAGS% %SRFLAGS_NAT% 2>__error.txt if not exist _test_prefix.exe-prefix ( - echo CAN'T CREATE COMMON PREFIX, SEE __error.txt + echo CAN'T CREATE COMMON PREFIX, SEE __error.txt or __dump_rlc-core.txt exit /b 1 ) erase __error.txt @@ -227,7 +227,9 @@ setlocal %COMMON_SRFLAGS% %SRFLAGS_PREF% ^ --reference=%REFERENCE% >__out.txt 2> __error.txt if errorlevel 100 ( - echo COMPILER FAILS ON CREATING _int_test.exe, SEE __error.txt + set MSG=COMPILER FAILS ON CREATING _int_test.exe + set MSG=%MSG%, SEE __error.txt or __dump_rlc-core.txt + echo %MSG% exit /b 1 ) if not exist _int_test.exe ( @@ -257,10 +259,11 @@ setlocal if not exist "%SATELITE%" set SATELITE= + if exist __dump_rlc-core.txt erase __dump_rlc-core.txt ..\bin\rlc-core %SREF% --makelib %COMMON_SRFLAGS% %SRFLAGS% %SRFLAGS_PLUS% ^ --keep-rasls %SATELITE% 2> __error.txt if errorlevel 100 ( - echo COMPILER ON %1 FAILS, SEE __error.txt + echo COMPILER ON %1 FAILS, SEE __error.txt or __dump_rlc-core.txt exit /b 1 ) if not exist %LIBR% if not exist %LIBN% ( @@ -309,10 +312,11 @@ setlocal if not exist "%SATELITE%" set SATELITE= + if exist __dump_rlc-core.txt erase __dump_rlc-core.txt ..\bin\rlc-core %SREF% --makelib %COMMON_SRFLAGS% %SRFLAGS% %SRFLAGS_PLUS% ^ --keep-rasls %SATELITE% 2> __error.txt if errorlevel 100 ( - echo COMPILER ON %1 FAILS, SEE __error.txt + echo COMPILER ON %1 FAILS, SEE __error.txt or __dump_rlc-core.txt exit /b 1 ) if not exist %LIBR% if not exist %LIBN% ( @@ -349,9 +353,10 @@ setlocal set SREF=%1 set RASL=%~n1.rasl + if exist __dump_rlc-core.txt erase __dump_rlc-core.txt ..\bin\rlc-core --prelude=test-prelude.srefi -C %SRFLAGS% %1 2> __error.txt if errorlevel 100 ( - echo COMPILER ON %1 FAILS, SEE __error.txt + echo COMPILER ON %1 FAILS, SEE __error.txt or __dump_rlc-core.txt exit /b 1 ) if exist %RASL% ( @@ -376,10 +381,11 @@ setlocal set RASL=%~n1.rasl set WARN=-W echo Passing %1 (flag %WARN%%FLAG%)... + if exist __dump_rlc-core.txt erase __dump_rlc-core.txt ..\bin\rlc-core %WARN%%FLAG% --prelude=test-prelude.srefi -C %SRFLAGS% %1 ^ 2> __error.txt if errorlevel 100 ( - echo COMPILER ON %1 FAILS, SEE __error.txt + echo COMPILER ON %1 FAILS, SEE __error.txt or __dump_rlc-core.txt exit /b 1 ) if not exist %RASL% ( @@ -395,10 +401,11 @@ setlocal set WARN=-Werror= echo Passing %1 (flag %WARN%%FLAG%)... + if exist __dump_rlc-core.txt erase __dump_rlc-core.txt ..\bin\rlc-core %WARN%%FLAG% --prelude=test-prelude.srefi -C %SRFLAGS% %1 ^ 2> __error.txt if errorlevel 100 ( - echo COMPILER ON %1 FAILS, SEE __error.txt + echo COMPILER ON %1 FAILS, SEE __error.txt or __dump_rlc-core.txt exit /b 1 ) if exist %RASL% ( diff --git a/autotests/run.sh b/autotests/run.sh index 296e0e9a..6a97da47 100755 --- a/autotests/run.sh +++ b/autotests/run.sh @@ -23,7 +23,7 @@ prepare_prefix() { ../bin/rlc-core -o _test_prefix.exe-prefix \ "${COMMON_SRFLAGS[@]}" ${SRFLAGS_NAT} 2>__error.txt if [[ $? -ge 100 ]] || [[ ! -e _test_prefix.exe-prefix ]]; then - echo "CAN'T CREATE COMMON PREFIX, SEE __error.txt" + echo "CAN'T CREATE COMMON PREFIX, SEE __error.txt or __dump_rlc-core.txt" exit 1 fi echo @@ -115,7 +115,8 @@ prepare_int_test() { "${COMMON_SRFLAGS[@]}" ${SRFLAGS_PREF} \ --reference=${REFERENCE} >__out.txt 2>__error.txt if [[ $? -ge 100 ]] || [[ ! -e ${INT} ]]; then - echo COMPILER FAILS ON CREATING ${INT}, SEE __error.txt + echo COMPILER FAILS ON CREATING ${INT}, \ + SEE __error.txt or __dump_rlc-core.txt exit 1 fi rm __out.txt __error.txt @@ -139,10 +140,11 @@ run_test_aux_with_flags() { SATELITE= fi + rm -f __dump_rlc-core.txt ../bin/rlc-core --keep-rasls ${SREF} --makelib "${COMMON_SRFLAGS[@]}" \ ${SRFLAGS} ${SRFLAGS_PLUS} "$SATELITE" 2>__error.txt if [[ $? -ge 100 ]]; then - echo COMPILER ON ${SREF} FAILS, SEE __error.txt + echo COMPILER ON ${SREF} FAILS, SEE __error.txt or __dump_rlc-core.txt exit 1 elif [[ ! -e ${LIBR} ]] && [[ ! -e ${LIBN} ]]; then echo COMPILATION FAILED, __error.txt: @@ -174,10 +176,11 @@ run_test_aux.BAD-SYNTAX() { RASL=${SREF%.*}.rasl EXE=${SREF%.*}$(platform_exe_suffix) + rm -f __dump_rlc-core.txt ../bin/rlc-core --prelude=test-prelude.srefi -C ${SRFLAGS} ${SREF} \ 2>__error.txt if [[ $? -ge 100 ]]; then - echo COMPILER ON ${SREF} FAILS, SEE __error.txt + echo COMPILER ON ${SREF} FAILS, SEE __error.txt or __dump_rlc-core.txt exit 1 fi if [[ -e ${RASL} ]]; then @@ -202,10 +205,11 @@ run_test_aux.WARNING() { RASL=${SREF%.*}.rasl EXE=${SREF%.*}$(platform_exe_suffix) + rm -f __dump_rlc-core.txt ../bin/rlc-core ${WARN} --prelude=test-prelude.srefi -C ${SRFLAGS} ${SREF} \ 2>__error.txt if [[ $? -ge 100 ]]; then - echo COMPILER ON ${SREF} FAILS, SEE __error.txt + echo COMPILER ON ${SREF} FAILS, SEE __error.txt or __dump_rlc-core.txt exit 1 fi if [[ ! -e ${RASL} ]]; then @@ -221,10 +225,11 @@ run_test_aux.WARNING() { WARN="-Werror=${array[2]}" echo Passing $1 \(flags "${WARN}"\)... + rm -f __dump_rlc-core.txt ../bin/rlc-core ${WARN} --prelude=test-prelude.srefi -C ${SRFLAGS} ${SREF} \ 2>__error.txt if [[ $? -ge 100 ]]; then - echo COMPILER ON ${SREF} FAILS, SEE __error.txt + echo COMPILER ON ${SREF} FAILS, SEE __error.txt or __dump_rlc-core.txt exit 1 fi if [[ -e ${RASL} ]]; then @@ -257,10 +262,11 @@ run_test_aux_with_flags.FAILURE() { SATELITE= fi + rm -f __dump_rlc-core.txt ../bin/rlc-core --keep-rasls ${SREF} --makelib "${COMMON_SRFLAGS[@]}" \ ${SRFLAGS} ${SRFLAGS_PLUS} "$SATELITE" 2>__error.txt if [[ $? -ge 100 ]] || [[ ! -e ${LIBR} ]] && [[ ! -e ${LIBN} ]]; then - echo COMPILER ON ${SREF} FAILS, SEE __error.txt + echo COMPILER ON ${SREF} FAILS, SEE __error.txt or __dump_rlc-core.txt exit 1 fi rm __error.txt From 2b4374e8612b524185403bf31b4df73a9578995d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 10:12:25 +0300 Subject: [PATCH 115/208] =?UTF-8?q?=D0=A3=D1=82=D0=BE=D1=87=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=B8=D0=BC=D0=B8=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D0=BE=D0=BA=D1=80=D1=83=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20+=20=D0=B4=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20CI=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В артефактах теперь сохраняются отладочные дампы, добавленные предыдущим коммитом. --- .github/workflows/CI-posix.yml | 1 + .github/workflows/CI-windows.yml | 1 + autotests/@refal-5-lambda-diagnostics.ini | 2 +- autotests/compatibility/@refal-5-lambda-diagnostics.ini | 2 +- .../positive-random-test/@refal-5-lambda-diagnostics.ini | 2 +- autotests/run.bat | 4 ++-- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI-posix.yml b/.github/workflows/CI-posix.yml index ef9d31af..ce963866 100644 --- a/.github/workflows/CI-posix.yml +++ b/.github/workflows/CI-posix.yml @@ -47,6 +47,7 @@ jobs: autotests/__error.txt autotests/__dump.txt autotests/__log.txt + autotests/__dump_rlc-core.txt autotests/any-random-test autotests/positive-random-test bin diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 4427307f..3f1d818b 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -38,6 +38,7 @@ jobs: autotests\__error.txt autotests\__dump.txt autotests\__log.txt + autotests\__dump_rlc-core.txt autotests\any-random-test autotests\positive-random-test bin diff --git a/autotests/@refal-5-lambda-diagnostics.ini b/autotests/@refal-5-lambda-diagnostics.ini index 8872a726..2d01ed82 100644 --- a/autotests/@refal-5-lambda-diagnostics.ini +++ b/autotests/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 2000000 +memory-limit = 5000000 step-limit = 20000000 idents-limit = 5000 enable-debugger = false diff --git a/autotests/compatibility/@refal-5-lambda-diagnostics.ini b/autotests/compatibility/@refal-5-lambda-diagnostics.ini index 297f1fa7..523d7b1b 100644 --- a/autotests/compatibility/@refal-5-lambda-diagnostics.ini +++ b/autotests/compatibility/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 1000000 +memory-limit = 5000000 step-limit = 2000000 idents-limit = 5000 enable-debugger = false diff --git a/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini b/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini index 26566f4b..e89ae321 100644 --- a/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini +++ b/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini @@ -1,5 +1,5 @@ memory-limit = 5000000 -step-limit = 50000000 +step-limit = 100000000 idents-limit = 5000 enable-debugger = false dump-file = __dump.txt diff --git a/autotests/run.bat b/autotests/run.bat index f423af1f..0a3a7c66 100644 --- a/autotests/run.bat +++ b/autotests/run.bat @@ -226,9 +226,9 @@ setlocal ..\bin\rlc-core --no-sources -o _int_test.exe ^ %COMMON_SRFLAGS% %SRFLAGS_PREF% ^ --reference=%REFERENCE% >__out.txt 2> __error.txt + set MSG=COMPILER FAILS ON CREATING _int_test.exe + set MSG=%MSG%, SEE __error.txt or __dump_rlc-core.txt if errorlevel 100 ( - set MSG=COMPILER FAILS ON CREATING _int_test.exe - set MSG=%MSG%, SEE __error.txt or __dump_rlc-core.txt echo %MSG% exit /b 1 ) From 629f85b8c93debc9bc290960f33e962bd3005456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 10:15:49 +0300 Subject: [PATCH 116/208] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=B0=D1=8F=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20Solve-Clashes=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 174 +++++++++++++++++++--------------- 1 file changed, 98 insertions(+), 76 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index c1e00a4e..1481fd62 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -83,7 +83,7 @@ $ENTRY Solve-Drive { = ) - ((e.Expr) ':' (e.Lexpr)) + (E (e.Expr) ':' (e.Lexpr)) () > : { @@ -151,7 +151,7 @@ Solve-Spec-DoFindGeneralization { = : { @@ -449,7 +449,8 @@ SimplifyCoordinates { e.Contractions ::= s.OpenFlag t.Contr* s.OpenFlag ::= None | AfterOpen t.Contr ::= (t.Var ':' e.Val) - t.Clash ::= ((e.L) ':' (e.R)) + t.Clash ::= (s.ClashType (e.L) ':' (e.R)) + s.ClashType ::= E | T t.Assign ::= (e.Val ':' t.Var) t.Result ::= (Success (e.UsedVars) s.OpenFlag (t.Contr*) (t.Assign*)) @@ -459,9 +460,8 @@ SimplifyCoordinates { Solve-Clashes { /* {m} T {n} : t.X ↦ {m} T {n} ← t.X */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.T ('{'s.N'}')) ':' ((Var 't' e.Index))) + (T (('{'s.M'}') t.T ('{'s.N'}')) ':' ((Var 't' e.Index))) e.ClashesEnd (e.Assigns) - , : True = : True = ) ':' (e.RBody)) + (E + () + ':' (e.RBody) + ) e.ClashesEnd (e.Assigns) >; /* {m} [X E] {n} : [X P] ↦ {m} [X E] {n} : P */ (e.UsedVars) (e.Contrs) e.ClashesStart - ( + (T (('{'s.M'}') (ADT-Brackets (e.Name) e.LBody) ('{'s.N'}')) ':' ((ADT-Brackets (e.Name) e.RBody)) ) @@ -512,71 +515,71 @@ Solve-Clashes { = ) ':' (e.RBody)) + (E () ':' (e.RBody)) e.ClashesEnd (e.Assigns) >; /* {m} [X E] {n} : [Y P] ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (ADT-Brackets e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) + (T (('{'s.M'}') (ADT-Brackets e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) e.ClashesEnd (e.Assigns) = /* нет решений */; /* {m} [X E] {n} : (P) ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (ADT-Brackets e._) ('{'s.N'}')) ':' ((Brackets e._))) + (T (('{'s.M'}') (ADT-Brackets e._) ('{'s.N'}')) ':' ((Brackets e._))) e.ClashesEnd (e.Assigns) = /* нет решений */; /* {m} (E) {n} : [X P] ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (Brackets e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) + (T (('{'s.M'}') (Brackets e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) e.ClashesEnd (e.Assigns) = /* нет решений */; /* {m} (E) {n} : Psym ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (Brackets e._) ('{'s.N'}')) ':' (t.Psym)) + (T (('{'s.M'}') (Brackets e._) ('{'s.N'}')) ':' (t.Psym)) e.ClashesEnd (e.Assigns) , : True = /* нет решений */; /* {m} [X E] {n} : Psym ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (ADT-Brackets e._) ('{'s.N'}')) ':' (t.Psym)) + (T (('{'s.M'}') (ADT-Brackets e._) ('{'s.N'}')) ':' (t.Psym)) e.ClashesEnd (e.Assigns) , : True = /* нет решений */; /* {m} Sym {n} : (P) ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((Brackets e._))) + (T (('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((Brackets e._))) e.ClashesEnd (e.Assigns) , : True = /* нет решений */; /* {m} #var {n} : (P) ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Brackets e._))) + (s._ (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Brackets e._))) e.ClashesEnd (e.Assigns) = /* нет решений */; /* {m} Sym {n} : [X P] ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((ADT-Brackets e._))) + (T (('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((ADT-Brackets e._))) e.ClashesEnd (e.Assigns) , : True = /* нет решений */; /* {m} #var {n} : [X P] ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) + (s._ (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) e.ClashesEnd (e.Assigns) = /* нет решений */; /* {m} t.X {n} : (P) ↦ t.X → (e.NEW) */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) ':' ((Brackets e.PBody))) + (T (('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) ':' ((Brackets e.PBody))) e.ClashesEnd (e.Assigns) = : t.NewVars 'e' e.NewIndex = >; /* {m} t.X {n} : [X P] ↦ t.X → [X e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart - ( + (T (('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) ':' ((ADT-Brackets (e.Name) e.PBody)) ) @@ -602,7 +608,7 @@ Solve-Clashes { : True = : t.NewVars 's' e.NewIndex @@ -621,32 +627,31 @@ Solve-Clashes { >; /* {m} s.X {n} : X ↦ s.X → X */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (Var 's' e.Index) ('{'s.N'}')) ':' ((Symbol s.Type e.Info))) + (T (('{'s.M'}') (Var 's' e.Index) ('{'s.N'}')) ':' ((Symbol s.Type e.Info))) e.ClashesEnd (e.Assigns) = >; /* {m} X {n} : X ↦ стираем */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (Symbol s.Type e.Info) ('{'s.N'}')) ':' ((Symbol s.Type e.Info))) + (T + (('{'s.M'}') (Symbol s.Type e.Info) ('{'s.N'}')) + ':' ((Symbol s.Type e.Info)) + ) e.ClashesEnd (e.Assigns) = : True = /* решений нет */; /* E : e.X ↦ E ← e.X */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((e.E) ':' ((Var 'e' e.Index))) + (E (e.E) ':' ((Var 'e' e.Index))) e.ClashesEnd (e.Assigns) = >; /* {m} T E {n} : ε ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') t.T e.E ('{'s.N'}')) ':' (/* пусто */)) + (E (('{'s.M'}') t.T e.E ('{'s.N'}')) ':' (/* пусто */)) e.ClashesEnd (e.Assigns) , : True = /* решений нет */; /* ε : E1 Pt E2 ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((/* пусто */) ':' (e.E1 t.Pt e.E2)) + (E (/* пусто */) ':' (e.E1 t.Pt e.E2)) e.ClashesEnd (e.Assigns) , : True = /* решений нет */; /* ε : ε ↦ стираем */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((/* пусто */) ':' (/* пусто */)) + (E (/* пусто */) ':' (/* пусто */)) e.ClashesEnd (e.Assigns) = : True , : True @@ -741,8 +746,8 @@ Solve-Clashes { (e.UsedVars) (e.Contrs) (e.Assigns) @@ -751,7 +756,7 @@ Solve-Clashes { /* E {m} T {n} : P Pt ↦ E {m} : P && {m} T {n} : Pt */ /* E {m} E* T {n} : P Pt ↦ E {m} E* {n} : P && {m} T {n} : Pt */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((e.E t.T ('{'s.N'}')) ':' (e.P t.Pt)) + (E (e.E t.T ('{'s.N'}')) ':' (e.P t.Pt)) e.ClashesEnd (e.Assigns) , : True , : True @@ -760,8 +765,8 @@ Solve-Clashes { (e.UsedVars) (e.Contrs) (e.Assigns) @@ -769,17 +774,22 @@ Solve-Clashes { /* {m} e.X E {n} : Pt P ↦ e.X → t.NEW1 e.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') (Var 'e' e.Index) e.E ('{'s.N'}')) ':' (t.Pt e.P)) + (E (('{'s.M'}') (Var 'e' e.Index) e.E ('{'s.N'}')) ':' (t.Pt e.P)) e.ClashesEnd (e.Assigns) , : True = : t.NewVars1 't' e.New1 = : t.NewVars2 'e' e.New2 + = + : (e.Left1) (e.Left2) = (e.Assigns) @@ -790,7 +800,7 @@ Solve-Clashes { (e.Contrs) (e.Assigns) @@ -801,17 +811,22 @@ Solve-Clashes { /* {m} E e.X {n} : P Pt ↦ e.X → e.NEW1 t.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - ((('{'s.M'}') e.E (Var 'e' e.Index) ('{'s.N'}')) ':' (e.P t.Pt)) + (E (('{'s.M'}') e.E (Var 'e' e.Index) ('{'s.N'}')) ':' (e.P t.Pt)) e.ClashesEnd (e.Assigns) , : True = : t.NewVars1 'e' e.New1 = : t.NewVars2 't' e.New2 + = + : (e.Left1) (e.Left2) = (e.Assigns) @@ -822,7 +837,7 @@ Solve-Clashes { (e.Contrs) (e.Assigns) @@ -833,7 +848,7 @@ Solve-Clashes { /* могли остаться только клэши вида E : e.X P e.Y */ (e.UsedVars) (s.OpenFlag e.Contrs) - ((e.E) ':' ((Var 'e' e._) e.P (Var 'e' e._))) + (E (e.E) ':' ((Var 'e' e._) e.P (Var 'e' e._))) e.ClashesEnd (e.Assigns) , e.E : ('{'s.M'}') e.Inner ('{'s.N'}') , : False @@ -841,14 +856,14 @@ Solve-Clashes { = (Generalize (('{' s.M s.N '}'))); (e.UsedVars) (e.Contrs) - ((('{'s.M'}') t.eVar ('{'s.N'}')) ':' ((Var 'e' e._) e.P (Var 'e' e._))) + (E (('{'s.M'}') t.eVar ('{'s.N'}')) ':' ((Var 'e' e._) e.P (Var 'e' e._))) e.ClashesEnd (e.Assigns) , t.eVar : (Var 'e' e.Index) , : True = (Generalize (('{' s.M s.N '}'))); (e.UsedVars) (e.Contrs) - ((e.E) ':' ((Var 'e' e.OpenIndex) e.P (Var 'e' e.ClosedIndex))) + (E (e.E) ':' ((Var 'e' e.OpenIndex) e.P (Var 'e' e.ClosedIndex))) e.ClashesEnd (e.Assigns) = : (e.Parts) = ) > } @@ -1036,20 +1054,20 @@ SplitSolve { * {m} E {n} : e.X P e.Y ↦ ε ← e.X, {m} E {n} : P e.Y * ↑ (e.UsedVars) (e.Contrs) - ((('sp' ('{'s.M'}')) e.E ('{'s.N'}')) ':' (t.eX e.P t.eY)) + (E (('sp' ('{'s.M'}')) e.E ('{'s.N'}')) ':' (t.eX e.P t.eY)) e.ClashesEnd (e.Assigns) , t.eX : (Var 'e' e.XIndex) , t.eY : (Var 'e' e.YIndex) = + () >; * {k} E1 T2 {m} T3 E4 {n} : e.X P e.Y ↦ {k} E1 T2 {m} ← e.X, * ↑ {m} T3 E4 {n} : P e.Y (e.UsedVars) (e.Contrs) - ( + (E ( ('{'s.K'}') e.E1 t.T2 ('sp' ('{'s.M'}')) @@ -1065,7 +1083,7 @@ SplitSolve { = () >; @@ -1073,7 +1091,7 @@ SplitSolve { * E1 {m} E2* T3 . T4 E5* {n} E6 : e.X P e.Y ↦ E1 {m} E2* T3 {n} ← e.X, * ↑ {m} T4 E5* {n} E6 : P e.Y (e.UsedVars) (e.Contrs) - ( + (E ( e.E1 ('{'s.M'}') e.E2 t.T3 ('sp') t.T4 @@ -1091,7 +1109,8 @@ SplitSolve { = () >; @@ -1099,7 +1118,7 @@ SplitSolve { * {m} E {n} : e.X P e.Y ↦ {m} E {n} ← e.X, ε : P e.Y * ↑ (e.UsedVars) (e.Contrs) - ( + (E (('{'s.M'}') e.E ('sp' ('{'s.N'}'))) ':' (t.eX e.P t.eY) ) @@ -1108,20 +1127,20 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = + () >; * ε : e.X P e.Y ↦ ε ← e.X, ε : P e.Y * ↑ (e.UsedVars) (e.Contrs) - ((('sp')) ':' (t.eX e.P t.eY)) + (E (('sp')) ':' (t.eX e.P t.eY)) e.ClashesEnd (e.Assigns) , t.eX : (Var 'e' e.XIndex) , t.eY : (Var 'e' e.YIndex) = + () >; @@ -1130,7 +1149,7 @@ SplitSolve { * {n} t.NEW2 e.NEW3 {m} e.Y E2 : P e.R * где E1 = E3 {n} E4* (e.UsedVars) (e.Contrs) - ((e.E1 ('sp' t.eX) ('{'s.M'}') t.eY e.E2) ':' (t.eL e.P t.eR)) + (E (e.E1 ('sp' t.eX) ('{'s.M'}') t.eY e.E2) ':' (t.eL e.P t.eR)) e.ClashesEnd (e.Assigns) , e.E1 : e.E3 ('{'s.N'}') e.E4 , : False @@ -1150,7 +1169,10 @@ SplitSolve { (t.eX ':' t.eNew1 t.tNew2 t.eNew3) (e.Contrs) () @@ -1163,7 +1185,7 @@ SplitSolve { * где E1 = E3 {n} E4* * E2 = E5* {m} E6 (e.UsedVars) (e.Contrs) - ((e.E1 ('sp' t.eX) e.E2) ':' (t.eL e.P t.eR)) + (E (e.E1 ('sp' t.eX) e.E2) ':' (t.eL e.P t.eR)) e.ClashesEnd (e.Assigns) , e.E1 : e.E3 ('{'s.N'}') e.E4 , : False @@ -1181,7 +1203,7 @@ SplitSolve { + () > >; @@ -2148,10 +2170,10 @@ ApplyContractions-toAssigns { */ ApplyContraction-toEquation { - t.Contraction ((e.Expr) ':' (e.Lexpr)) + t.Contraction (s.ClashType (e.Expr) ':' (e.Lexpr)) = : e.Expr^ = : e.Expr^ - = ((e.Expr) ':' (e.Lexpr)) + = (s.ClashType (e.Expr) ':' (e.Lexpr)) } ApplyContraction-toSymmClash { From 9761335660d2376585c9349ead11a0c36b21b37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 10:28:50 +0300 Subject: [PATCH 117/208] =?UTF-8?q?=D0=9F=D0=BE=D0=B2=D1=8B=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BB=D0=B8=D0=BC=D0=B8=D1=82=D0=B0=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20GCC=20=D0=BD=D0=B0=C2=A0CI=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/@refal-5-lambda-diagnostics.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autotests/@refal-5-lambda-diagnostics.ini b/autotests/@refal-5-lambda-diagnostics.ini index 2d01ed82..48f84398 100644 --- a/autotests/@refal-5-lambda-diagnostics.ini +++ b/autotests/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 5000000 +memory-limit = 10000000 step-limit = 20000000 idents-limit = 5000 enable-debugger = false From 65e33933a1614754df17a66df78d6ff3b911047b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 10:51:37 +0300 Subject: [PATCH 118/208] =?UTF-8?q?=D0=9E=D0=B1=D1=8A=D1=91=D0=BC=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=82=D1=80=D0=B5=D0=B1=D0=BB=D1=8F=D0=B5=D0=BC=D0=BE?= =?UTF-8?q?=D0=B9=20=D0=BF=D0=B0=D0=BC=D1=8F=D1=82=D0=B8=20=D0=BD=D0=B5?= =?UTF-8?q?=C2=A0=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D1=82=20=D0=BE=D1=82?= =?UTF-8?q?=C2=A0=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=D0=B0=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B5=D1=84=D0=B8=D0=BA=D1=81=D0=B0=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Соответственно, снижены лимиты для тестов. --- autotests/@refal-5-lambda-diagnostics.ini | 2 +- .../compatibility/@refal-5-lambda-diagnostics.ini | 2 +- src/compiler/main.ref | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/autotests/@refal-5-lambda-diagnostics.ini b/autotests/@refal-5-lambda-diagnostics.ini index 48f84398..8872a726 100644 --- a/autotests/@refal-5-lambda-diagnostics.ini +++ b/autotests/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 10000000 +memory-limit = 2000000 step-limit = 20000000 idents-limit = 5000 enable-debugger = false diff --git a/autotests/compatibility/@refal-5-lambda-diagnostics.ini b/autotests/compatibility/@refal-5-lambda-diagnostics.ini index 523d7b1b..297f1fa7 100644 --- a/autotests/compatibility/@refal-5-lambda-diagnostics.ini +++ b/autotests/compatibility/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 5000000 +memory-limit = 1000000 step-limit = 2000000 idents-limit = 5000 enable-debugger = false diff --git a/src/compiler/main.ref b/src/compiler/main.ref index fa8ad330..00067d24 100644 --- a/src/compiler/main.ref +++ b/src/compiler/main.ref @@ -928,7 +928,20 @@ GlueNames { CopyPrefix { (e.OriginalPrefixName) (e.NewExeName) - = >; + = : s.SrcHandle + = : s.DestHandle + = +} + +DoCopyPrefix { + s.SrcHandle s.DestHandle + = + : { + /* пусто */ = ; + e.Bytes + = + ; + } } $INLINE LinkError; From 8bcf7ccff305a7f95ade980a17d202caec3f314a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 13:22:49 +0300 Subject: [PATCH 119/208] =?UTF-8?q?FIXED:=20=D0=BA=D0=BB=D1=8D=D1=88=D0=B8?= =?UTF-8?q?-=D1=82=D0=B5=D1=80=D0=BC=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D1=8D?= =?UTF-8?q?=D0=BA=D1=80=D0=B0=D0=BD=D0=B8=D1=80=D1=83=D0=B5=D0=BC=D1=8B?= =?UTF-8?q?=D1=85=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D1=85=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 1481fd62..b57a7202 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -487,7 +487,7 @@ Solve-Clashes { /* {m} #var {n} : s.X ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - (s._ (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Var 's' e.Index))) + (T (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Var 's' e.Index))) e.ClashesEnd (e.Assigns) = /* нет решений */; @@ -560,7 +560,7 @@ Solve-Clashes { /* {m} #var {n} : (P) ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - (s._ (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Brackets e._))) + (T (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Brackets e._))) e.ClashesEnd (e.Assigns) = /* нет решений */; @@ -573,7 +573,7 @@ Solve-Clashes { /* {m} #var {n} : [X P] ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - (s._ (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) + (T (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) e.ClashesEnd (e.Assigns) = /* нет решений */; @@ -668,7 +668,7 @@ Solve-Clashes { /* {m} #var {n} : Y ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart - (s._ (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Symbol e._))) + (T (('{'s.M'}') (ScrVar e._) ('{'s.N'}')) ':' ((Symbol e._))) e.ClashesEnd (e.Assigns) = /* нет решений */; From 1618610eed8a581ee84051a93ef8aa71f8d476b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 13:23:20 +0300 Subject: [PATCH 120/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D0=B3=D0=B8=20=D0=B8=C2=A0=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index b57a7202..8105f4ea 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -609,8 +609,8 @@ Solve-Clashes { ((Var 't' e.Index) ':' (ADT-Brackets (e.Name) (Var 'e' e.NewIndex))) (e.Contrs) e.ClashesStart (T - (('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) - ':' ((ADT-Brackets (e.Name) e.PBody)) + (('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) ':' + ((ADT-Brackets (e.Name) e.PBody)) ) e.ClashesEnd (e.Assigns) > @@ -837,7 +837,7 @@ Solve-Clashes { (e.Contrs) (e.Assigns) From ef3f388453f20c0255d2aa3b9f746ca68b9aaf6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 19:56:04 +0300 Subject: [PATCH 121/208] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D0=B0=20=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B4=D0=BB=D1=8F=20=D0=BA=D0=BB=D1=8D=D1=88?= =?UTF-8?q?=D0=B5=D0=B9=20e.X=20E=20:=20Pt=20P=20(#322,=20#314,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Пояснения — см. в комментарии к исходному тексту. --- src/compiler/GenericMatch.ref | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 8105f4ea..0fd2aa62 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -806,8 +806,28 @@ Solve-Clashes { (e.Assigns) > : e.Branch2 + /* + Сначала ищем решение для более короткой ветки вычислений (где + переменная стирается), а затем для более длинной. Если сначала + решать уравнения для более длинной ветки, то в патологических + случаях вида + e.X : 'abc...xyz' + размер поля зрения в пике будет квадратичным: + + + + + ... + + но при этом все ветви, кроме первой, обрежутся. + + Поэтому сначала решаем вторую ветвь, а потом первую. При этом + относительный порядок решений важен — решения второй ветви + должны располагаться после решений первой. + */ + = : e.Solutions2 = - ; + e.Solutions2; /* {m} E e.X {n} : P Pt ↦ e.X → e.NEW1 t.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -843,8 +863,10 @@ Solve-Clashes { (e.Assigns) > : e.Branch2 + /* См. комментарий в предыдущем предложении. */ + = : e.Solutions2 = - ; + e.Solutions2; /* могли остаться только клэши вида E : e.X P e.Y */ (e.UsedVars) (s.OpenFlag e.Contrs) From cdbc72d6a61651b4c87391b0e1514bd65ef638ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 19:57:33 +0300 Subject: [PATCH 122/208] =?UTF-8?q?=D0=A3=D1=81=D0=B5=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=8D=D0=BA=D1=80=D0=B0=D0=BD=D0=B8=D1=80=D1=83?= =?UTF-8?q?=D0=B5=D0=BC=D1=8B=D1=85=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BB=D0=BE?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=BF=D1=80=D0=B8=20=D1=81?= =?UTF-8?q?=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20(#251,=20#314,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 4409a629..1e6983aa 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -937,13 +937,20 @@ IsTrivialSubstitutions { } CreateNewSentences { - (e.Arg) (e.NewSentences) - ((e.Sol) e.Solutions) (((e.Pat) e.Tail) e.Body) + (e.Arg) (e.NewSentences) (e.Solutions) (e.Body) = : e.PatternTemplate + = +} + +DoCreateNewSentences { + (e.PatTemplate) (e.NewSentences) + ((e.Sol) e.Solutions) (((e.Pat) e.Tail) e.Body) = : e.Pat^ + = : e.Pat^ = : e.Tail^ = (e.NewSentences ((e.Pat) e.Tail)); } @@ -951,9 +958,23 @@ CreateNewSentences { e.Sol > : (e.NewSentences^) - = ; + = ; - (e.Arg) (e.NewSentences) (/* пусто */) (/* пусто */) = e.NewSentences; + (e.PatTemplate) (e.NewSentences) (/* пусто */) (/* пусто */) + = e.NewSentences + : { + /* + Если образец одного из предложений совпадает с шаблоном + (к нему не применилось ни одно из сужений) и условий нет, + то это предложение экранирует все последующие. + */ + e.Prefix ((e.PatTemplate) (e.Result)) e.ScreenedSentences + = e.Prefix ((e.PatTemplate) (e.Result)); + + e.NewSentences^ = e.NewSentences; + }; } ApplySubst-Tail { From 41ce59e8d0d0b0426642a151b3120c4034e5ec1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 15 Aug 2021 20:16:28 +0300 Subject: [PATCH 123/208] =?UTF-8?q?=D0=9E=D0=BF=D1=86=D0=B8=D1=8F=20-OA=20?= =?UTF-8?q?=D0=BC=D0=B0=D1=80=D0=BA=D0=B8=D1=80=D1=83=D0=B5=D1=82=20=D0=92?= =?UTF-8?q?=D0=A1=D0=95=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BA=D0=B0=D0=BA=20=D1=81=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7=D0=B8=D1=80=D1=83=D0=B5=D0=BC=D1=8B=D0=B5=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Выяснилось, что на тесте opt-pattern5.sref началось нелинейное (квадратичное) потребление памяти, из-за чего компилятор стал вылетать по лимитам. Два предыдущих коммита были попытками обуздать эту нелинейность, частично успешными. Нелинейность была побеждена путём принудительного обобщения аргумента функции OutlineConstants этого теста. Ранее проблема не выявлялась, т.к. функции в тесте opt-pattern5.sref не маркировались автоматически для специализации. Для читабельности коммита в OptTree-AutoMarkup-Spec.ref был добавлен новый код без удаления старого. Старый будет удалён в следующем коммите. Обнаружен случайный тест, требующий более 100 000 000 шагов (конкретно, за 111 622 480 в режиме -OADS). Тест был добавлен как сохранённый. В дальнейшем, если удастся оптимизировать компилятор и тест будет проходить быстрее, порог можно поднять, а тест можно будет удалить. --- autotests/opt-pattern5.sref | 4 + .../@refal-5-lambda-diagnostics.ini | 2 +- ...ved-test-77_14.08.2021_20-00-01,67-big.ref | 408 ++++++++++++++++++ src/compiler/OptTree-AutoMarkup-Spec.ref | 27 ++ 4 files changed, 440 insertions(+), 1 deletion(-) create mode 100644 autotests/positive-random-test/saved-test-77_14.08.2021_20-00-01,67-big.ref diff --git a/autotests/opt-pattern5.sref b/autotests/opt-pattern5.sref index 9f61f9e9..9582fdb4 100644 --- a/autotests/opt-pattern5.sref +++ b/autotests/opt-pattern5.sref @@ -4,6 +4,7 @@ $ENTRY Go { = (0 ) (0 ) (0 ) @@ -52,10 +53,13 @@ $ENTRY Go { (#LABEL 145 ) (#CmdProfilerStopSentence ) (#CmdEmpty #AlgLeft 2 ) + > >; } +gen_e__ { e.arg = e.arg; } + RESULT { (#CmdFuncArray 6 ('DoGetFileName' ) diff --git a/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini b/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini index e89ae321..403ae40d 100644 --- a/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini +++ b/autotests/positive-random-test/@refal-5-lambda-diagnostics.ini @@ -1,5 +1,5 @@ memory-limit = 5000000 -step-limit = 100000000 +step-limit = 200000000 idents-limit = 5000 enable-debugger = false dump-file = __dump.txt diff --git a/autotests/positive-random-test/saved-test-77_14.08.2021_20-00-01,67-big.ref b/autotests/positive-random-test/saved-test-77_14.08.2021_20-00-01,67-big.ref new file mode 100644 index 00000000..d986b3e9 --- /dev/null +++ b/autotests/positive-random-test/saved-test-77_14.08.2021_20-00-01,67-big.ref @@ -0,0 +1,408 @@ +* Этот тест требует более 100 000 000 шагов в режиме -OADS, ради него +* лимит был повышен до 200 000 000 шагов. Если при оптимизации компилятора +* этот тест сможет проходить менее чем за 100 000 000 шагов, лимиты нужно +* будет поправить. + +$EXTERN ExtD ; + + + +$ENTRY C { + CB t.10 BB () s.13 = + s.13 (t.10 s.13 s.13 'b' A 6 ACD ABDA ) C s.13 9 DCA ; + CB C 'a' (D e.2 2 4 ) 'a' AD 6 'b' t.10 BB () s.13 + ,10 (9 0 'a' 1 5 A 'a' > 'd' ) : + { + C e.13 BCC () 'c' 9 + ,: + ,'d' : ((e.10 'b' AC s.11 ('c' +) 6 ) D 'd' 5 BDC e.2 ) ('a' (BC 9 A CDC CA ) 10 ABA t.3 'a' ) ('da' ) 'a' + + ,t.10 e.10 : + ,CBA : e.3 'b' + , (6 'cc' +AACC ) > 'c' (() ) : + { + C 10 6 DA = + ; + 10 6 DA + ,: CBBC + ,: + ,: + ,: C B e.3 + ,: () +9 (e.2 ) 1 = + ; + 'd' 3 10 6 DA + ,: CDD e.3 + ,: + ,: 0 e.5 + ,: + + ,: = + ; + }; + C CDC 'a' 9 'c' 9 + ,e.2 : + ,'d' : = + 'd' ; + }; + CB C 'a' () CC 3 () () 1 'b' t.10 BB () s.13 + ,(CAA ( 9 s.13 10 t.10 7 'a' > ) ABB D ) 7 'c' s.13 () > ) : + { + t.6 CC s.12 A t.3 + ,: CBA + ,: + ,: + ,: BCD + ,: +1 + ,: + { + 'b' s.13 + ,: = + ; + }; + }; + CB C 'a' () CC 3 () 1 'b' t.10 BB () s.13 + ,: + { + 'b' e.9 (2 'a' BDBA e.5 'd' ) e.5 'ac' (CCDA ) + ,'c' : BDB C + + , e.5 ('d' 5 ) BA : + ,: 'a' 5 BC = + ; + (BAA ) 8 1 () CBC 'a' 4 5 + ,s.13 4 'a' : + ,3 t.10 4 CCCC s.13 : +8 () 2 + ,'d' 4 : + ,: 'a' 8 'cdc' 10 = + ; + }; + CB C 'a' () CC 3 () s.6 C CC s.1 'dd' s.8 s.1 BB 'a' 8 1 'b' t.10 BB () s.13 + + ,s.6 : + { + s.11 A 1 1 10 t.6 t.8 'a' + ,: CBC e.5 + ,0 : + + ,s.11 t.8 ( ) (() s.1 ) : + { + CD e.11 + ,s.6 (10 ) : 10 6 'd' + , : + ,: DCDA e.11 5 = + ; + CD 'a' e.11 = + ; + CD 'c' s.5 'a' e.11 + ,1 10 : C 'c' e.3 + ,: (D ABCA ) + ,5 : + + ,'a' 1 : + ,: = + 10 ; + }; + s.11 DCB 3 7 ACBC e.10 s.13 'd' 10 t.6 t.8 'a' + ,: 8 BC 'd' + ,BB t.6 'a' +: + ,: + ,: ('acd' ((DBBC 'dc' ) e.1 'a' ) 7 DDD ) = + ; + s.11 DCB CCDA 10 'a' CDCC 10 DDDB ((B ) 'ab' ) 3 'd' t.5 'b' e.10 s.13 'd' 10 t.6 t.8 'a' + + ,9 'a' : + ,: e.11 'a' e.8 8 (e.1 1 'c' e.8 10 () 4 ) () +e.4 + ,4 : + { + 2 'c' + ,: + ,: e.13 'a' + ,CDCC : + ,CBC : e.9 'a' +e.3 = + t.6 C t.10 ; + }; + }; + CB C 'a' () CC 3 () s.6 C CC e.6 e.4 AC DCD e.13 4 8 9 ('b' s.2 ) 4 'c' 1 'b' +t.10 BB () s.13 = + BB 7 ; +} + +B { + s.11 5 'c' + , s.11 0 : + { + 2 () t.2 = + ; + }; + s.11 5 'ca' BCB DBCB e.8 'd' (B DDCC D 'cc' e.5 e.7 BD ) 0 t.8 () = + 'add' e.7 CAA 'a' ((() D 'c' ACA 6 > 2 ) 'bd' e.5 BBBB 'c' +('c' e.7 t.8 ) ) (t.8 3 3 s.11 ) ; + s.11 5 'c' s.5 BAA 8 e.7 t.8 () + , e.7 ( 'd' () BCC 'a' (t.8 ) ) 10 'a' ( ) 5 : + { + () DCD + ,1 B : BA e.8 + , : + ,: e.7 () + + ,'d' : 2 = + ; + }; +} + +A { + 'abdb' t.6 6 + ,'b' () t.6 ((2 ACA A ) ('a' BCDB t.6 C ) ('cb' +7 9 t.6 'cd' 10 t.6 t.6 ('b' t.6 t.6 10 ) ) 'd' BC ) : + { + (C ) () e.1 t.2 'd' ADBB (9 (s.9 2 ) ) + ,: t.4 + ,: e.11 'b' +e.5 e.9 2 6 'd' + ,: + ,: + ,: (DA e.3 ) (e.9 ) e.11 s.12 e.2 CCD = + ; + }; + CACC 'd' (BAAC e.3 ) e.8 'b' BABD CAAC e.10 = + e.8 ; + 'a' + ,10 ('ad' BDA ) 4 2 : + { + e.13 2 B = + ( ) 0 'c' > ; + 0 'd' BDAD = + ; + }; +} + +D { + 'a' (AACC 3 ) 'b' 5 e.1 'd' 5 = + e.1 ; + 10 t.11 10 D 'c' t.1 'd' 5 + ,'c' t.1 5 9 t.1 t.11 +BCC : + { + 'b' BC () e.12 ('aa' e.1 CB 'dc' BBBB ) 6 = + > ( 'a' e.12 t.11 > t.1 > 7 e.12 ) ; + 'b' 9 t.4 'ddd' B e.12 3 (e.11 'a' BD ) 8 C 3 6 = + ; + 'b' 9 t.4 s.5 'a' 8 C 3 6 + , 3 : + { + 'c' (2 DBBB e.2 (e.3 'b' ) t.9 ) 'ca' + ,t.9 : 10 + ,: + + ,: e.11 e.5 'd' 6 + ,: + ,: = + ; + 'c' (2 DBBB e.2 (e.3 'b' ) t.9 ) DD 'a' + ,: + ,'d' : ACB + ,DAA AAC 8 : + , : 'd' 7 BA = + ; + }; + }; + 10 CDA 'b' t.5 'a' BD e.10 5 t.11 10 D 'c' t.1 'd' 5 = + ; +} + +BBBDB { + () e.12 (1 ) 4 = + ; + 'b' (1 ) 4 + ,: + { + s.5 e.13 t.3 4 5 + ,C e.13 s.5 : + ,: 'b' (e.13 ) e.7 9 + + ,: + { + A 6 s.2 + ,C e.7 : e.2 e.8 5 + ,() : ('b' ) = + ; + A 6 s.2 'd' 5 = + 0 ; + }; + s.5 e.13 e.9 e.9 ADD + ,e.13 : e.2 'a' + ,: BCA 'a' e.11 e.6 = + ; + s.5 e.13 0 'a' e.9 'bc' ADBC t.11 CDC + ,: + ,7 : + + ,e.9 s.5 : 9 t.10 + , 6 CD B : 'd' + ,: DADA e.11 e.11 = + ; + }; + BA 'c' 4 'b' (1 ) 4 = + 8 ; + BA 'd' e.6 6 'b' (1 ) 4 + ,: + { + 4 + ,e.6 2 3 1 5 : BD ('d' 8 e.4 e.3 e.7 ) 6 0 + ,((e.6 +) ) (e.7 7 4 ) 0 : t.13 + ,'dacd' 4 : e.13 + ,: s.6 1 = + e.6 10 6 e.3 9 ) A > ; + (AAB BABB ) 4 + ,: e.1 'ad' + ,(DD ) ('dc' (0 4 ) ) 'a' : 'b' +C e.12 + ,: 'b' e.9 + ,e.9 ('d' ) : 'bc' = + BD ; + }; + BA ('b' ) t.4 'bb' 6 'b' (1 ) 4 + ,: + { + s.8 ('bc' AA ) 10 'b' 3 = + 3 ; + s.8 2 t.8 'a' 3 3 + ,BCBB : + ,: + ,t.8 > : + ,: + ,: = + ; + s.8 2 t.8 'a' ('a' CDD ) 5 s.13 3 = + t.8 ; + }; + BA ('b' ) t.4 'b' CBB DA t.13 'a' 6 'b' (1 ) 4 = + 2 'c' CDC ; +} + +DDAA { + CAD e.10 t.12 = + ; + e.3 t.11 t.12 = + 6 ((5 t.12 'a' 'c' + > AAB t.12 > ) ) ; + s.5 (CB ) 'ccabb' (s.9 'c' 0 CBCB e.5 'c' ('a' DDBD DA 'c' 9 e.10 BAA e.13 ) +'d' (A BDAA CBBB e.3 'd' ) 'a' 10 ) BD e.4 7 2 3 e.4 t.11 t.12 = + 'd' (BCB e.10 'b' A t.12 e.5 t.11 B 5 'c' ) ; + s.5 (CB ) A t.10 ((e.8 (7 8 e.8 C ) BCC (D 'c' 8 10 ) BBAA e.2 DCB 'a' BBDA 8 e.2 'a' +) DAB CDDB 0 'b' ('b' e.6 'b' (e.8 t.7 C ) 2 () ) 6 (0 ('a' e.4 B e.10 e.6 CABA 1 e.9 e.10 ) +1 ) ) 8 DAC e.1 4 e.9 'a' BACC CDA e.2 t.1 9 2 t.11 t.12 + ,CB : + { + e.9 ('c' ) CCC 'a' e.2 'd' t.10 + ,: + ,e.10 (5 'd' 10 e.8 ) +: + ,e.6 (() DB ) e.10 : 'c' 10 + ,3 'a' 1 e.6 : 3 = + ; + e.9 'd' 10 10 + ,CB t.1 'b' e.9 () : 'b' ((e.8 ('a' ) ) ) 0 + + ,BCAC 'ac' ACCC : 1 = + 'a' > ; + e.9 e.5 (CABC ) () 10 10 + , : e.2 e.2 DD CABA 9 e.11 + ,('c' + ) : 'c' (BBBB e.3 'd' DAA ('c' (s.8 'b' CBB 'c' ) (5 A 2 e.10 e.7 ) +) ) e.3 + , C : + ,D e.8 e.11 : () 'b' + + ,: = + (7 ADC t.10 (e.4 ) ) 1 8 e.10 ; + }; +} + +AD { + + , CC (6 'b' ABCC ) 'd' () 'a' AADB > : + + { + A D DAD C = + 2 ; + }; + 'b' AC BB 'd' s.3 + ,: + { + B e.6 () e.1 e.12 0 = + ; + B ('da' ) t.5 BDB e.13 e.5 s.4 'd' (e.12 2 'cc' e.9 s.2 (s.2 C 7 (e.10 e.3 2 BBAD 3 'a' +) (8 BBA 0 AD e.12 ) ('d' ) 0 ) ) BDAA (BA ) 'c' 6 BCDC e.1 e.12 0 + ,(CAA 'ca' +e.9 e.10 ) 'd' 8 DACD AD : + ,: t.3 + ,'b' ('a' ) : (6 A ) +(CCC DA ) + ,: e.7 ('d' 2 ) = + ; + }; + 'b' BBA t.11 t.9 s.13 (5 1 ACD ('d' ((DDA 'd' ) DBC CAD 'd' ) 'd' s.13 ((CBAA D ) +(BAD 'b' t.3 7 e.7 ) 0 ) ) (0 (9 t.3 'c' ) 4 ) ) t.2 AC BB 'd' s.3 + + ,( > BDC () (( 'b' (A 9 6 3 BCA ) (AC s.3 4 'b' ) ADD ) ) ) : + { + BBAC 6 (('a' 9 ) ) B + ,: + ,: AD + ,: + ,: + +,: = + ; + BBAC 6 t.3 3 + ,: 9 4 e.2 10 'd' + ,: e.4 4 B A 8 + ,: (6 DA 10 () +t.2 4 ) 'c' 7 (e.6 (e.3 ) e.9 e.3 e.13 ) C (((BABD ) e.10 e.7 (CB 5 e.4 'a' +) ) AC AC A 'b' (s.11 1 ) ) 0 = + ; + BBAC 6 t.3 'b' 5 s.6 'c' 3 + ,: 'cb' 5 8 ('db' (BA ) 6 ) = + ; + }; + 'b' BBA t.11 t.9 9 CA 'c' s.13 (5 1 ACD ('d' ((DDA 'd' ) DBC CAD 'd' ) 'd' s.13 ((CBAA D ) +(BAD 'b' t.3 7 e.7 ) 0 ) ) (0 (9 t.3 'c' ) 4 ) ) t.2 AC BB 'd' s.3 + + , s.3 > 10 : + { + t.10 DCD e.5 0 'a' DBA B + ,: 'a' CAB (e.12 ) CD = + 7 ; + t.10 s.5 6 'd' 1 'bc' e.13 B + ,ADD 6 : + ,'b' CAD : + ,: +e.5 = + ; + t.10 s.5 'c' CBCB 6 s.4 'd' BBB B + ,t.9 e.7 : 'd' AABD 'bca' + ,: +2 e.4 + ,DA (() 10 ) 6 4 t.10 > > : BCC D e.9 = + t.2 ; + }; +} diff --git a/src/compiler/OptTree-AutoMarkup-Spec.ref b/src/compiler/OptTree-AutoMarkup-Spec.ref index 8a6ff4bc..b7e93026 100644 --- a/src/compiler/OptTree-AutoMarkup-Spec.ref +++ b/src/compiler/OptTree-AutoMarkup-Spec.ref @@ -15,6 +15,33 @@ $EXTERN ExtractVariables-Expr; */ $ENTRY OptTree-AutoMarkup-Spec { + e.AST + = +} + +$ENTRY OptTree-AutoMarkup-Spec-OLD { e.AST = : (e.Forbidden) e.AST^ = Date: Sun, 15 Aug 2021 23:54:45 +0300 Subject: [PATCH 124/208] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=80=D1=8B=D0=B9=20=D0=BA=D0=BE=D0=B4=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=82=D0=BA=D0=B8=20=D1=81=D0=BF?= =?UTF-8?q?=D0=B5=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B8=D1=80=D1=83?= =?UTF-8?q?=D0=B5=D0=BC=D1=8B=D1=85=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D0=B9=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-AutoMarkup-Spec.ref | 279 ----------------------- 1 file changed, 279 deletions(-) diff --git a/src/compiler/OptTree-AutoMarkup-Spec.ref b/src/compiler/OptTree-AutoMarkup-Spec.ref index b7e93026..7e7fe546 100644 --- a/src/compiler/OptTree-AutoMarkup-Spec.ref +++ b/src/compiler/OptTree-AutoMarkup-Spec.ref @@ -1,15 +1,5 @@ $INCLUDE "LibraryEx"; -*$FROM GlobalGen -$EXTERN GlobalGen; - -*$FROM GenericMatch -$EXTERN GenericMatch; - -*$FROM TreeUtils -$EXTERN ExtractVariables-Expr; - - /** == e.AST */ @@ -40,272 +30,3 @@ $ENTRY OptTree-AutoMarkup-Spec { (Specs /* пусто */) e.AST > } - -$ENTRY OptTree-AutoMarkup-Spec-OLD { - e.AST - = : (e.Forbidden) e.AST^ - = - : e.ExtractedPatterns - = ; - - t.Other = /* пусто */; - } - e.AST - > - : e.SpecPatterns - = - > -} - -ForbiddenToSpecFunctions { - e.AST - = -} - -GetSpecifiedPattern { - (e.Name) e.ExtractedPatterns - = : e.IndexedGlobalGen - = - : Clear e.GenericMatch - = (e.GenericMatch); - } - e.ExtractedPatterns - > - : e.GenericMatches - = - : e.VariableMatchesDict - = : e.StaticCandidates - = - : { - /* пусто */ = /* нет статических переменных, пропускаем */; - - e.StaticParams - = : e.Pattern - = ((e.Name) e.Pattern); - }; -} - -GetIndexedGlobalGen { - e.Patterns - = : e.GlobalGen - = : e.GlobalGen^ - = : e.GlobalGen^ - = : e.GlobalGen^ - = e.GlobalGen; -} - -FillIndexes { - (e.GlobalGen) s.Type - = - : (e._) e.IndexedTypeGlobalGens - = e.IndexedTypeGlobalGens; -} - -FillIndexesRec { - (e.StartIndex) (e.GlobalGen) s.Type - = - : e.NewIndex - = (e.NewIndex) (e.IndexedVariable); - - (e.CurrentIndex) (Var e.Other) - = (e.CurrentIndex) (Var e.Other); - - (e.CurrentIndex) (Brackets e.Nested) - = - : (e.NextIndex) e.IndexedTypeGlobalGens - = (e.NextIndex) (Brackets e.IndexedTypeGlobalGens); - - (e.CurrentIndex) (ADT-Brackets (e.Name) e.Nested) - = - : (e.NextIndex) e.IndexedTypeGlobalGens - = (e.NextIndex) (ADT-Brackets (e.Name) e.IndexedTypeGlobalGens); - - (e.CurrentIndex) (Symbol e.Info) = (e.CurrentIndex) (Symbol e.Info); - } - (e.StartIndex) e.GlobalGen - > -} - -GetVariableMatches { - e.GenericMatches (e.IndexedGlobalGen) - = > : e.Variables - - = - : e.VariableBags - - = - : (e.VariableBags^) - - = e.VariableBags; -} - -GetVariableMatches-FillBag { - (e.VariableBags) (e.Subst) - = ; -} - -VarsSameIndex { - s.Mode ((Var s.Mode e._)) e.Matches = ; - s.Mode /* пусто */ = True; - s.Mode e._ = False; -} - -StaticCandidates { - e.VariableMatchesDict - = : True - = (s.Mode s.Index); - - t.VarMatches = /* пропускаем */; - } - e.VariableMatchesDict - > -} - -MarkupVarsInPattern { - (e.StaticParams) e.Pattern - = ); - - (Var s.Mode s.Index) = (Var s.Mode 'dyn' ); - - (Symbol e.Info) = (Symbol e.Info); - - (Brackets e.Expr) - = (Brackets ); - - (ADT-Brackets (e.Name) e.Expr) - = (ADT-Brackets - (e.Name) - ); - } - e.Pattern - >; -} - -FilterUnrepeatedStaticParams { - e.StaticCandidates (e.GenericMatches) - = - : e.GenericMatches^ - = ; -} - -FilterUnrepeatedStaticParams-CleanupMatch { - e.StaticCandidates (e.Substitution) - = - : e.Substitution^ - = (e.Substitution); -} - -FilterUnrepeatedStaticParams-RemoveBad { - e.StaticCandidates-B t.BadParam e.StaticCandidates-E (e.GenericMatches) - , e.GenericMatches : e._ (e.Subst) e._ - , e.Subst : e._ (t.MappedVar ':' t.BadParam) e._ (t.MappedVar ':' t._) e._ - = ; - - e.StaticCandidates (e.GenericMatches) = e.StaticCandidates; -} - -FilterSpecPatterns { - e.SpecializableDict (e.Forbidden) - = - : (e._) e.SpecDirectives - = e.SpecDirectives -} From 22e6b054eeb40e20a781d90860f9acd7a57db7fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 17 Aug 2021 08:19:14 +0300 Subject: [PATCH 125/208] =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=B4=D1=83=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=B6=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BE=D0=B1=D1=8A=D1=8F=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9=20$INTRINSIC=20=D0=B4=D0=BB=D1=8F=20=D0=BE=D0=BF=D1=80?= =?UTF-8?q?=D0=B5=D0=B4=D0=B5=D0=BB=D1=91=D0=BD=D0=BD=D1=8B=D1=85=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Объявления $INTRINSIC игнорируются для функций с определениями. Об этом выводятся предупреждения, также себя ведёт и рассахариватель (удаляет ненужные пометки). OptTree-Drive.ref учитывает тот факт, что множества интринсиков и прогоняемых функций не пересекаются. --- ...intrinsic-for-defined-function.WARNING.ref | 9 ++++++ src/compiler/Checker.ref | 29 +++++++++++++++++++ src/compiler/Config.ref | 5 +++- src/compiler/Desugaring.ref | 2 +- src/compiler/OptTree-Drive.ref | 3 -- src/compiler/ParseCmdLine.ref | 5 +++- src/lib/make.bat | 4 +-- src/lib/make.sh | 4 +-- 8 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 autotests/intrinsic-for-defined-function.WARNING.ref diff --git a/autotests/intrinsic-for-defined-function.WARNING.ref b/autotests/intrinsic-for-defined-function.WARNING.ref new file mode 100644 index 00000000..8108d065 --- /dev/null +++ b/autotests/intrinsic-for-defined-function.WARNING.ref @@ -0,0 +1,9 @@ +* WARNING intrinsic + +$INTRINSIC Add; + +$ENTRY Go { + = +} + +Add { 100 500 = 100500 } diff --git a/src/compiler/Checker.ref b/src/compiler/Checker.ref index 413a0199..f041c86b 100644 --- a/src/compiler/Checker.ref +++ b/src/compiler/Checker.ref @@ -115,6 +115,10 @@ PrepareMessage { BadPseudofunctionBody e.Name = 'Pseudofunction ' e.Name ' should have a body { e.X = e.X }, ' 'in other case function can\'t be encountered as pseudofunction'; + + IntrinsicForDefined e.Name + = 'Function ' e.Name ' is defined, ' + '$INTRINSIC declaration for it will be ignored'; } FindErrors { @@ -572,6 +576,7 @@ CheckDeclarations { &FindInvalidDriveInline &CheckRedefinitions &FindFinalInitEntry + &CheckIntrinsics > > } @@ -764,6 +769,30 @@ CheckRedefinitions { e.Declarations = e.Declarations; } +CheckIntrinsics { + e.Declarations-B + (Intrinsic t.SrcPosIntrinsic e.Name) e.Declarations-M + (Define t.SrcPosDefine s.ScopeClass e.Name) e.Declarations-E + = ; + + e.Declarations-B + (Define t.SrcPosDefine s.ScopeClass e.Name) e.Declarations-M + (Intrinsic t.SrcPosIntrinsic e.Name) e.Declarations-E + = ; + + e.Declarations = e.Declarations; +} + CheckFunctionBody { (e.Body) = ) e.Body>; diff --git a/src/compiler/Config.ref b/src/compiler/Config.ref index 56761c03..6228252b 100644 --- a/src/compiler/Config.ref +++ b/src/compiler/Config.ref @@ -18,7 +18,9 @@ $ENTRY Config-Create { (/* конец командной строки для библиотек */) ) (Optimize /* пусто */) - (WarningIds nul-in-compound pseudofunctions repeated deprecated) + (WarningIds + nul-in-compound pseudofunctions repeated deprecated intrinsic + ) (WarningIdsAsErrors /* пусто */) (ErrorFile /* пусто */) (DebugMode NoMarkupContext NoDebugInfo) @@ -536,6 +538,7 @@ WarningForName { 'pseudofunction' = True pseudofunctions; /* синоним */ 'repeated' = True repeated; 'deprecated' = True deprecated; + 'intrinsic' = True intrinsic; e.Other = False } diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index 035abcec..ec902866 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -842,7 +842,7 @@ Pass-CollectDeclarations { = : e.Externs^ = : e.Inlines^ - = : e.Intrinsics^ + = : e.Intrinsics^ = (Externs e.Externs) (Drives e.Drives) (Inlines e.Inlines) (Intrinsics e.Intrinsics) diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index 50b17ffc..cf0f7225 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -75,9 +75,6 @@ UpdateDriveInfo { = : (e.Intrinsics) e.AST^ = : (e.Metatables) e.AST^ - = : e.Drives^ - = : e.Inlines^ - = : e.KnownNames^ = : e.Drives^ diff --git a/src/compiler/ParseCmdLine.ref b/src/compiler/ParseCmdLine.ref index 74cc4c97..84abc182 100644 --- a/src/compiler/ParseCmdLine.ref +++ b/src/compiler/ParseCmdLine.ref @@ -304,7 +304,8 @@ $ENTRY ParseCommandLine { 'option -W expects \'all\', \'[no-]error[=...]\', ' '\'[no-]screening\', \'[no-]pseudofunctions\' ' '\'[no-]repeated\', \'[no-]deprecated\', ' - '\'[no-]nul-in-compound\', but got \'' e.BadValue '\'' + '\'[no-]nul-in-compound\', \'[no-]intrinsic\', ' + 'but got \'' e.BadValue '\'' ); (s.Pos EmptyErrorFileName) @@ -393,6 +394,8 @@ PrintHelp { ' (enabled by default)\n' ' -Wdeprecated, -Wno-... - warn/don\'t about deprecated syntax\n' ' (enabled by default)\n' +' -Wintrinsic, -Wno-... - warn/don\'t about illegal $INTRINSICs\n' +' (enabled by default)\n' ' -Werror[=...], -Wno-error[=...] - treat/don\'t all or only provided\n' ' warning(s) as error(s)\n' '-p, --prefix prefix-name\n' diff --git a/src/lib/make.bat b/src/lib/make.bat index 9d5a76b7..837724ce 100644 --- a/src/lib/make.bat +++ b/src/lib/make.bat @@ -29,7 +29,7 @@ setlocal for %%s in (%LIBS%) do ( ..\..\bin\rlc-core -C %RLC_FLAGS% %%s -d common ^ - --prelude=refal5-builtins.refi || exit /b 1 + --prelude=refal5-builtins.refi -Wno-intrinsic || exit /b 1 ..\..\bin\rlc-core --no-sources -R -o inco.bin ^ --incorporated=%%~ns || exit /b 1 find "//FROM" < %%s.ref > %TARGET%\%%s.rasl.froms @@ -103,7 +103,7 @@ setlocal pushd tmp for %%l in (%LIBRARIES%) do ( copy ..\%%l.ref . - call ..\..\..\bin\rlmake --scratch --makelib ^ + call ..\..\..\bin\rlmake --scratch --makelib -X-Wno-intrinsic ^ -o ..\..\..\lib\%%l.dll %%l.ref || exit /b 1 erase %%l.ref ) diff --git a/src/lib/make.sh b/src/lib/make.sh index 8d1336dc..c86d510a 100755 --- a/src/lib/make.sh +++ b/src/lib/make.sh @@ -12,7 +12,7 @@ compile_separated() { for s in ${LIBS}; do # shellcheck disable=SC2086 ../../bin/rlc-core -C ${RLC_FLAGS} "$s" -d common \ - --prelude=refal5-builtins.refi || exit 1 + --prelude=refal5-builtins.refi -Wno-intrinsic || exit 1 ../../bin/rlc-core --no-sources -R -o inco.bin \ --incorporated="$s" || exit 1 grep '//FROM' < "$s".ref > "$TARGET/$s".rasl.froms @@ -78,7 +78,7 @@ compile_dynamic() { ( cd tmp && for l in ${LIBRARIES}; do cp ../"$l".ref . - ../../../bin/rlmake --scratch --makelib \ + ../../../bin/rlmake --scratch --makelib -X-Wno-intrinsic \ -o ../../../lib/"$l$(platform_lib_suffix)" "$l".ref || exit 1 rm -- "$l".ref done From f068f992337d3a05d089349d376f2047018cb565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 17 Aug 2021 08:23:18 +0300 Subject: [PATCH 126/208] =?UTF-8?q?=D0=A1=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8:=20=D0=BE?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4=D0=B0=20(#314,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Коммит смотреть с опцией игнорирования пробелов. --- src/compiler/Checker.ref | 82 +++++++++++++-------------- src/compiler/ParseCmdLine.ref | 102 +++++++++++++++++----------------- 2 files changed, 92 insertions(+), 92 deletions(-) diff --git a/src/compiler/Checker.ref b/src/compiler/Checker.ref index f041c86b..ab9da41a 100644 --- a/src/compiler/Checker.ref +++ b/src/compiler/Checker.ref @@ -1089,62 +1089,62 @@ CheckValidUsings { (Declare t.SrcPos s.ScopeClass e.Name) e.DeclarationsAndErrors-E ) - (Symbol Name t.SrcPosName e.Name) e.NameRefsAndErrors = - ; + (Symbol Name t.SrcPosName e.Name) e.NameRefsAndErrors + = ; ( e.DeclarationsAndErrors-B (Define t.SrcPos s.ScopeClass e.Name) e.DeclarationsAndErrors-E ) - (Symbol Name t.SrcPosName e.Name) e.NameRefsAndErrors = - ; + (Symbol Name t.SrcPosName e.Name) e.NameRefsAndErrors + = ; (e.DeclarationsAndErrors) - (Symbol Name t.SrcPos e.Name) e.NameRefsAndErrors = - ; + (Symbol Name t.SrcPos e.Name) e.NameRefsAndErrors + = ; (e.DeclarationsAndErrors) - (Error t.SrcPos s.Type e.Info) e.NameRefsAndErrors = - ; + (Error t.SrcPos s.Type e.Info) e.NameRefsAndErrors + = ; (e.DeclarationsAndErrors) - (Warning s.WarningId t.SrcPos s.Type e.Info) e.NameRefsAndErrors = - ; - (e.DeclarationsAndErrors) /* кончились ошибки и имена */ = - ; + t.OtherItem = /* пропускаем */; + } + e.DeclarationsAndErrors + >; } diff --git a/src/compiler/ParseCmdLine.ref b/src/compiler/ParseCmdLine.ref index 84abc182..db46cd24 100644 --- a/src/compiler/ParseCmdLine.ref +++ b/src/compiler/ParseCmdLine.ref @@ -271,57 +271,57 @@ $ENTRY ParseCommandLine { } ) { - (t.Config /* нет ошибок */) e.FileNames = - Success t.Config e.FileNames; - - (t.Config e.Errors) e.FileNames = - Fails - ; + (t.Config /* нет ошибок */) e.FileNames + = Success t.Config e.FileNames; + + (t.Config e.Errors) e.FileNames + = Fails + ; } > >; From 18e35b7c7c7c9a0c0430e7958536c9b9e13aa06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 17 Aug 2021 11:37:04 +0300 Subject: [PATCH 127/208] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B3=D0=BE=D0=BD?= =?UTF-8?q?=D1=89=D0=B8=D0=BA=20=D1=81=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=20=D0=B4=D0=B8=D1=80=D0=B5=D0=BA=D1=82=D0=B8=D0=B2=D1=83=20$IN?= =?UTF-8?q?LINE=20=D1=81=D0=B8=D0=BD=D0=BE=D0=BD=D0=B8=D0=BC=D0=BE=D0=BC?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20$DRIVE=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Изменения внесены на уровне прогонщика, т.к. для целей отладки остальные компоненты (в частности, разметка для прогонки) оставлены прежними. Разметка для прогонки по-разному интерпретирует метки $INLINE и $DRIVE. Любопытно, что этот коммит замедляет время работы компилятора в режиме -OiDRPS. Был сделан замер с 9 проходами с параметрами set BENCH_FLAGS=-OiDPRS set RLMAKE_FLAGS=-X-OiDPRS до этого коммита и на нём. • До: (Total refal time): 125,20100 [124,787…125,691], Step count 175 608 086, • После (Total refal time): 132,17600 [132,025…132,672], Step count 191 734 143. Число шагов возросло на 9,2 %, время работы — на 5,6 %. Операций стало выполняться больше, но производительность при этом возросла. --- src/compiler/OptTree-Drive.ref | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index cf0f7225..52c44a69 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -71,14 +71,14 @@ BaseName { UpdateDriveInfo { s.OptDrive s.OptIntrinsic ((e.KnownNames) e.KnownFunctions) e.AST = : (e.Drives) e.AST^ - = : (e.Inlines) e.AST^ + = : (e.DrivesI) e.AST^ = : (e.Intrinsics) e.AST^ = : (e.Metatables) e.AST^ + = e.Drives e.DrivesI : e.Drives^ = : e.KnownNames^ = : e.Drives^ - = : e.Inlines^ = : e.Intrinsics^ = : e.Metatables^ @@ -88,7 +88,7 @@ UpdateDriveInfo { = '$' > : e.Label = >; } - e.Drives e.Inlines e.Intrinsics e.Metatables + e.Drives e.Intrinsics e.Metatables > : /* пусто */ @@ -100,30 +100,14 @@ UpdateDriveInfo { } : e.Drives^ - = s.OptDrive - : { - NoOpt = /* пусто */; - OptInline = e.Inlines; - OptDrive = e.Inlines; - } - : e.Inlines^ - - = : e.ExtractedNames + = : e.ExtractedNames = : (e.Extracted) e.AST^ = : (e.Lengths) e.AST^ = : e.Drives^ - = : e.Inlines^ - - /* - Функция Func может быть помечена как $INLINE, рассахариватель условий - извлёк Func*k, авторазметка пометила её как $DRIVE. - Пометка $INLINE имеет приоритет. - */ - = : e.Drives^ - = e.Drives e.Inlines e.Metatables : e.OptNames + = e.Drives e.Metatables : e.OptNames = : e.OptFunctions From dbc6b0fa20875768a0bcc49ceaa91f6faaba2bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 17 Aug 2021 17:04:50 +0300 Subject: [PATCH 128/208] =?UTF-8?q?FIXED:=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=D0=BD=D0=BA=D0=B0=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=B0=20?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D0=B0=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86?= =?UTF-8?q?=D1=8B=20=D1=80=D1=83=D1=88=D0=B8=D0=BB=D0=B0=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BF=D0=B8=D0=BB=D1=8F=D1=82=D0=BE=D1=80=20(#314,=20#35?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/meta-call.FAILURE.ref | 13 +++++++++++++ src/compiler/OptTree-Drive.ref | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 autotests/meta-call.FAILURE.ref diff --git a/autotests/meta-call.FAILURE.ref b/autotests/meta-call.FAILURE.ref new file mode 100644 index 00000000..b42984bf --- /dev/null +++ b/autotests/meta-call.FAILURE.ref @@ -0,0 +1,13 @@ +* TREE + +$META MetaCall; + +$ENTRY Go { + = +} + +__Meta_MetaCall { + e._ s.Table = +} + +__Step-Drop { = } diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index 52c44a69..d7b20337 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -126,7 +126,7 @@ UpdateDriveInfo { > : e.OptIntrinsicFuncs - = : e.HashSetNames + = : e.HashSetNames = (DriveInfo (e.HashSetNames) From f13719b620a351395f38d2083734c9f9d1e446b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 17 Aug 2021 17:21:17 +0300 Subject: [PATCH 129/208] =?UTF-8?q?=D0=98=D0=BC=D0=B5=D0=BD=D0=B0=20=D0=BC?= =?UTF-8?q?=D0=B5=D1=82=D0=B0=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=20=D0=BD?= =?UTF-8?q?=D0=B5=C2=A0=D1=80=D0=B0=D1=81=D0=BF=D0=B5=D1=87=D0=B0=D1=82?= =?UTF-8?q?=D1=8B=D0=B2=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D0=B2=C2=A0=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B5=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index d7b20337..2a356de0 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -88,7 +88,7 @@ UpdateDriveInfo { = '$' > : e.Label = >; } - e.Drives e.Intrinsics e.Metatables + e.Drives e.Intrinsics > : /* пусто */ From daef9ac53f03549b4ebed55671411510a35f4a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 17 Aug 2021 23:13:50 +0300 Subject: [PATCH 130/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D1=81=D1=82=D1=80=D1=83=D0=BA?= =?UTF-8?q?=D1=82=D1=83=D1=80=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=B0=D0=BB=D0=B3=D0=BE=D1=80=D0=B8=D1=82=D0=BC=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=BA=D0=B8=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 54 ++++++++++--------- src/compiler/OptTree-Drive.ref | 80 ++++++++++++----------------- 2 files changed, 62 insertions(+), 72 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index d95402c4..c8f6c8ad 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -203,17 +203,17 @@ FlatDriveTree { OptExpr-Aux { (e.UsedVars) (e.WholeVars) (e.Expr) (CallBrackets (Symbol Name e.Name) e.Args) - t.Metatables e.OptFuncs + s.Contractions-Mode t.Metatables e.OptFuncs /* Поиск информации для прогонки */ = : e.OptFuncs^ t.FunctionForDrive = : t.Metatables^ e.SubstitutionPacks - = (t.Metatables e.OptFuncs) + = (s.Contractions-Mode t.Metatables e.OptFuncs) == t.Metatables (e.Substitutions)* @@ -242,8 +243,9 @@ eDRIVEN { правой части. */ OptExpr-MakeSubstitutions { + s.Contractions-Mode (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.IntrinsicFunction t.Metatables - , t.IntrinsicFunction : (Intrinsic (e._) Intrinsic e.BehaviorName) + , t.IntrinsicFunction : ((e._) Intrinsic e.BehaviorName) = : { t.Metatables^ Ok e.Result @@ -255,19 +257,20 @@ OptExpr-MakeSubstitutions { ; }; - (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.Function t.Metatables + s.Contractions-Mode (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) + t.Function t.Metatables /* Активные вызовы игнорируем */ , : False = t.Metatables ; - (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) - (s.FuncMode (e.Name) Sentences e.Body) t.Metatables + s.Contractions-Mode (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) + ((e.Name) Sentences e.Body) t.Metatables - = s.FuncMode + = s.Contractions-Mode : { - Drive = e.WholeVars; - Inline = e.UsedVars; + Contractions-Enabled = e.WholeVars; + Contractions-Disabled = e.UsedVars; } : e.WholeVars^ @@ -275,23 +278,24 @@ OptExpr-MakeSubstitutions { ; - (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.Function t.Metatables + t.Contractions-Mode (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) + t.Function t.Metatables = t.Metatables ; } MakeColdSolution { - (e.UsedVars) (s.FuncMode (e.Name) s.BodyLabel e.Body) e.Args + (e.UsedVars) ((e.Name) Sentences e.Body) e.Args , e.Name : e.Prefix '*' s.Num = ( (e.UsedVars) ( ':' (ColdCallBrackets (Symbol Name e.Name) e.Args)) - ((NewFunction (e.Name) s.BodyLabel e.Body)) + ((NewFunction (e.Name) Sentences e.Body)) ); - (e.UsedVars) (s.FuncMode (e.Name) s.BodyLabel e.Body) e.Args + (e.UsedVars) ((e.Name) s._ e.Body) e.Args = ( (e.UsedVars) ( ':' (ColdCallBrackets (Symbol Name e.Name) e.Args)) @@ -301,7 +305,7 @@ MakeColdSolution { DoOptExpr-MakeSubstitutions { (e.SentenceVars) (e.WholeVars) (e.Args) (e.Substitutions) - (Function (e.Name) Sentences ((e.LS) (e.RS)) e.Rest) + ((e.Name) Sentences ((e.LS) (e.RS)) e.Rest) = : e.RS^ = : { @@ -335,7 +339,7 @@ DoOptExpr-MakeSubstitutions { = e.Substitutions e.NewSubstitutions : e.Substitutions^ = ) Sentences e.Rest) + (() Sentences e.Rest) >; /* @@ -346,7 +350,7 @@ DoOptExpr-MakeSubstitutions { = e.Substitutions ; }; @@ -397,16 +401,16 @@ FindOptInfo { } FindOptInfo-Aux { - e.OptFuncs-B (Intrinsic (e.LookupName) e.Body) e.OptFuncs-E - (e.Name) (e.LookupName) s._ - = e.OptFuncs-B (Intrinsic (e.LookupName) e.Body) e.OptFuncs-E - (Intrinsic (e.Name) e.Body); + e.OptFuncs-B ((e.LookupName) Intrinsic e.Body) e.OptFuncs-E + (e.Name) (e.LookupName) 0 + = e.OptFuncs-B ((e.LookupName) Intrinsic e.Body) e.OptFuncs-E + ((e.Name) Intrinsic e.Body); - e.OptFuncs-B (s.Mode (e.LookupName) e.Body) e.OptFuncs-E + e.OptFuncs-B ((e.LookupName) e.Body) e.OptFuncs-E (e.Name) (e.LookupName) s.Drop = e.Body : Sentences e.Sentences - = e.OptFuncs-B (s.Mode (e.LookupName) e.Body) e.OptFuncs-E - (s.Mode (e.Name) Sentences ); + = e.OptFuncs-B ((e.LookupName) e.Body) e.OptFuncs-E + ((e.Name) Sentences ); } $DRIVE CutSUF; diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index 2a356de0..c5a3054c 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -17,14 +17,15 @@ $EXTERN OptTree-Drive-Expr; /* В дерево добавляется узел (DriveInfo e.DriveInfo). - e.DriveInfo ::= (e.OptFuncNames (e.OptFunctions)) + e.DriveInfo ::= (e.OptFuncNames) e.OptFunctions e.OptFuncNames ::= e.HashSet e.HashSet ::= s.BucketSize (e.Bucket)* e.Bucket ::= (s.Hash (s.Label e.Name)*) - e.OptFunctions ::= t.OptFunction* + e.OptFunctions ::= s.ContractMode (Metatables s.Metatable*) t.OptFunction* - t.OptFunction ::= (s.Label (e.Name) e.OptBody) - e.OptBody ::= Sentences e.Sentences + s.ContractMode ::= Contractions-Enabled | Contractions-Disabled + t.OptFunction ::= ((e.Name) Sentences e.Sentences) + t.Metatable ::= ((e.Name) e.Metatable) */ @@ -42,7 +43,9 @@ $ENTRY OptTree-Drive-Prepare { = ; (s.OptDrive s.OptIntrinsic) e.AST - = ( /* no names */) /* no info */ : e.EmptyInfo + = ( /* no names */) + Contractions-Enabled (/* no metatables */) /* no info */ + : e.EmptyInfo = ; } @@ -70,17 +73,16 @@ BaseName { UpdateDriveInfo { s.OptDrive s.OptIntrinsic ((e.KnownNames) e.KnownFunctions) e.AST + = e.KnownFunctions : s._ (e._) e.KnownFunctions^ = : (e.Drives) e.AST^ = : (e.DrivesI) e.AST^ = : (e.Intrinsics) e.AST^ - = : (e.Metatables) e.AST^ = e.Drives e.DrivesI : e.Drives^ = : e.KnownNames^ = : e.Drives^ = : e.Intrinsics^ - = : e.Metatables^ = : e.ExtractedNames - = - : (e.Extracted) e.AST^ + = : e.DrivesBaseNames + = + : (e.DriveFuncs) e.AST^ + + = : (e.Metatables) e.AST^ = : (e.Lengths) e.AST^ = : e.Drives^ - = e.Drives e.Metatables : e.OptNames - - = : e.OptFunctions - = s.OptIntrinsic : { NoOpt = /* пусто */; @@ -120,7 +120,7 @@ UpdateDriveInfo { = @@ -128,9 +128,18 @@ UpdateDriveInfo { = : e.HashSetNames + = s.OptDrive + : { + NoOpt = Contractions-Disabled; + OptInline = Contractions-Disabled; + OptDrive = Contractions-Enabled; + } + : s.ContractionsMode + = (DriveInfo (e.HashSetNames) - e.KnownFunctions e.OptFunctions e.OptIntrinsicFuncs + s.ContractionsMode (e.Metatables) + e.KnownFunctions e.DriveFuncs e.OptIntrinsicFuncs ) e.AST; } @@ -193,7 +202,7 @@ ExtractExtractableFunctions { (Function (e.Name) e.Body) = ( (e.Names-B e.Names-E) - e.Extracted (Function (e.Name) e.Body) + e.Extracted ((e.Name) e.Body) ) (Function (e.Name) e.Body); @@ -238,29 +247,6 @@ MultiplyRemainderNames { = e.RemainderNames; } -FormatOptFunctions { - (e.OptNames) e.Functions - = ) e.Functions - > - : (e._) e.OptFunctions - = e.OptFunctions; -} - HashSet { e.Names = @@ -309,8 +295,7 @@ $ENTRY OptTree-Drive { /* Осуществляет прогонку или оптимизацию в зависимости от ключа */ DriveInlineOptimizerTick { - ((e.OptNames) e.OptInfo) e.AST - = ((e.OptNames) ) : t.OptInfo + t.OptInfo e.AST = - : ((e.OptNames^) t.Metatables e.OptInfo^) e.AST^ + : ((e.OptNames) e.OptFunctions) e.AST^ = : (e.NewFunctions^) e.AST^ - = (DriveInfo (e.OptNames) e.OptInfo) e.AST e.NewFunctions; + = (DriveInfo (e.OptNames) e.OptFunctions) e.AST e.NewFunctions; } /* @@ -432,12 +417,13 @@ OptSentence { t.Sentence t.OptInfo = t.OptInfo () t.Sentence } -WithMetatables { +ExtractMetatables { e.OptFuncs = Date: Thu, 19 Aug 2021 08:04:10 +0300 Subject: [PATCH 131/208] =?UTF-8?q?=D0=9E=D0=BF=D1=86=D0=B8=D1=8F=20-OA=20?= =?UTF-8?q?=D0=BC=D0=B0=D1=80=D0=BA=D0=B8=D1=80=D1=83=D0=B5=D1=82=20=D0=92?= =?UTF-8?q?=D0=A1=D0=95=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BA=D0=B0=D0=BA=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D1=8F?= =?UTF-8?q?=D0=B5=D0=BC=D1=8B=D0=B5=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Для читабельности коммита в OptTree-AutoMarkup-Drive.ref был добавлен новый код без удаления старого. Старый будет удалён в следующем коммите. В тесте opt-tree-spec12.ref заблокирована возможность прогонки и специализации функции F, т.к. с новым алгоритмом разметки он перестал входит в лимит числа шагов. --- autotests/opt-tree-spec12.ref | 26 +++++----- src/compiler/OptTree-AutoMarkup-Drive.ref | 60 +++++++---------------- 2 files changed, 33 insertions(+), 53 deletions(-) diff --git a/autotests/opt-tree-spec12.ref b/autotests/opt-tree-spec12.ref index 529ec13a..5504aab7 100644 --- a/autotests/opt-tree-spec12.ref +++ b/autotests/opt-tree-spec12.ref @@ -2,21 +2,23 @@ $ENTRY Go { /* empty */ - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') - = : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') + = ) ()> : ('AA') ('BB') ('CC') ('DD') = /* empty */; } +gen_e__ { e.arg = e.arg } + F { (e.1) (e.2) = ; } diff --git a/src/compiler/OptTree-AutoMarkup-Drive.ref b/src/compiler/OptTree-AutoMarkup-Drive.ref index 1833c6d0..517df1cc 100644 --- a/src/compiler/OptTree-AutoMarkup-Drive.ref +++ b/src/compiler/OptTree-AutoMarkup-Drive.ref @@ -15,13 +15,25 @@ $ENTRY OptTree-AutoMarkup-Drive { = : t.MetaInfo e.AST^ = t.MetaInfo : ((e.Forbidden) (e.Inlines) (e.UserdefDrives) (e.Entries)) - = : (e.Indirects) e.Graph + = : e.Roots - = - : (ToDrive e.ToDrive) (Basics e.Basics) (Unreachable e.Unreachable) - = : e.ToDrive^ - = + /* пользовательскую разметку игнорируем */ + (Drives e.Drives) (Drives e._) + = (Drives e.Drives) /* игнорируем */; + + (Drives e.Drives) t.Other = (Drives e.Drives) t.Other; + } + (Drives /* пусто */) e.AST + > } BuldCallGraph { @@ -501,41 +513,7 @@ UpdateAST { == e.AST */ $ENTRY OptTree-AutoMarkup-CureDrives { - e.AST - = : t.MetaInfo e.AST^ - = t.MetaInfo : ((e.Forbidden) (e.Inlines) (e.UserdefDrives) (e.Entries)) - - = : (e.Indirects) e.Graph - - = - : (e.DrivenNodes) e.NamesCalledFromUndriven - - = - : e.Roots - = : e.Roots^ - = - : (ToDrive e.ToDrive) (Basics e.Basics) (Unreachable e.Unreachable) - - /* новых функций для прогонки не добавляем */ - = /* пусто */ : e.ToDrive^ - = + e.AST = e.AST; } SetIntersect { From 63e792fb7e9e423f10d337192ac7e2a583a638ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Thu, 19 Aug 2021 08:06:08 +0300 Subject: [PATCH 132/208] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=BF=D0=B8=D0=BB?= =?UTF-8?q?=D1=8F=D1=82=D0=BE=D1=80=20=D1=81=D0=B0=D0=BC=D0=BE=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=D0=BC=D0=B5=D0=BD=D1=8F=D0=B5=D1=82=D1=81=D1=8F=20=D0=B2?= =?UTF-8?q?=C2=A0=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=B5=20-X-OiADPRS=20-X--l?= =?UTF-8?q?og=3D=E2=80=A6=20(#314,=20#332)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Предыдущий коммит опять углубил возможности оптимизации, из-за чего пришлось выявлять и купировать очередные распухания. --- src/compiler/Desugaring-UnCondition.ref | 2 +- src/compiler/Desugaring.ref | 2 +- src/compiler/GST.ref | 5 ++++- src/compiler/HighLevelRASL-GenResult-Opt.ref | 8 +++++++- src/compiler/Log-AST.ref | 9 +++++++-- src/compiler/OptTree-AutoMarkup-Drive.ref | 5 ++++- src/compiler/OptTree-Drive-Expr.ref | 6 +++++- src/compiler/OptTree-Drive.ref | 7 +++++-- src/compiler/OptTree-Spec.ref | 10 ++++++---- src/compiler/OptTree.ref | 4 ++++ src/compiler/main.ref | 4 +++- 11 files changed, 47 insertions(+), 15 deletions(-) diff --git a/src/compiler/Desugaring-UnCondition.ref b/src/compiler/Desugaring-UnCondition.ref index a1e5f9e4..38e8251e 100644 --- a/src/compiler/Desugaring-UnCondition.ref +++ b/src/compiler/Desugaring-UnCondition.ref @@ -223,7 +223,7 @@ HardItem { } BindBrackets { - (e.Expr) = (); + (e.Expr) = () e.Expr>); } DoBindBrackets { diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index ec902866..dc548fcf 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -235,7 +235,7 @@ EnumerateVars-Assignments { = : e.Blocks^ = : (e.ScopeVars^) e.Pattern^ = ) (e.ScopeVars) e.Assignments >; } diff --git a/src/compiler/GST.ref b/src/compiler/GST.ref index bc671dde..48b7d6db 100644 --- a/src/compiler/GST.ref +++ b/src/compiler/GST.ref @@ -72,12 +72,15 @@ TileCandidates { { (e.AlignedPattern t.Last) (t.First e.AlignedResult) = ) + () (e.AlignedResult) >; } >; } +gen_e__ { e.arg = e.arg } + EnumExprs { s.Num (e.ScannedPattern) (t.PatternItem e.Pattern) diff --git a/src/compiler/HighLevelRASL-GenResult-Opt.ref b/src/compiler/HighLevelRASL-GenResult-Opt.ref index c7fdc2ce..c9d765bd 100644 --- a/src/compiler/HighLevelRASL-GenResult-Opt.ref +++ b/src/compiler/HighLevelRASL-GenResult-Opt.ref @@ -362,6 +362,7 @@ AddOffsets { { s.Offset (Tile e.Tile) = s.Offset + (Tile + (VarCopy s.Offset ); s.Offset (Var 't' e.Index) = + (VarCopy s.Offset ); s.Offset (Var 'e' e.Index) = + (VarCopy s.Offset ); s.Offset (TkString e.String) = - (TkString e.String s.Offset); + (TkString e.String s.Offset); s.Offset (s.Tag e.Info) = (s.Tag e.Info s.Offset); } @@ -406,6 +410,8 @@ AddOffsets { >; } +gen_e__ { e.arg = e.arg } + GetSampleOffset { e._ (s.Mode (e.Index) e.Offsets s.SampleOffset) e._ (s.Mode e.Index) = s.Mode e.Index s.SampleOffset; diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index 81b8ac7a..47279865 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -193,6 +193,10 @@ PutComment { } Tail { + (e.Indent) e.Tail = >; +} + +Tail-GEN { (e.Indent) (Condition (e.Name) (e.Result) (e.Pattern)) e.Tail = e.Indent ', ' ' : ' : e.OneLineCondition @@ -297,7 +301,7 @@ MultilineTerm-Gen { MultilineTerm-Prefix { (e.Prefix) e.Indent t.Term (e.Suffix) - = t.Term + = : { (Brackets e.Expr) = (e.Prefix '(') @@ -445,7 +449,8 @@ ClosureBrackets { } InlineSubexpr { - t.Term e.Expr = >) e.Expr>; + t.Term e.Expr + = >) >; /* пусто */ = /* пусто */; } diff --git a/src/compiler/OptTree-AutoMarkup-Drive.ref b/src/compiler/OptTree-AutoMarkup-Drive.ref index 517df1cc..70286c1a 100644 --- a/src/compiler/OptTree-AutoMarkup-Drive.ref +++ b/src/compiler/OptTree-AutoMarkup-Drive.ref @@ -347,10 +347,13 @@ BasicVertexes { e.Graph (e.Roots) = : e.GraphHash = (e.GraphHash) (/* to drive */) (/* basic */) + (e.GraphHash)> + (/* to drive */) (/* basic */) >; } +gen_e__ { e.arg = e.arg } + MakeGraphHash { e.Graph = ; (e.OptFuncNames^ t.Call) e.Expr^ - = + = t.Call e.OptFuncs + > : (e.OptFuncs^) (e.NewFunctions) e.Branches = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo^ diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index c5a3054c..5296cd72 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -43,12 +43,15 @@ $ENTRY OptTree-Drive-Prepare { = ; (s.OptDrive s.OptIntrinsic) e.AST - = ( /* no names */) - Contractions-Enabled (/* no metatables */) /* no info */ + = ( ) + Contractions-Enabled () + : e.EmptyInfo = ; } +gen_e__ { e.arg = e.arg } + /* Функция генерирует имена остаточных прогоняемых функций */ GenRemainderFuncNames { diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 1e6983aa..a411e30c 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -581,12 +581,14 @@ SpecCall { : (e.UsedVars^) (e.NewArgument^) (e.Sg^) (e.Solutions) = ) s.NextNumber e.Signatures (e.UsedVars) + () (e.NewArgument) (e.Sg) (e.Solutions) (e.History) True >; } +gen_e__ { e.arg = e.arg } + /* Функция обобщает участки между двумя e-параметрами: … e.1 … e.2 … → … e.New …, e.1 … e.2 ← e.New @@ -816,8 +818,8 @@ SpecCall-NewSignature-Generalize { : (e.UsedVars^) (e.NewArg^) (e.Sg^) (e.Solutions^) = ) s.NextNumber e.Signatures (e.UsedVars) + () (e.NewArg) (e.Sg) (e.Solutions) (e.History) s.NeedRelationCheck >; } diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index 8e9ef475..706ee387 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -41,6 +41,7 @@ $ENTRY OptTree { = (s.OptDrive s.OptIntrinsic) : t.OptDrive = (define main (if s.OptAutoMarkup (begin @@ -88,11 +89,14 @@ $ENTRY OptTree { (call &WarmColdFunctions DRIVE) (call &OptTree-Drive-CleanupColdCalls)) (call &ExpandClosures))) + s.Cycles (e.AST) > } +gen_e__ { e.arg = e.arg } + /** == e.OptAST diff --git a/src/compiler/main.ref b/src/compiler/main.ref index 00067d24..c8ffb1da 100644 --- a/src/compiler/main.ref +++ b/src/compiler/main.ref @@ -352,9 +352,11 @@ $INLINE AddNumSuffix; AddNumSuffix { 0 e.Output = e.Output; - s.Num e.Output = e.Output '@' ; + s.Num e.Output = e.Output '@' >; } +gen_e__ { e.arg = e.arg } + FindFreeName { s.Num e.Output = : e.NewName From a145f6ce3d8a59f6c08a63ea5b61b1dd0d3addc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Thu, 19 Aug 2021 11:01:13 +0300 Subject: [PATCH 133/208] =?UTF-8?q?FIXED:=20=D1=84=D1=83=D0=BD=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20gen=5Fe=5F=5F=20=D1=82=D0=B0=D0=BA=D0=B6=D0=B5?= =?UTF-8?q?=20=D0=BD=D0=B5=20=D1=81=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7=D0=B8=D1=80=D1=83=D0=B5=D1=82=D1=81=D1=8F=20(#331,?= =?UTF-8?q?=20#332)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Проблема возникала на этапе прогонки экземпляров: на первой стадии оптимизации функция gen_e__ оберегала от взрывной прогонки, но на второй фазе получаются прогоняемые экземпляры gen_e__@n, которые уже ничего не защищают. И программа распухает на финальной стадии. --- src/compiler/OptTree-AutoMarkup-Spec.ref | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/compiler/OptTree-AutoMarkup-Spec.ref b/src/compiler/OptTree-AutoMarkup-Spec.ref index 7e7fe546..71bdef5a 100644 --- a/src/compiler/OptTree-AutoMarkup-Spec.ref +++ b/src/compiler/OptTree-AutoMarkup-Spec.ref @@ -17,6 +17,19 @@ $ENTRY OptTree-AutoMarkup-Spec { (Specs e.Specs) (Function (e.FuncName) Sentences /* пусто */) = (Specs e.Specs) (Function (e.FuncName) Sentences /* пусто */); + /* gen-функции не специализируем */ + (Specs e.Specs) + (Function + (e.FuncName) Sentences + (((Var 'e' e.Index)) /*=*/ ((Var 'e' e.Index))) + ) + , : True + = (Specs e.Specs) + (Function + (e.FuncName) Sentences + (((Var 'e' e.Index)) /*=*/ ((Var 'e' e.Index))) + ); + (Specs e.Specs) (Function (e.FuncName) Sentences e.Body) = (Specs e.Specs (e.FuncName)) (Function (e.FuncName) Sentences e.Body); @@ -30,3 +43,12 @@ $ENTRY OptTree-AutoMarkup-Spec { (Specs /* пусто */) e.AST > } + +Pseudofunction-gen_e { + 'gen_e__' = True; + 'gen-e__' = True; + 'gen_e__' SUF '~' s.N = True; + 'gen-e__' SUF '~' s.N = True; + + e._ = False; +} From fa284863bd06c2ddd5869feb7850fefc25237903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Thu, 19 Aug 2021 22:44:03 +0300 Subject: [PATCH 134/208] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B0=D0=B2?= =?UTF-8?q?=D1=82=D0=BE=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20=D0=BD=D0=B0?= =?UTF-8?q?=C2=A0=D0=BE=D1=82=D0=BD=D0=BE=D1=88=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=A5=D0=B8=D0=B3=D0=BC=D0=B0=D0=BD=D0=B0-=D0=9A=D1=80=D1=83?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=D0=BB=D0=B0=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Отношение Хигмана-Крускала теперь проверяется не только для специализации, но и для прогонки, поэтому тесты имело смысл переименовать. --- ...l-relation1.ref => opt-tree-higman-kruskal-relation1-spec.ref} | 0 ...l-relation2.ref => opt-tree-higman-kruskal-relation2-spec.ref} | 0 ...l-relation3.ref => opt-tree-higman-kruskal-relation3-spec.ref} | 0 ...l-relation4.ref => opt-tree-higman-kruskal-relation4-spec.ref} | 0 ...l-relation5.ref => opt-tree-higman-kruskal-relation5-spec.ref} | 0 ...l-relation6.ref => opt-tree-higman-kruskal-relation6-spec.ref} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename autotests/{opt-tree-spec-higman-kruskal-relation1.ref => opt-tree-higman-kruskal-relation1-spec.ref} (100%) rename autotests/{opt-tree-spec-higman-kruskal-relation2.ref => opt-tree-higman-kruskal-relation2-spec.ref} (100%) rename autotests/{opt-tree-spec-higman-kruskal-relation3.ref => opt-tree-higman-kruskal-relation3-spec.ref} (100%) rename autotests/{opt-tree-spec-higman-kruskal-relation4.ref => opt-tree-higman-kruskal-relation4-spec.ref} (100%) rename autotests/{opt-tree-spec-higman-kruskal-relation5.ref => opt-tree-higman-kruskal-relation5-spec.ref} (100%) rename autotests/{opt-tree-spec-higman-kruskal-relation6.ref => opt-tree-higman-kruskal-relation6-spec.ref} (100%) diff --git a/autotests/opt-tree-spec-higman-kruskal-relation1.ref b/autotests/opt-tree-higman-kruskal-relation1-spec.ref similarity index 100% rename from autotests/opt-tree-spec-higman-kruskal-relation1.ref rename to autotests/opt-tree-higman-kruskal-relation1-spec.ref diff --git a/autotests/opt-tree-spec-higman-kruskal-relation2.ref b/autotests/opt-tree-higman-kruskal-relation2-spec.ref similarity index 100% rename from autotests/opt-tree-spec-higman-kruskal-relation2.ref rename to autotests/opt-tree-higman-kruskal-relation2-spec.ref diff --git a/autotests/opt-tree-spec-higman-kruskal-relation3.ref b/autotests/opt-tree-higman-kruskal-relation3-spec.ref similarity index 100% rename from autotests/opt-tree-spec-higman-kruskal-relation3.ref rename to autotests/opt-tree-higman-kruskal-relation3-spec.ref diff --git a/autotests/opt-tree-spec-higman-kruskal-relation4.ref b/autotests/opt-tree-higman-kruskal-relation4-spec.ref similarity index 100% rename from autotests/opt-tree-spec-higman-kruskal-relation4.ref rename to autotests/opt-tree-higman-kruskal-relation4-spec.ref diff --git a/autotests/opt-tree-spec-higman-kruskal-relation5.ref b/autotests/opt-tree-higman-kruskal-relation5-spec.ref similarity index 100% rename from autotests/opt-tree-spec-higman-kruskal-relation5.ref rename to autotests/opt-tree-higman-kruskal-relation5-spec.ref diff --git a/autotests/opt-tree-spec-higman-kruskal-relation6.ref b/autotests/opt-tree-higman-kruskal-relation6-spec.ref similarity index 100% rename from autotests/opt-tree-spec-higman-kruskal-relation6.ref rename to autotests/opt-tree-higman-kruskal-relation6-spec.ref From fa19ca1267f8dc1378ef5f06981f5fced9c78bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 00:18:09 +0300 Subject: [PATCH 135/208] =?UTF-8?q?FIXED:=20=D0=BE=D1=82=D0=BD=D0=BE=D1=88?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=81=D1=82=D0=B0=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8=20=D0=BD=D0=B5=C2=A0=D1=83=D1=87=D0=B8=D1=82?= =?UTF-8?q?=D1=8B=D0=B2=D0=B0=D0=B5=D1=82=20=C2=AB=D0=B7=D0=B0=D0=BC=D0=BE?= =?UTF-8?q?=D1=80=D0=BE=D0=B6=D0=B5=D0=BD=D0=BD=D0=BE=D1=81=D1=82=D1=8C?= =?UTF-8?q?=C2=BB=20=D1=81=D0=BA=D0=BE=D0=B1=D0=BE=D0=BA=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ранее из-за этого проверка вложения давала отрицательный результат, если опасно похожие выражения различались замороженностью. Из-за этого иногда разворачивался лишний виток цикла. Автотест специально написан так, чтобы в старой версии программа чрезмерно распухала и тест вылетал с лимитом шагов. --- ...pt-tree-higman-kruskal-relation7-drive.ref | 53 +++++++++++++++++++ src/compiler/OptTree-StopRelation.ref | 8 ++- 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 autotests/opt-tree-higman-kruskal-relation7-drive.ref diff --git a/autotests/opt-tree-higman-kruskal-relation7-drive.ref b/autotests/opt-tree-higman-kruskal-relation7-drive.ref new file mode 100644 index 00000000..82f399cc --- /dev/null +++ b/autotests/opt-tree-higman-kruskal-relation7-drive.ref @@ -0,0 +1,53 @@ +* TREE + +$ENTRY Go { + /* empty */ + = : e.Trash + = : e.MarkedResult + = + : (a RemovedTile (Tile 'hello')) (b RemovedTile (Tile 'world')) + = /* empty */ +} + +gen_e__ { e.arg = e.arg } + +GST3 { + (e.Trash) (e.MarkedResult) + = () (); +} + +$DRIVE Mapa1, Boom; + +Mapa1 { + (Num1 s.Trash1 t.Trash2) e.Trash0 = ; + RemovedTile1 e.Trash0 = RemovedTile ; + (Tile1 e.Trash1) e.Trash0 = (Tile e.Trash1) ; + + (Num2 s.Trash1 t.Trash2) e.Trash0 = ; + RemovedTile2 e.Trash0 = RemovedTile ; + (Tile2 e.Trash1) e.Trash0 = (Tile e.Trash1) ; + + (Num3 s.Trash1 t.Trash2) e.Trash0 = ; + RemovedTile3 e.Trash0 = RemovedTile ; + (Tile3 e.Trash1) e.Trash0 = (Tile e.Trash1) ; + + (Num4 s.Trash1 t.Trash2) e.Trash0 = ; + RemovedTile4 e.Trash0 = RemovedTile ; + (Tile4 e.Trash1) e.Trash0 = (Tile e.Trash1) ; + + (Num5 s.Trash1 t.Trash2) e.Trash0 = ; + RemovedTile5 e.Trash0 = RemovedTile ; + (Tile5 e.Trash1) e.Trash0 = (Tile e.Trash1) ; + + (Num6 s.Trash1 t.Trash2) e.Trash0 = ; + RemovedTile6 e.Trash0 = RemovedTile ; + (Tile6 e.Trash1) e.Trash0 = (Tile e.Trash1) ; + + Z e.X = Z ; + + /* empty */ = /* empty */; +} + +Boom { + A = a; B = b; C = c; D = d; E = e; F = f; G = g; H = h; +} diff --git a/src/compiler/OptTree-StopRelation.ref b/src/compiler/OptTree-StopRelation.ref index 55d4572a..845420f0 100644 --- a/src/compiler/OptTree-StopRelation.ref +++ b/src/compiler/OptTree-StopRelation.ref @@ -62,7 +62,6 @@ Tokenize { (Brackets e.Inner) = ('(') (')'); (ADT-Brackets (e.Name) e.Inner) = ('[' e.Name) (']'); (CallBrackets e.Inner) = ('<') ('>'); - (ColdCallBrackets e.Inner) = ('<*') ('*>'); (ClosureBrackets e.Inner) = ('{{') ('}}'); t.Other = t.Other; @@ -94,7 +93,7 @@ CheckHKRelation { } AllBrackets { - = Brackets CallBrackets ColdCallBrackets ClosureBrackets; + = Brackets CallBrackets ClosureBrackets; } CheckHKRelation-Term { @@ -118,6 +117,11 @@ $ENTRY OptTree-CanonizeExpr { CanonizeExpr-Term { (Var s.Mode e.Index) = (Var s.Mode); + /* Не различаем замороженные и обычные скобки */ + (ColdCallBrackets e.Expr) + = : e.Expr^ + = (CallBrackets e.Expr); + (s.BracketsTag e.Expr) , : e._ s.BracketsTag e._ = : e.Expr^ From 2abbb5fab84c7cce67e83c11fc10515c2579386e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 10:22:52 +0300 Subject: [PATCH 136/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D0=B3=D0=B8=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 4 ++-- src/compiler/OptTree-Drive.ref | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index cb14cf96..0366efb9 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -109,7 +109,7 @@ GrowDriveTree { = ; (e.OptFuncNames^ t.Call) e.Expr^ - = t.Call e.OptFuncs > : (e.OptFuncs^) (e.NewFunctions) e.Branches @@ -204,7 +204,7 @@ FlatDriveTree { >; } -OptExpr-Aux { +OptOneCall { (e.UsedVars) (e.WholeVars) (e.Expr) (CallBrackets (Symbol Name e.Name) e.Args) s.Contractions-Mode t.Metatables e.OptFuncs diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index 5296cd72..aed0ae97 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -408,14 +408,16 @@ OptSentence { = : t.OptInfo^ e.Branches (e.NewFunctions) - = t.OptInfo (e.NewFunctions) - ) (e.DrivenRight)); } e.Branches - >; + > + : e.NewSentences + + = t.OptInfo (e.NewFunctions) e.NewSentences; t.Sentence t.OptInfo = t.OptInfo () t.Sentence } From 9aba583bd0182cd9174257329b2d464096e4831e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 12:37:51 +0300 Subject: [PATCH 137/208] =?UTF-8?q?FIXED:=20=D1=8D=D0=BA=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=BA=D0=B5,=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B0=D1=82=20opt-tree-spec12.ref=20(#314,?= =?UTF-8?q?=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавлено распознавание экранирования, как описано в комментарии https://github.com/bmstu-iu9/refal-5-lambda/issues/359#issuecomment-902277608 Экранирование распознаётся только в самом низу, при ветвлении. На это есть две причины: 1. Если распознавание экранирования откладывать, то «ациклическая суперкомпиляция» продолжит прогонять бесполезные ветви. Это лишние шаги и лишнее увеличение дерева (которое может достичь и лимита узлов). 2. Формально этого достаточно для прохождения теста opt-tree-spec12.ref в исходном виде, поэтому дополнительно усложнять остальной код я не стал. Экранирования между разными ветвями некритичны. --- autotests/opt-tree-spec12.ref | 24 ++++----- src/compiler/OptTree-Drive-Expr.ref | 76 +++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 17 deletions(-) diff --git a/autotests/opt-tree-spec12.ref b/autotests/opt-tree-spec12.ref index 5504aab7..588376a0 100644 --- a/autotests/opt-tree-spec12.ref +++ b/autotests/opt-tree-spec12.ref @@ -2,18 +2,18 @@ $ENTRY Go { /* empty */ - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') - = ) ()> : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') + = : ('AA') ('BB') ('CC') ('DD') = /* empty */; } diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 0366efb9..e8413092 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -8,11 +8,11 @@ $EXTERN OptTree-CanonizeExpr, OptTree-CheckExprStopRelation; $EXTERN OptTree-Drive-Intrinsic; *$FROM GenericMatch -$EXTERN Solve-Drive; +$EXTERN GenericMatch, Solve-Drive; *$FROM TreeUtils -$EXTERN ExpandClosures-Result, ApplyContractions, IsPassiveExpr, ApplyAssigns, - HashName; +$EXTERN ExpandClosures-Result, ApplyContractions, ExtractVariables-Expr, + CreateContext, IsPassiveExpr, ApplyAssigns, HashName; /** @@ -217,8 +217,10 @@ OptOneCall { > : t.Metatables^ e.SubstitutionPacks - = (s.Contractions-Mode t.Metatables e.OptFuncs) - > : e.Domain + = : e.PseudoPattern + + = : e.DrivenRight @@ -228,7 +230,71 @@ OptOneCall { } (/* new functions */) e.SubstitutionPacks + > + : (e.NewFunctions) e.Branches + + = : e.Branches^ + + = (s.Contractions-Mode t.Metatables e.OptFuncs) + (e.NewFunctions) e.Branches +} + +FilterScreenedBranches { + (e.PatTemplate) e.Branches + = : e.Pattern + = ((e.Pattern) (e.UsedVars) (e.Result)); + } + e.Branches + > + : e.PseudoSentenences + + = : e.PseudoSentenences^ + + = : e.Contractions + = ((e.UsedVars) e.Contractions (e.Result)); + } + e.PseudoSentenences + > +} + +DoFilterScreenedBranches { + ((e.FirstPattern) (e.FirstUsedVars) (e.FirstResult)) e.PseudoSentenences + = ((e.FirstPattern) (e.FirstUsedVars) (e.FirstResult)) + : Clear e._ + = /* ветвь экранируется, стираем */; + + ((e.Pattern) (e.UsedVars) (e.Result)) + = ((e.Pattern) (e.UsedVars) (e.Result)); + } + e.PseudoSentenences + > >; + + /* пусто */ = /* пусто */; +} + +RestoreContractions { + (e.Pattern) (e.PatTemplate) + = : Clear e.Assigns + = } eDRIVEN { From 01124a98df7fafd0d66e13e580e312ebadedbb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 16:19:37 +0300 Subject: [PATCH 138/208] =?UTF-8?q?FIXED:=20=D1=80=D0=B0=D1=81=D0=BA=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D0=BA=D0=B0=20=D0=9F=D1=80=D0=BE=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=A0=D0=B5=D1=84=D0=B0=D0=BB=D0=B0=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20Far=20Manager=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5?= =?UTF-8?q?=D1=80=D0=B6=D0=B8=D0=B2=D0=B0=D0=B5=D1=82=20$INTRINSIC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editors/far/simple-refal.hrc | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/far/simple-refal.hrc b/editors/far/simple-refal.hrc index b0a6639d..42efc05a 100644 --- a/editors/far/simple-refal.hrc +++ b/editors/far/simple-refal.hrc @@ -84,6 +84,7 @@ + From 52c1847d66cdecbe206b27a20203bd11e46b8e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 16:21:34 +0300 Subject: [PATCH 139/208] =?UTF-8?q?Revert=20"FIXED:=20=D1=80=D0=B0=D1=81?= =?UTF-8?q?=D0=BA=D1=80=D0=B0=D1=81=D0=BA=D0=B0=20=D0=9F=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D0=B3=D0=BE=20=D0=A0=D0=B5=D1=84=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20Far=20Manager=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=B4=D0=B5=D1=80=D0=B6=D0=B8=D0=B2=D0=B0=D0=B5=D1=82=20$INTRI?= =?UTF-8?q?NSIC"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 01124a98df7fafd0d66e13e580e312ebadedbb1b. --- editors/far/simple-refal.hrc | 1 - 1 file changed, 1 deletion(-) diff --git a/editors/far/simple-refal.hrc b/editors/far/simple-refal.hrc index 42efc05a..b0a6639d 100644 --- a/editors/far/simple-refal.hrc +++ b/editors/far/simple-refal.hrc @@ -84,7 +84,6 @@ - From e276d7c0bf46a18857836714241c695872183405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 16:23:29 +0300 Subject: [PATCH 140/208] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D0=BE?= =?UTF-8?q?=D0=B4=20opt-pattern5.sref=20=D0=BD=D0=B0=C2=A0=D0=A0=D0=B5?= =?UTF-8?q?=D1=84=D0=B0=D0=BB-5=CE=BB:=201=C2=A0=E2=80=94=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/{opt-pattern5.sref => opt-pattern5.ref} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename autotests/{opt-pattern5.sref => opt-pattern5.ref} (100%) diff --git a/autotests/opt-pattern5.sref b/autotests/opt-pattern5.ref similarity index 100% rename from autotests/opt-pattern5.sref rename to autotests/opt-pattern5.ref From 3bb99d13e092a1418807055dd593d178bab0376a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 16:47:16 +0300 Subject: [PATCH 141/208] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D0=BE?= =?UTF-8?q?=D0=B4=20opt-pattern5.sref=20=D0=BD=D0=B0=C2=A0=D0=A0=D0=B5?= =?UTF-8?q?=D1=84=D0=B0=D0=BB-5=CE=BB:=202=C2=A0=E2=80=94=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=B8?= =?UTF-8?q?=D0=BD=D1=82=D0=B0=D0=BA=D1=81=D0=B8=D1=81=D0=B0=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/opt-pattern5.ref | 273 ++++++++++++++++++------------------- 1 file changed, 136 insertions(+), 137 deletions(-) diff --git a/autotests/opt-pattern5.ref b/autotests/opt-pattern5.ref index 9582fdb4..51207492 100644 --- a/autotests/opt-pattern5.ref +++ b/autotests/opt-pattern5.ref @@ -1,4 +1,3 @@ -//FROM refalrts /* TREE */ $ENTRY Go { @@ -8,51 +7,51 @@ $ENTRY Go { (0 ) (0 ) (0 ) - (#LABEL 1 ) - (#CmdVar #AlgLeft 2 't' 5 ) - (#CmdVariableDebugTable 't.Config#1' 5 ) - (#CmdVariableDebugTable 'e.Message#1' 2 ) - (#CmdCreateElem #Allocate 7 #ElName 'Prout' ) - (#CmdCreateElem #Allocate 8 #ElString 'LINK ERROR: ' ) - (#CmdCreateElem #Allocate 12 #ElName 'CreateErrorFileMark' ) - (#CmdCreateElem #Allocate 15 #ElName 'Exit' ) - (#CmdCreateElem #Allocate 16 #ElNumber 1 ) - (#CmdInsertRange 8 ) - (#LABEL 141 ) - (#CmdCallSave #AlgLeft 0 2 ) - (#CmdChar #AlgRight 2 'l' ) - (#CmdChar #AlgRight 2 's' ) - (#CmdChar #AlgRight 2 'a' ) - (#CmdChar #AlgRight 2 'r' ) - (#CmdChar #AlgRight 2 '.' ) - (#CmdVariableDebugTable 'e.FileName#1' 2 ) - (#CmdCreateElem #Allocate 6 #ElName 'Lower' ) - (#CmdCreateElem #Allocate 8 #ElName 'GetLastPartName' ) - (#LABEL 142 ) - (#CmdCallSave #AlgLeft 0 2 ) - (#CmdVariableDebugTable 'e.FileName#1' 2 ) - (#CmdCreateElem #Allocate 6 #ElName 'DoGetFileName' ) - (#LABEL 146 ) - (#CmdCallSave #AlgLeft 0 2 ) - (#CmdOnFailGoTo 145 "Func name:" 'DoGetFileName' ) - (#CmdSave 2 5 ) - (#CmdVar #AlgRight 5 's' 7 ) - (#CmdOnFailGoTo 143 "Func name:" 'DoGetFileName' ) - (#CmdChar #AlgTerm 7 '/' ) - (#CmdVariableDebugTable 'e.FileName#1' 5 ) - (#LABEL 143 ) - (#CmdProfilerStopSentence ) - (#CmdOnFailGoTo 144 "Func name:" 'DoGetFileName' ) - (#CmdChar #AlgTerm 7 '\\' ) - (#CmdVariableDebugTable 'e.FileName#1' 5 ) - (#LABEL 144 ) - (#CmdProfilerStopSentence ) - (#CmdVariableDebugTable 's.Last#1' 7 ) - (#CmdVariableDebugTable 'e.FileName#1' 5 ) - (#CmdCreateElem #Allocate 9 #ElName 'DoGetFileName' ) - (#LABEL 145 ) - (#CmdProfilerStopSentence ) - (#CmdEmpty #AlgLeft 2 ) + (LABEL 1 ) + (CmdVar AlgLeft 2 't' 5 ) + (CmdVariableDebugTable 't.Config#1' 5 ) + (CmdVariableDebugTable 'e.Message#1' 2 ) + (CmdCreateElem Allocate 7 ElName 'Prout' ) + (CmdCreateElem Allocate 8 ElString 'LINK ERROR: ' ) + (CmdCreateElem Allocate 12 ElName 'CreateErrorFileMark' ) + (CmdCreateElem Allocate 15 ElName 'Exit' ) + (CmdCreateElem Allocate 16 ElNumber 1 ) + (CmdInsertRange 8 ) + (LABEL 141 ) + (CmdCallSave AlgLeft 0 2 ) + (CmdChar AlgRight 2 'l' ) + (CmdChar AlgRight 2 's' ) + (CmdChar AlgRight 2 'a' ) + (CmdChar AlgRight 2 'r' ) + (CmdChar AlgRight 2 '.' ) + (CmdVariableDebugTable 'e.FileName#1' 2 ) + (CmdCreateElem Allocate 6 ElName 'Lower' ) + (CmdCreateElem Allocate 8 ElName 'GetLastPartName' ) + (LABEL 142 ) + (CmdCallSave AlgLeft 0 2 ) + (CmdVariableDebugTable 'e.FileName#1' 2 ) + (CmdCreateElem Allocate 6 ElName 'DoGetFileName' ) + (LABEL 146 ) + (CmdCallSave AlgLeft 0 2 ) + (CmdOnFailGoTo 145 "Func name:" 'DoGetFileName' ) + (CmdSave 2 5 ) + (CmdVar AlgRight 5 's' 7 ) + (CmdOnFailGoTo 143 "Func name:" 'DoGetFileName' ) + (CmdChar AlgTerm 7 '/' ) + (CmdVariableDebugTable 'e.FileName#1' 5 ) + (LABEL 143 ) + (CmdProfilerStopSentence ) + (CmdOnFailGoTo 144 "Func name:" 'DoGetFileName' ) + (CmdChar AlgTerm 7 '\\' ) + (CmdVariableDebugTable 'e.FileName#1' 5 ) + (LABEL 144 ) + (CmdProfilerStopSentence ) + (CmdVariableDebugTable 's.Last#1' 7 ) + (CmdVariableDebugTable 'e.FileName#1' 5 ) + (CmdCreateElem Allocate 9 ElName 'DoGetFileName' ) + (LABEL 145 ) + (CmdProfilerStopSentence ) + (CmdEmpty AlgLeft 2 ) > >; @@ -61,7 +60,7 @@ $ENTRY Go { gen_e__ { e.arg = e.arg; } RESULT { - (#CmdFuncArray 6 + (CmdFuncArray 6 ('DoGetFileName' ) ('GetLastPartName' ) ('Lower' ) @@ -69,60 +68,60 @@ RESULT { ('CreateErrorFileMark' ) ('Prout' ) ) - (#CmdIdentArray 0 + (CmdIdentArray 0 ) - (#CmdStringArray 5 + (CmdStringArray 5 ('e.FileName#1' ) ('s.Last#1' ) ('LINK ERROR: ' ) ('e.Message#1' ) ('t.Config#1' ) ) - (#LABEL 1 ) - (#CmdVar #AlgLeft 2 't' 5 ) - (#CmdVariableDebugTable 4 5 ) - (#CmdVariableDebugTable 3 2 ) - (#CmdCreateElem #Allocate 7 #ElName 5 ) - (#CmdCreateElem #Allocate 8 #ElString 2 ) - (#CmdCreateElem #Allocate 12 #ElName 4 ) - (#CmdCreateElem #Allocate 15 #ElName 3 ) - (#CmdCreateElem #Allocate 16 #ElNumber 1 ) - (#CmdInsertRange 8 ) - (#LABEL 141 ) - (#CmdCallSave #AlgLeft 0 2 ) - (#CmdChar #AlgRight 2 'l' ) - (#CmdChar #AlgRight 2 's' ) - (#CmdChar #AlgRight 2 'a' ) - (#CmdChar #AlgRight 2 'r' ) - (#CmdChar #AlgRight 2 '.' ) - (#CmdVariableDebugTable 0 2 ) - (#CmdCreateElem #Allocate 6 #ElName 2 ) - (#CmdCreateElem #Allocate 8 #ElName 1 ) - (#LABEL 142 ) - (#CmdCallSave #AlgLeft 0 2 ) - (#CmdVariableDebugTable 0 2 ) - (#CmdCreateElem #Allocate 6 #ElName 0 ) - (#LABEL 146 ) - (#CmdCallSave #AlgLeft 0 2 ) - (#CmdOnFailGoTo 145 "Func name:" 'DoGetFileName' ) - (#CmdSave 2 5 ) - (#CmdVar #AlgRight 5 's' 7 ) - (#CmdOnFailGoTo 143 "Func name:" 'DoGetFileName' ) - (#CmdChar #AlgTerm 7 '/' ) - (#CmdVariableDebugTable 0 5 ) - (#LABEL 143 ) - (#CmdProfilerStopSentence ) - (#CmdOnFailGoTo 144 "Func name:" 'DoGetFileName' ) - (#CmdChar #AlgTerm 7 '\\' ) - (#CmdVariableDebugTable 0 5 ) - (#LABEL 144 ) - (#CmdProfilerStopSentence ) - (#CmdVariableDebugTable 1 7 ) - (#CmdVariableDebugTable 0 5 ) - (#CmdCreateElem #Allocate 9 #ElName 0 ) - (#LABEL 145 ) - (#CmdProfilerStopSentence ) - (#CmdEmpty #AlgLeft 2 ) + (LABEL 1 ) + (CmdVar AlgLeft 2 't' 5 ) + (CmdVariableDebugTable 4 5 ) + (CmdVariableDebugTable 3 2 ) + (CmdCreateElem Allocate 7 ElName 5 ) + (CmdCreateElem Allocate 8 ElString 2 ) + (CmdCreateElem Allocate 12 ElName 4 ) + (CmdCreateElem Allocate 15 ElName 3 ) + (CmdCreateElem Allocate 16 ElNumber 1 ) + (CmdInsertRange 8 ) + (LABEL 141 ) + (CmdCallSave AlgLeft 0 2 ) + (CmdChar AlgRight 2 'l' ) + (CmdChar AlgRight 2 's' ) + (CmdChar AlgRight 2 'a' ) + (CmdChar AlgRight 2 'r' ) + (CmdChar AlgRight 2 '.' ) + (CmdVariableDebugTable 0 2 ) + (CmdCreateElem Allocate 6 ElName 2 ) + (CmdCreateElem Allocate 8 ElName 1 ) + (LABEL 142 ) + (CmdCallSave AlgLeft 0 2 ) + (CmdVariableDebugTable 0 2 ) + (CmdCreateElem Allocate 6 ElName 0 ) + (LABEL 146 ) + (CmdCallSave AlgLeft 0 2 ) + (CmdOnFailGoTo 145 "Func name:" 'DoGetFileName' ) + (CmdSave 2 5 ) + (CmdVar AlgRight 5 's' 7 ) + (CmdOnFailGoTo 143 "Func name:" 'DoGetFileName' ) + (CmdChar AlgTerm 7 '/' ) + (CmdVariableDebugTable 0 5 ) + (LABEL 143 ) + (CmdProfilerStopSentence ) + (CmdOnFailGoTo 144 "Func name:" 'DoGetFileName' ) + (CmdChar AlgTerm 7 '\\' ) + (CmdVariableDebugTable 0 5 ) + (LABEL 144 ) + (CmdProfilerStopSentence ) + (CmdVariableDebugTable 1 7 ) + (CmdVariableDebugTable 0 5 ) + (CmdCreateElem Allocate 9 ElName 0 ) + (LABEL 145 ) + (CmdProfilerStopSentence ) + (CmdEmpty AlgLeft 2 ) = ; } @@ -142,220 +141,220 @@ OutlineConstants { (s.NextIdent e.Idents) (s.NextString e.Strings) /* пусто */ = - (#CmdFuncArray s.NextFunc ) - (#CmdIdentArray s.NextIdent ) - (#CmdStringArray s.NextString ); + (CmdFuncArray s.NextFunc ) + (CmdIdentArray s.NextIdent ) + (CmdStringArray s.NextString ); (s.NextFunc e.Funcs-B (s.Num e.Func) e.Funcs-E) (e.Idents) (e.Strings) e.Commands - (#CmdName s.Direction s.BracketNum e.Func) = + (CmdName s.Direction s.BracketNum e.Func) = - (#CmdName s.Direction s.BracketNum s.Num); + (CmdName s.Direction s.BracketNum s.Num); (s.NextFunc e.Funcs) (e.Idents) (e.Strings) e.Commands - (#CmdName s.Direction s.BracketNum e.Func) = + (CmdName s.Direction s.BracketNum e.Func) = e.Funcs (s.NextFunc e.Func)) (e.Idents) (e.Strings) e.Commands > - (#CmdName s.Direction s.BracketNum s.NextFunc); + (CmdName s.Direction s.BracketNum s.NextFunc); (s.NextFunc e.Funcs-B (s.Num e.Func) e.Funcs-E) (e.Idents) (e.Strings) e.Commands - (#CmdNameSave s.Direction s.BracketNum s.SaveOffset e.Func) = + (CmdNameSave s.Direction s.BracketNum s.SaveOffset e.Func) = - (#CmdNameSave s.Direction s.BracketNum s.SaveOffset s.Num); + (CmdNameSave s.Direction s.BracketNum s.SaveOffset s.Num); (s.NextFunc e.Funcs) (e.Idents) (e.Strings) e.Commands - (#CmdNameSave s.Direction s.BracketNum s.SaveOffset e.Func) = + (CmdNameSave s.Direction s.BracketNum s.SaveOffset e.Func) = e.Funcs (s.NextFunc e.Func)) (e.Idents) (e.Strings) e.Commands > - (#CmdNameSave s.Direction s.BracketNum s.SaveOffset s.NextFunc); + (CmdNameSave s.Direction s.BracketNum s.SaveOffset s.NextFunc); (s.NextFunc e.Funcs-B (s.Num e.Func) e.Funcs-E) (e.Idents) (e.Strings) e.Commands - (#CmdCreateElem s.CreateMode s.ElemNo #ElName e.Func) = + (CmdCreateElem s.CreateMode s.ElemNo ElName e.Func) = - (#CmdCreateElem s.CreateMode s.ElemNo #ElName s.Num); + (CmdCreateElem s.CreateMode s.ElemNo ElName s.Num); (s.NextFunc e.Funcs) (e.Idents) (e.Strings) e.Commands - (#CmdCreateElem s.CreateMode s.ElemNo #ElName e.Func) = + (CmdCreateElem s.CreateMode s.ElemNo ElName e.Func) = e.Funcs (s.NextFunc e.Func)) (e.Idents) (e.Strings) e.Commands > - (#CmdCreateElem s.CreateMode s.ElemNo #ElName s.NextFunc); + (CmdCreateElem s.CreateMode s.ElemNo ElName s.NextFunc); (s.NextFunc e.Funcs-B (s.Num e.Func) e.Funcs-E) (e.Idents) (e.Strings) e.Commands - (#CmdADT s.Direction s.BracketNum s.InnerBrackets e.Func) = + (CmdADT s.Direction s.BracketNum s.InnerBrackets e.Func) = - (#CmdADT s.Direction s.BracketNum s.InnerBrackets s.Num); + (CmdADT s.Direction s.BracketNum s.InnerBrackets s.Num); (s.NextFunc e.Funcs) (e.Idents) (e.Strings) e.Commands - (#CmdADT s.Direction s.BracketNum s.InnerBrackets e.Func) = + (CmdADT s.Direction s.BracketNum s.InnerBrackets e.Func) = e.Funcs (s.NextFunc e.Func)) (e.Idents) (e.Strings) e.Commands > - (#CmdADT s.Direction s.BracketNum s.InnerBrackets s.NextFunc); + (CmdADT s.Direction s.BracketNum s.InnerBrackets s.NextFunc); (s.NextFunc e.Funcs-B (s.Num e.Func) e.Funcs-E) (e.Idents) (e.Strings) e.Commands - (#CmdADTSave s.Direction s.BracketNum s.InnerBrackets e.Func) = + (CmdADTSave s.Direction s.BracketNum s.InnerBrackets e.Func) = - (#CmdADTSave s.Direction s.BracketNum s.InnerBrackets s.Num); + (CmdADTSave s.Direction s.BracketNum s.InnerBrackets s.Num); (s.NextFunc e.Funcs) (e.Idents) (e.Strings) e.Commands - (#CmdADTSave s.Direction s.BracketNum s.InnerBrackets e.Func) = + (CmdADTSave s.Direction s.BracketNum s.InnerBrackets e.Func) = e.Funcs (s.NextFunc e.Func)) (e.Idents) (e.Strings) e.Commands > - (#CmdADTSave s.Direction s.BracketNum s.InnerBrackets s.NextFunc); + (CmdADTSave s.Direction s.BracketNum s.InnerBrackets s.NextFunc); (e.Funcs) (s.NextIdent e.Idents-B (s.Num e.Ident) e.Idents-E) (e.Strings) e.Commands - (#CmdIdent s.Direction s.BracketNum e.Ident) = + (CmdIdent s.Direction s.BracketNum e.Ident) = - (#CmdIdent s.Direction s.BracketNum s.Num); + (CmdIdent s.Direction s.BracketNum s.Num); (e.Funcs) (s.NextIdent e.Idents) (e.Strings) e.Commands - (#CmdIdent s.Direction s.BracketNum e.Ident) = + (CmdIdent s.Direction s.BracketNum e.Ident) = e.Idents (s.NextIdent e.Ident)) (e.Strings) e.Commands > - (#CmdIdent s.Direction s.BracketNum s.NextIdent); + (CmdIdent s.Direction s.BracketNum s.NextIdent); (e.Funcs) (s.NextIdent e.Idents-B (s.Num e.Ident) e.Idents-E) (e.Strings) e.Commands - (#CmdIdentSave s.Direction s.BracketNum s.SaveOffset e.Ident) = + (CmdIdentSave s.Direction s.BracketNum s.SaveOffset e.Ident) = - (#CmdIdentSave s.Direction s.BracketNum s.SaveOffset s.Num); + (CmdIdentSave s.Direction s.BracketNum s.SaveOffset s.Num); (e.Funcs) (s.NextIdent e.Idents) (e.Strings) e.Commands - (#CmdIdentSave s.Direction s.BracketNum s.SaveOffset e.Ident) = + (CmdIdentSave s.Direction s.BracketNum s.SaveOffset e.Ident) = e.Idents (s.NextIdent e.Ident)) (e.Strings) e.Commands > - (#CmdIdentSave s.Direction s.BracketNum s.SaveOffset s.NextIdent); + (CmdIdentSave s.Direction s.BracketNum s.SaveOffset s.NextIdent); (e.Funcs) (s.NextIdent e.Idents-B (s.Num e.Ident) e.Idents-E) (e.Strings) e.Commands - (#CmdCreateElem s.CreateMode s.ElemNo #ElIdent e.Ident) = + (CmdCreateElem s.CreateMode s.ElemNo ElIdent e.Ident) = - (#CmdCreateElem s.CreateMode s.ElemNo #ElIdent s.Num); + (CmdCreateElem s.CreateMode s.ElemNo ElIdent s.Num); (e.Funcs) (s.NextIdent e.Idents) (e.Strings) e.Commands - (#CmdCreateElem s.CreateMode s.ElemNo #ElIdent e.Ident) = + (CmdCreateElem s.CreateMode s.ElemNo ElIdent e.Ident) = e.Idents (s.NextIdent e.Ident)) (e.Strings) e.Commands > - (#CmdCreateElem s.CreateMode s.ElemNo #ElIdent s.NextIdent); + (CmdCreateElem s.CreateMode s.ElemNo ElIdent s.NextIdent); (e.Funcs) (e.Idents) (s.NextStringId e.Strings-B (s.Id e.String) e.Strings-E) e.Commands - (#CmdCreateElem s.CreateMode s.ElemNo #ElString e.String) = + (CmdCreateElem s.CreateMode s.ElemNo ElString e.String) = - (#CmdCreateElem s.CreateMode s.ElemNo #ElString s.Id); + (CmdCreateElem s.CreateMode s.ElemNo ElString s.Id); (e.Funcs) (e.Idents) (s.NextStringId e.Strings) e.Commands - (#CmdCreateElem s.CreateMode s.ElemNo #ElString e.String) = + (CmdCreateElem s.CreateMode s.ElemNo ElString e.String) = e.Strings (s.NextStringId e.String)) e.Commands > - (#CmdCreateElem s.CreateMode s.ElemNo #ElString s.NextStringId); + (CmdCreateElem s.CreateMode s.ElemNo ElString s.NextStringId); (e.Funcs) (e.Idents) (s.NextStringId e.Strings-B (s.Id e.VarName) e.Strings-E) e.Commands - (#CmdVariableDebugTable e.VarName s.Offset) = + (CmdVariableDebugTable e.VarName s.Offset) = - (#CmdVariableDebugTable s.Id s.Offset); + (CmdVariableDebugTable s.Id s.Offset); (e.Funcs) (e.Idents) (s.NextStringId e.Strings) e.Commands - (#CmdVariableDebugTable e.VarName s.Offset) = + (CmdVariableDebugTable e.VarName s.Offset) = e.Strings (s.NextStringId e.VarName)) e.Commands > - (#CmdVariableDebugTable s.NextStringId s.Offset); + (CmdVariableDebugTable s.NextStringId s.Offset); (e.Funcs) (e.Idents) (e.Strings) e.Commands From 178a016c8205f43a6b10e0475e5b7d3051e92d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 16:50:03 +0300 Subject: [PATCH 142/208] =?UTF-8?q?FIXED:=20=D1=80=D0=B0=D1=81=D0=BF=D1=83?= =?UTF-8?q?=D1=85=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=B2=C2=A0=D0=B0=D0=B2=D1=82=D0=BE=D1=82=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B5=20opt-pattern5.ref=20(#332,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Распухание происходило из-за прогонки функции Inc. Решение: заменить это определение функции на пометку $INTRINSIC. Но Простой Рефал не поддерживает ключевое слово $INTRINSIC, поэтому автотест пришлось сначала перевести на Рефал-5λ двумя предыдущими коммитами. --- autotests/opt-pattern5.SATELITE.ref | 4 ++++ autotests/opt-pattern5.ref | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 autotests/opt-pattern5.SATELITE.ref diff --git a/autotests/opt-pattern5.SATELITE.ref b/autotests/opt-pattern5.SATELITE.ref new file mode 100644 index 00000000..d51e48b3 --- /dev/null +++ b/autotests/opt-pattern5.SATELITE.ref @@ -0,0 +1,4 @@ +$ENTRY Inc { + 0 = 1; 1 = 2; 2 = 3; 3 = 4; 4 = 5; + 5 = 6; 6 = 7; 7 = 8; 8 = 9; 9 = 0; +} diff --git a/autotests/opt-pattern5.ref b/autotests/opt-pattern5.ref index 51207492..b7548b02 100644 --- a/autotests/opt-pattern5.ref +++ b/autotests/opt-pattern5.ref @@ -126,10 +126,8 @@ RESULT { } -Inc { - 0 = 1; 1 = 2; 2 = 3; 3 = 4; 4 = 5; - 5 = 6; 6 = 7; 7 = 8; 8 = 9; 9 = 0; -} +$EXTERN Inc; +$INTRINSIC Inc; Map-RemoveNumber { (s.Number e.Name) e.Rest = (e.Name) ; From 1482882d25896de4bdafe540721c1d1e77d9cd12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 20:07:40 +0300 Subject: [PATCH 143/208] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=B0=D1=8F=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20Solve-SymmClashes=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Коммит вводит «таксономию» для симметричных клэшей аналогично коммиту 629f85b8c. --- src/compiler/GenericMatch.ref | 161 ++++++++++++++++++---------------- 1 file changed, 83 insertions(+), 78 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 0fd2aa62..c2f8ac98 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -421,7 +421,8 @@ DoAddCoordinateLabels { */ SimplifyCoordinates-SymmClash { - (e.L '=' e.R) = ( '=' ) + (s.Type e.L '=' e.R) + = (s.Type '=' ) } SimplifyCoordinates { @@ -1240,7 +1241,7 @@ SplitSolve { == (t.Assign*) (t.SymmClash*) - t.SymmClash ::= (e.L '=' e.R) + t.SymmClash ::= (s.ClashType e.L '=' e.R) */ CreateSymmClashes { @@ -1311,7 +1312,7 @@ CreateSymmClashesFromGroup { () >; @@ -1324,7 +1325,7 @@ CreateSymmClashesFromGroup-Aux { = ; t.CurrentAssign () (e.SymmClashes) @@ -1410,7 +1411,7 @@ LastCoordinate { */ IsTautology { - (e.L '=' e.R) + (s._ e.L '=' e.R) = : e.LWithoutCoords = : e.RWithoutCoords = @@ -1458,7 +1459,7 @@ MinMode { Solve-SymmClashes-Aux { /* {a} u.X {b} = {c} v.Y {d} ↦ u.X → w.NEW, v.Y → w.NEW, w = min(u,v) */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.uX ('{'s.B'}') '=' ('{'s.C'}') t.vY ('{'s.D'}')) + (s._ ('{'s.A'}') t.uX ('{'s.B'}') '=' ('{'s.C'}') t.vY ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.uX : (Var s.uMode e.XIndex) , t.vY : (Var s.vMode e.YIndex) @@ -1477,57 +1478,61 @@ Solve-SymmClashes-Aux { /* {a} #var E1 {b} = {c} #var E2 {d} ↦ {a} E1 {b} = {c} E2 {d} */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Var e.E1 ('{'s.B'}') '=' ('{'s.C'}') t.Var e.E2 ('{'s.D'}')) + (s.Type + ('{'s.A'}') t.Var e.E1 ('{'s.B'}') '=' ('{'s.C'}') t.Var e.E2 ('{'s.D'}') + ) e.ClashesEnd (e.Assigns) , t.Var : (ScrVar e.Var) = e.ClashesEnd (e.Assigns) >; /* {a} E1 #var {b} = {c} E2 #var {d} ↦ {a} E1 {b} = {c} E2 {d} */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') e.E1 t.Var ('{'s.B'}') '=' ('{'s.C'}') e.E2 t.Var ('{'s.D'}')) + (s.Type + ('{'s.A'}') e.E1 t.Var ('{'s.B'}') '=' ('{'s.C'}') e.E2 t.Var ('{'s.D'}') + ) e.ClashesEnd (e.Assigns) , t.Var : (ScrVar e.Var) = e.ClashesEnd (e.Assigns) >; /* {a} #var E1 {b} = {c} E2 {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') (ScrVar e._) e.E1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 ('{'s.D'}')) + (s._ ('{'s.A'}') (ScrVar e._) e.E1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 ('{'s.D'}')) e.ClashesEnd (e.Assigns) = /* решений нет */; /* {a} E1 {b} = {c} #var E2 {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') e.E1 ('{'s.B'}') '=' ('{'s.C'}') (ScrVar e._) e.E2 ('{'s.D'}')) + (s._ ('{'s.A'}') e.E1 ('{'s.B'}') '=' ('{'s.C'}') (ScrVar e._) e.E2 ('{'s.D'}')) e.ClashesEnd (e.Assigns) = /* решений нет */; /* {a} E1 #var {b} = {c} E2 {d} ↦ решений нет*/ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') e.E1 (ScrVar e._) ('{'s.B'}') '=' ('{'s.C'}') e.E2 ('{'s.D'}')) + (s._ ('{'s.A'}') e.E1 (ScrVar e._) ('{'s.B'}') '=' ('{'s.C'}') e.E2 ('{'s.D'}')) e.ClashesEnd (e.Assigns) = /* решений нет */; /* {a} E1 {b} = {c} E2 #var2 {d} ↦ решений нет*/ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') e.E1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 (ScrVar e._) ('{'s.D'}')) + (s._ ('{'s.A'}') e.E1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 (ScrVar e._) ('{'s.D'}')) e.ClashesEnd (e.Assigns) = /* решений нет */; /* ε = {m} e.X E {n} ↦ e.X → ε, ε = {m} E {n} */ (e.UsedVars) (e.Contrs) e.ClashesStart - (/* пусто */ '=' ('{'s.M'}') t.eX e.E ('{'s.N'}')) + (E /* пусто */ '=' ('{'s.M'}') t.eX e.E ('{'s.N'}')) e.ClashesEnd (e.Assigns) , t.eX : (Var 'e' e.XIndex) = >; /* {m} e.X E {n} = ε ↦ e.X → ε, {m} E {n} = ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.M'}') t.eX e.E ('{'s.N'}') '=' /* пусто */) + (E ('{'s.M'}') t.eX e.E ('{'s.N'}') '=' /* пусто */) e.ClashesEnd (e.Assigns) , t.eX : (Var 'e' e.XIndex) = : True = /* решений нет */; /* {m} T E {n} = ε ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.M'}') t.T e.E ('{'s.N'}') '=' /* пусто */) + (E ('{'s.M'}') t.T e.E ('{'s.N'}') '=' /* пусто */) e.ClashesEnd (e.Assigns) , : True = /* решений нет */; /* {a} t.X {b} = {c} {{ &F e.X }} {d} ↦ обобщаем {c−d} */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.tX ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) + (T ('{'s.A'}') t.tX ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.tX : (Var 't' e._) , t.Closure : (ClosureBrackets e._) @@ -1579,7 +1584,7 @@ Solve-SymmClashes-Aux { /* {c} {{ &F e.X }} {d} = {a} t.X {b} ↦ обобщаем {c−d} */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.tX ('{'s.B'}')) + (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.tX ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.tX : (Var 't' e._) , t.Closure : (ClosureBrackets e._) @@ -1587,7 +1592,7 @@ Solve-SymmClashes-Aux { /* {a} s.X {b} = {c} {{ &F e.X }} {d} ↦ обобщаем {c−d} */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.sX ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) + (T ('{'s.A'}') t.sX ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.sX : (Var 's' e._) , t.Closure : (ClosureBrackets e._) @@ -1595,7 +1600,7 @@ Solve-SymmClashes-Aux { /* {c} {{ &F e.X }} {d} = {a} s.X {b} ↦ обобщаем {c−d} */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.sX ('{'s.B'}')) + (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.sX ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.sX : (Var 's' e._) , t.Closure : (ClosureBrackets e._) @@ -1603,7 +1608,7 @@ Solve-SymmClashes-Aux { /* {a} X {b} = {c} {{ &F e.X }} {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.X ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) + (T ('{'s.A'}') t.X ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.X : (Symbol e._) , t.Closure : (ClosureBrackets e._) @@ -1611,7 +1616,7 @@ Solve-SymmClashes-Aux { /* {c} {{ &F e.X }} {d} = {a} X {b} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.X ('{'s.B'}')) + (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.X ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.X : (Symbol e._) , t.Closure : (ClosureBrackets e._) @@ -1619,7 +1624,7 @@ Solve-SymmClashes-Aux { /* {a} (E) {b} = {c} {{ &F e.X }} {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.BrE ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) + (T ('{'s.A'}') t.BrE ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.BrE : (Brackets e._) , t.Closure : (ClosureBrackets e._) @@ -1627,7 +1632,7 @@ Solve-SymmClashes-Aux { /* {c} {{ &F e.X }} {d} = {a} (E) {b} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.BrE ('{'s.B'}')) + (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.BrE ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.BrE : (Brackets e._) , t.Closure : (ClosureBrackets e._) @@ -1635,7 +1640,7 @@ Solve-SymmClashes-Aux { /* {a} [X E] {b} = {c} {{ &F e.X }} {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.BrE ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) + (T ('{'s.A'}') t.BrE ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.BrE : (ADT-Brackets e._) , t.Closure : (ClosureBrackets e._) @@ -1643,7 +1648,7 @@ Solve-SymmClashes-Aux { /* {c} {{ &F e.X }} {d} = {a} [X E] {b} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.BrE ('{'s.B'}')) + (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.BrE ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.BrE : (ADT-Brackets e._) , t.Closure : (ClosureBrackets e._) @@ -1651,7 +1656,7 @@ Solve-SymmClashes-Aux { /* {a} [X E1] {b} = {c} (E2) {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Br1 ('{'s.B'}') '=' ('{'s.C'}') t.Br2 ('{'s.D'}')) + (T ('{'s.A'}') t.Br1 ('{'s.B'}') '=' ('{'s.C'}') t.Br2 ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.Br1 : (ADT-Brackets e._) , t.Br2 : (Brackets e._) @@ -1659,7 +1664,7 @@ Solve-SymmClashes-Aux { /* {c} (E2) {d} = {a} [X E1] {b} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.Br2 ('{'s.D'}') '=' ('{'s.A'}') t.Br1 ('{'s.B'}')) + (T ('{'s.C'}') t.Br2 ('{'s.D'}') '=' ('{'s.A'}') t.Br1 ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.Br1 : (ADT-Brackets e._) , t.Br2 : (Brackets e._) @@ -1667,7 +1672,7 @@ Solve-SymmClashes-Aux { /* {a} t.X {b} = {c} X {d} ↦ t.X → X */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.tX ('{'s.B'}') '=' ('{'s.C'}') t.X ('{'s.D'}')) + (T ('{'s.A'}') t.tX ('{'s.B'}') '=' ('{'s.C'}') t.X ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.tX : (Var 't' e.XIndex) , t.X : (Symbol e._) @@ -1683,7 +1688,7 @@ Solve-SymmClashes-Aux { /* {c} X {d} = {a} t.X {b} ↦ t.X → X */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.X ('{'s.D'}') '=' ('{'s.A'}') t.tX ('{'s.B'}')) + (T ('{'s.C'}') t.X ('{'s.D'}') '=' ('{'s.A'}') t.tX ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.tX : (Var 't' e.XIndex) , t.X : (Symbol e._) @@ -1699,7 +1704,7 @@ Solve-SymmClashes-Aux { /* {a} s.X {b} = {c} X {d} ↦ s.X → X */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.sX ('{'s.B'}') '=' ('{'s.C'}') t.X ('{'s.D'}')) + (T ('{'s.A'}') t.sX ('{'s.B'}') '=' ('{'s.C'}') t.X ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.sX : (Var 's' e.XIndex) , t.X : (Symbol e._) @@ -1715,7 +1720,7 @@ Solve-SymmClashes-Aux { /* {c} X {d} = {a} s.X {b} ↦ s.X → X */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.X ('{'s.D'}') '=' ('{'s.A'}') t.sX ('{'s.B'}')) + (T ('{'s.C'}') t.X ('{'s.D'}') '=' ('{'s.A'}') t.sX ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.sX : (Var 's' e.XIndex) , t.X : (Symbol e._) @@ -1731,7 +1736,7 @@ Solve-SymmClashes-Aux { /* {a} X {b} = {c} Y {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.X ('{'s.B'}') '=' ('{'s.C'}') t.Y ('{'s.D'}')) + (T ('{'s.A'}') t.X ('{'s.B'}') '=' ('{'s.C'}') t.Y ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.X : (Symbol e._) , t.Y : (Symbol e._) @@ -1740,7 +1745,7 @@ Solve-SymmClashes-Aux { /* {a} (E1) {b} = {c} (E2) {d} ↦ {a} E1 {b} = {c} E2 {d} */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Br1 ('{'s.B'}') '=' ('{'s.C'}') t.Br2 ('{'s.D'}')) + (T ('{'s.A'}') t.Br1 ('{'s.B'}') '=' ('{'s.C'}') t.Br2 ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.Br1 : (Brackets e.E1) , t.Br2 : (Brackets e.E2) @@ -1748,14 +1753,14 @@ Solve-SymmClashes-Aux { (e.UsedVars) (e.Contrs) e.ClashesStart e.ClashesEnd (e.Assigns) >; /* {a} [X E1] {b} = {c} [X E2] {d} ↦ {a} E1 {b} = {c} E2 {d} */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Br1 ('{'s.B'}') '=' ('{'s.C'}') t.Br2 ('{'s.D'}')) + (T ('{'s.A'}') t.Br1 ('{'s.B'}') '=' ('{'s.C'}') t.Br2 ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.Br1 : (ADT-Brackets (e.Name) e.E1) , t.Br2 : (ADT-Brackets (e.Name) e.E2) @@ -1763,7 +1768,7 @@ Solve-SymmClashes-Aux { (e.UsedVars) (e.Contrs) e.ClashesStart e.ClashesEnd (e.Assigns) >; @@ -1778,7 +1783,7 @@ Solve-SymmClashes-Aux { /* {a} ({b} E {c}) {d} = {e} t.X {f} ↦ t.X → (e.NEW) */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Br ('{'s.D'}') '=' ('{'s.E'}') t.tX ('{'s.F'}')) + (T ('{'s.A'}') t.Br ('{'s.D'}') '=' ('{'s.E'}') t.tX ('{'s.F'}')) e.ClashesEnd (e.Assigns) , t.Br : (Brackets ('{'s.B'}') e.E ('{'s.C'}')) , t.tX : (Var 't' e.XIndex) @@ -1788,7 +1793,7 @@ Solve-SymmClashes-Aux { >; @@ -1800,7 +1805,7 @@ Solve-SymmClashes-Aux { на стадии отделения термов */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Br ('{'s.D'}') '=' ('{'s.E'}') t.tX ('{'s.F'}')) + (T ('{'s.A'}') t.Br ('{'s.D'}') '=' ('{'s.E'}') t.tX ('{'s.F'}')) e.ClashesEnd (e.Assigns) , t.Br : (Brackets e._) , t.tX : (Var 't' e._) @@ -1808,7 +1813,7 @@ Solve-SymmClashes-Aux { /* {e} t.X {f} = {a} ({b} E {c}) {d} ↦ t.X → (e.NEW) */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) + (T ('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.Br : (Brackets ('{'s.B'}') e.E ('{'s.C'}')) , t.tX : (Var 't' e.XIndex) @@ -1818,14 +1823,14 @@ Solve-SymmClashes-Aux { >; /* {e} t.X {f} = {a} (E) {d} ↦ обобщение */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) + (T ('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.Br : (Brackets e._) , t.tX : (Var 't' e._) @@ -1843,14 +1848,14 @@ Solve-SymmClashes-Aux { >; /* {a} [X E] {d} = {e} t.X {f} ↦ обобщение */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Br ('{'s.D'}') '=' ('{'s.E'}') t.tX ('{'s.F'}')) + (T ('{'s.A'}') t.Br ('{'s.D'}') '=' ('{'s.E'}') t.tX ('{'s.F'}')) e.ClashesEnd (e.Assigns) , t.Br : (ADT-Brackets (e.Name) e._) , t.tX : (Var 't' e._) @@ -1858,7 +1863,7 @@ Solve-SymmClashes-Aux { /* {e} t.X {f} = {a} [X {b} E {c}] {d} ↦ t.X → [e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) + (T ('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.Br : (ADT-Brackets (e.Name) ('{'s.B'}') e.E ('{'s.C'}')) , t.tX : (Var 't' e.XIndex) @@ -1868,14 +1873,14 @@ Solve-SymmClashes-Aux { >; /* {e} t.X {f} = {a} [X E] {d} ↦ обобщение */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) + (T ('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.Br : (ADT-Brackets (e.Name) e._) , t.tX : (Var 't' e._) @@ -1883,7 +1888,7 @@ Solve-SymmClashes-Aux { /* {a} (E) {b} = {c} Sym {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Br ('{'s.B'}') '=' ('{'s.C'}') t.Sym ('{'s.D'}')) + (T ('{'s.A'}') t.Br ('{'s.B'}') '=' ('{'s.C'}') t.Sym ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.Br : (Brackets e.E) , : True @@ -1891,23 +1896,23 @@ Solve-SymmClashes-Aux { /* {c} Sym {d} = {a} (E) {b} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.Sym ('{'s.D'}') '=' ('{'s.A'}') t.Br ('{'s.B'}')) + (T ('{'s.C'}') t.Sym ('{'s.D'}') '=' ('{'s.A'}') t.Br ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.Br : (Brackets e.E) , : True = /* решений нет */; - /* {a} [E] {b} = {c} Sym {d} ↦ решений нет */ + /* {a} [X E] {b} = {c} Sym {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.Br ('{'s.B'}') '=' ('{'s.C'}') t.Sym ('{'s.D'}')) + (T ('{'s.A'}') t.Br ('{'s.B'}') '=' ('{'s.C'}') t.Sym ('{'s.D'}')) e.ClashesEnd (e.Assigns) , t.Br : (ADT-Brackets e._) , : True = /* решений нет */; - /* {c} Sym {d} = {a} [E] {b} ↦ решений нет */ + /* {c} Sym {d} = {a} [X E] {b} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.Sym ('{'s.D'}') '=' ('{'s.A'}') t.Br ('{'s.B'}')) + (T ('{'s.C'}') t.Sym ('{'s.D'}') '=' ('{'s.A'}') t.Br ('{'s.B'}')) e.ClashesEnd (e.Assigns) , t.Br : (ADT-Brackets e._) , : True @@ -1917,7 +1922,7 @@ Solve-SymmClashes-Aux { * где {c} T1 {d}, {g} E1′ := TERM_LEFT({a} T1 E1) * {e} T2 {f}, {h} E2′ := TERM_LEFT({b} T2 E2) (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.T1 e.E1 '=' ('{'s.B'}') t.T2 e.E2) + (E ('{'s.A'}') t.T1 e.E1 '=' ('{'s.B'}') t.T2 e.E2) e.ClashesEnd (e.Assigns) , : True , : True @@ -1927,7 +1932,7 @@ Solve-SymmClashes-Aux { = : (e.Right1) (e.Right2) = ; @@ -1935,7 +1940,7 @@ Solve-SymmClashes-Aux { * где E1′ {c}, {e} T1 {f} := TERM_RIGHT(E1 T1 {a}) * E2′ {d}, {g} T2 {h} := TERM_RIGHT(E2 T2 {b}) (e.UsedVars) (e.Contrs) e.ClashesStart - (e.E1 t.T1 ('{'s.A'}') '=' e.E2 t.T2 ('{'s.B'}')) + (E e.E1 t.T1 ('{'s.A'}') '=' e.E2 t.T2 ('{'s.B'}')) e.ClashesEnd (e.Assigns) , : True , : True @@ -1945,13 +1950,13 @@ Solve-SymmClashes-Aux { = : (e.Right1) (e.Right2) = ; /* {a} T {b} E1 = {c} e.X E2 ↦ e.X → t.NEW1 e.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') t.T ('{'s.B'}') e.E1 '=' ('{'s.C'}') t.eX e.E2) + (E ('{'s.A'}') t.T ('{'s.B'}') e.E1 '=' ('{'s.C'}') t.eX e.E2) e.ClashesEnd (e.Assigns) , : True , t.eX : (Var 'e' e.XIndex) @@ -1962,14 +1967,14 @@ Solve-SymmClashes-Aux { = : e.Branch1 = : e.Branch2 @@ -1978,7 +1983,7 @@ Solve-SymmClashes-Aux { /* {c} e.X E2 = {a} T {b} E1 ↦ e.X → t.NEW1 e.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.C'}') t.eX e.E2 '=' ('{'s.A'}') t.T ('{'s.B'}') e.E1) + (E ('{'s.C'}') t.eX e.E2 '=' ('{'s.A'}') t.T ('{'s.B'}') e.E1) e.ClashesEnd (e.Assigns) , : True , t.eX : (Var 'e' e.XIndex) @@ -1989,14 +1994,14 @@ Solve-SymmClashes-Aux { = : e.Branch1 = : e.Branch2 @@ -2005,7 +2010,7 @@ Solve-SymmClashes-Aux { /* E1 {a} T {b} = E2 e.X {c} ↦ e.X → e.NEW1 t.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - (e.E1 ('{'s.A'}') t.T ('{'s.B'}') '=' e.E2 t.eX ('{'s.C'}')) + (E e.E1 ('{'s.A'}') t.T ('{'s.B'}') '=' e.E2 t.eX ('{'s.C'}')) e.ClashesEnd (e.Assigns) , : True , t.eX : (Var 'e' e.XIndex) @@ -2016,14 +2021,14 @@ Solve-SymmClashes-Aux { = : e.Branch1 = : e.Branch2 @@ -2032,7 +2037,7 @@ Solve-SymmClashes-Aux { /* E2 e.X {c} = E1 {a} T {b} ↦ e.X → e.NEW1 t.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart - (e.E2 t.eX ('{'s.C'}') '=' e.E1 ('{'s.A'}') t.T ('{'s.B'}')) + (E e.E2 t.eX ('{'s.C'}') '=' e.E1 ('{'s.A'}') t.T ('{'s.B'}')) e.ClashesEnd (e.Assigns) , : True , t.eX : (Var 'e' e.XIndex) @@ -2043,14 +2048,14 @@ Solve-SymmClashes-Aux { = : e.Branch1 = : e.Branch2 @@ -2060,12 +2065,12 @@ Solve-SymmClashes-Aux { * Если остались клэши, к которым не применимы вышеперечисленные правила, * то производим запрос на обобщение (e.UsedVars) (e.Contrs) e.ClashesStart - (('{'s.A'}') e.E1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 ('{'s.D'}')) + (s._ ('{'s.A'}') e.E1 ('{'s.B'}') '=' ('{'s.C'}') e.E2 ('{'s.D'}')) e.ClashesEnd (e.Assigns) = (Generalize (('{' s.A s.B '}') ('{' s.C s.D '}'))); * Если клэши кончились, возвращаем решение - (e.UsedVars) (s.OpenFlag e.Contrs) (e.Assigns) + (e.UsedVars) (s.OpenFlag e.Contrs) /* пусто */ (e.Assigns) = : e.Assigns^ = (Success (e.UsedVars) s.OpenFlag (e.Contrs) (e.Assigns)); } @@ -2199,10 +2204,10 @@ ApplyContraction-toEquation { } ApplyContraction-toSymmClash { - t.Contr (e.L '=' e.R) + t.Contr (s.Type e.L '=' e.R) = : e.L^ = : e.R^ - = : { /* стираем тавтологию */ t.SymmClash, : True = /* пусто */; From 215068d2fbff7882183c0ab15a1119989e60f885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 20:10:01 +0300 Subject: [PATCH 144/208] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D1=81=D0=BE=D0=BF=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=C2=A0?= =?UTF-8?q?=D0=BD=D0=B5=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D0=BC=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=BC=D0=B8=20(#231,=20#314,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Оптимизация была необходима, т.к. перестал проходить тест saved-test-77_14.08.2021_20-00-01,67-big.ref (см. #314, 41ce59e8d0). Теперь снова проходит. --- src/compiler/GenericMatch.ref | 94 +++++++++++++++++++++++++++ src/compiler/OptTree-Drive-Expr.ref | 64 ++++++++---------- src/compiler/OptTree-Drive.ref | 16 +++-- src/compiler/OptTree-StopRelation.ref | 1 + src/compiler/TreeUtils.ref | 49 ++++++++++++++ 5 files changed, 180 insertions(+), 44 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index c2f8ac98..de489b38 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -88,6 +88,7 @@ $ENTRY Solve-Drive { > : { e._ (Generalize (e.Intervals)) e._ = Undefined; + e._ Undefined e._ = Undefined; e._ (Success (e._) AfterOpen (e._) (e._)) e._ = Undefined; e.Success = Success ; @@ -377,6 +378,10 @@ DoAddCoordinateLabels { = (ScrVar s.Mode e.Index) ('{'s.CoordNumber'}') >; + ((WhVar s.Mode e.Index) e.Rest) s.CoordNumber + = (WhVar s.Mode e.Index) ('{'s.CoordNumber'}') + >; + ((ClosureBrackets e.Inner) e.Rest) s.CoordNumber = (ClosureBrackets e.Inner) ('{'s.CoordNumber'}') >; @@ -492,6 +497,12 @@ Solve-Clashes { e.ClashesEnd (e.Assigns) = /* нет решений */; + /* {m} !var {n} : s.X ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (T (('{'s.M'}') (WhVar e._) ('{'s.N'}')) ':' ((Var 's' e.Index))) + e.ClashesEnd (e.Assigns) + = Undefined; + /* {m} (E) {n} : (P) ↦ {m} E {n} : P */ (e.UsedVars) (e.Contrs) e.ClashesStart (T (('{'s.M'}') (Brackets e.LBody) ('{'s.N'}')) ':' ((Brackets e.RBody))) @@ -565,6 +576,12 @@ Solve-Clashes { e.ClashesEnd (e.Assigns) = /* нет решений */; + /* {m} !var {n} : (P) ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (T (('{'s.M'}') (WhVar e._) ('{'s.N'}')) ':' ((Brackets e._))) + e.ClashesEnd (e.Assigns) + = Undefined; + /* {m} Sym {n} : [X P] ↦ нет решений */ (e.UsedVars) (e.Contrs) e.ClashesStart (T (('{'s.M'}') t.Sym ('{'s.N'}')) ':' ((ADT-Brackets e._))) @@ -578,6 +595,12 @@ Solve-Clashes { e.ClashesEnd (e.Assigns) = /* нет решений */; + /* {m} !var {n} : [X P] ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (T (('{'s.M'}') (WhVar e._) ('{'s.N'}')) ':' ((ADT-Brackets e._))) + e.ClashesEnd (e.Assigns) + = Undefined; + /* {m} t.X {n} : (P) ↦ t.X → (e.NEW) */ (e.UsedVars) (e.Contrs) e.ClashesStart (T (('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) ':' ((Brackets e.PBody))) @@ -596,6 +619,12 @@ Solve-Clashes { > >; + /* {m} !t.X {n} : (P) ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (T (('{'s.M'}') (WhVar 't' e.Index) ('{'s.N'}')) ':' ((Brackets e.PBody))) + e.ClashesEnd (e.Assigns) + = Undefined; + /* {m} t.X {n} : [X P] ↦ t.X → [X e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart (T @@ -617,6 +646,14 @@ Solve-Clashes { > >; + /* {m} !t.X {n} : [X P] ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (T + (('{'s.M'}') (WhVar 't' e.Index) ('{'s.N'}')) + ':' ((ADT-Brackets (e.Name) e.PBody)) + ) + = Undefined; + /* {m} t.X {n} : Psym ↦ t.X → s.NEW */ (e.UsedVars) (e.Contrs) e.ClashesStart (T (('{'s.M'}') (Var 't' e.Index) ('{'s.N'}')) ':' (t.Psym)) @@ -633,6 +670,12 @@ Solve-Clashes { > >; + /* {m} t.X {n} : Psym ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (T (('{'s.M'}') (WhVar 't' e.Index) ('{'s.N'}')) ':' (t.Psym)) + e.ClashesEnd (e.Assigns) + = Undefined; + /* {m} s.X {n} : X ↦ s.X → X */ (e.UsedVars) (e.Contrs) e.ClashesStart (T (('{'s.M'}') (Var 's' e.Index) ('{'s.N'}')) ':' ((Symbol s.Type e.Info))) @@ -647,6 +690,12 @@ Solve-Clashes { > >; + /* {m} s.X {n} : X ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (T (('{'s.M'}') (WhVar 's' e.Index) ('{'s.N'}')) ':' ((Symbol s.Type e.Info))) + e.ClashesEnd (e.Assigns) + = Undefined; + /* {m} X {n} : X ↦ стираем */ (e.UsedVars) (e.Contrs) e.ClashesStart (T @@ -673,6 +722,12 @@ Solve-Clashes { e.ClashesEnd (e.Assigns) = /* нет решений */; + /* {m} !var {n} : Y ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (T (('{'s.M'}') (WhVar e._) ('{'s.N'}')) ':' ((Symbol e._))) + e.ClashesEnd (e.Assigns) + = Undefined; + /* {m} {{ &F e.X }} {n} : Pt ↦ нет решений @@ -711,6 +766,12 @@ Solve-Clashes { > >; + /* {m} !e.X E {n} : ε ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (E (('{'s.M'}') (WhVar 'e' e.Index) e.E ('{'s.N'}')) ':' (/* пусто */)) + e.ClashesEnd (e.Assigns) + = Undefined; + /* {m} T E {n} : ε ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart (E (('{'s.M'}') t.T e.E ('{'s.N'}')) ':' (/* пусто */)) @@ -869,7 +930,24 @@ Solve-Clashes { = e.Solutions2; + /* {m} !e.X E {n} : Pt P ↦ e.X → t.NEW1 e.NEW2 || e.X → ε */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (E (('{'s.M'}') (WhVar 'e' e.Index) e.E ('{'s.N'}')) ':' (t.Pt e.P)) + e.ClashesEnd (e.Assigns) + = Undefined; + + /* {m} E !e.X {n} : P Pt ↦ e.X → e.NEW1 t.NEW2 || e.X → ε */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (E (('{'s.M'}') e.E (WhVar 'e' e.Index) ('{'s.N'}')) ':' (e.P t.Pt)) + e.ClashesEnd (e.Assigns) + = Undefined; + /* могли остаться только клэши вида E : e.X P e.Y */ + (e.UsedVars) (s.OpenFlag e.Contrs) + (E (e._ (WhVar e._) e._) ':' ((Var 'e' e._) e.P (Var 'e' e._))) + e.ClashesEnd (e.Assigns) + = Undefined; + (e.UsedVars) (s.OpenFlag e.Contrs) (E (e.E) ':' ((Var 'e' e._) e.P (Var 'e' e._))) e.ClashesEnd (e.Assigns) @@ -1545,6 +1623,13 @@ Solve-SymmClashes-Aux { > >; + /* ε = {m} !e.X E {n} ↦ не определено */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (E /* пусто */ '=' ('{'s.M'}') t.eX e.E ('{'s.N'}')) + e.ClashesEnd (e.Assigns) + , t.eX : (WhVar 'e' e.XIndex) + = Undefined; + /* {m} e.X E {n} = ε ↦ e.X → ε, {m} E {n} = ε */ (e.UsedVars) (e.Contrs) e.ClashesStart (E ('{'s.M'}') t.eX e.E ('{'s.N'}') '=' /* пусто */) @@ -1560,6 +1645,13 @@ Solve-SymmClashes-Aux { > >; + /* {m} !e.X E {n} = ε ↦ e.X → ε, {m} E {n} = ε */ + (e.UsedVars) (e.Contrs) e.ClashesStart + (E ('{'s.M'}') t.eX e.E ('{'s.N'}') '=' /* пусто */) + e.ClashesEnd (e.Assigns) + , t.eX : (WhVar 'e' e.XIndex) + = Undefined; + /* ε = {m} T E {n} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart (E /* пусто */ '=' ('{'s.M'}') t.T e.E ('{'s.N'}')) @@ -2089,6 +2181,7 @@ IsSVarSubset { (Symbol s.Type e.Info) = True; (Var 's' e.Tindex) = True; (ScrVar 's' e.Tindex) = True; + (WhVar 's' e.Tindex) = True; (Closure e.Body) = True; (ClosureBrackets e.Context) = True; @@ -2100,6 +2193,7 @@ IsSVarSubset { IsTerm { (Var 'e' e.Index) = False; (ScrVar 'e' e.Index) = False; + (WhVar 'e' e.Index) = False; /* Рассматриваем для оптимизаций встраивания, прогонки и специализации */ (CallBrackets e.Nested) = False; diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index e8413092..652e2294 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -12,20 +12,20 @@ $EXTERN GenericMatch, Solve-Drive; *$FROM TreeUtils $EXTERN ExpandClosures-Result, ApplyContractions, ExtractVariables-Expr, - CreateContext, IsPassiveExpr, ApplyAssigns, HashName; + CreateContext, IsPassiveExpr, MarkAllVarsAsWhole, ApplyAssigns, HashName; /** - + == t.OptInfo^ e.FlatBranches (e.NewFunctions) e.FlatBranches ::= (e.Contractions (e.DrivenExpr))* e.UsedVars, e.WholeVars ::= (s.Mode e.Index)* */ $ENTRY OptTree-Drive-Expr { - (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr + (e.UsedVars) t.OptInfo e.Expr = : e.Expr^ - = + = : ((s._CntNodes) t.OptInfo^ (e.NewFunctions)) e.DriveTree = t.OptInfo (e.NewFunctions); } @@ -62,7 +62,7 @@ IncWithMax { t.TreeBranch ::= (e.Contractions (e.DrivenRight) (t.TreeBranch*)) */ MakeDriveTree { - (s.CntNodes) (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr + (s.CntNodes) (e.UsedVars) t.OptInfo e.Expr (s.TreeDepth e.canoninzedExprs) = () e.canoninzedExprs : e.canoninzedExprs^ = > @@ -80,7 +80,7 @@ MakeDriveTree { False s._Cnt = ; }; @@ -99,7 +99,7 @@ DriveStateWithLeaf { gen_e__ { e.arg = e.arg } GrowDriveTree { - (s.CntNodes) (e.UsedVars) (e.WholeVars) t.OptInfo e.Expr + (s.CntNodes) (e.UsedVars) t.OptInfo e.Expr (s.TreeDepth e.canoninzedExprs) = t.OptInfo : ((e.OptFuncNames) e.OptFuncs) = @@ -110,20 +110,20 @@ GrowDriveTree { (e.OptFuncNames^ t.Call) e.Expr^ = t.Call e.OptFuncs + (e.UsedVars) (e.Expr) t.Call e.OptFuncs > : (e.OptFuncs^) (e.NewFunctions) e.Branches = ((e.OptFuncNames) e.OptFuncs) : t.OptInfo^ = : { Generalize t.OptInfo^ 1 = (s.TreeDepth e.canoninzedExprs) >; @@ -136,14 +136,14 @@ GrowDriveTree { } GrowDriveTree-DriveBranches { - (s.CntNodes) (e.UsedVars) (e.WholeVars) t.OptInfo + (s.CntNodes) (e.UsedVars) t.OptInfo (s.TreeDepth e.canoninzedExprs) (e.NewFunctions) e.Branches = : { @@ -205,14 +205,14 @@ FlatDriveTree { } OptOneCall { - (e.UsedVars) (e.WholeVars) (e.Expr) + (e.UsedVars) (e.Expr) (CallBrackets (Symbol Name e.Name) e.Args) s.Contractions-Mode t.Metatables e.OptFuncs /* Поиск информации для прогонки */ = : e.OptFuncs^ t.FunctionForDrive = : t.Metatables^ e.SubstitutionPacks @@ -304,7 +304,7 @@ eDRIVEN { /* == t.Metatables (e.Substitutions)* e.Substitutions ::= e.Contractions (e.NewFunctions) @@ -314,7 +314,7 @@ eDRIVEN { */ OptExpr-MakeSubstitutions { s.Contractions-Mode - (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) t.IntrinsicFunction t.Metatables + (e.UsedVars) (e.Expr) (e.Args) t.IntrinsicFunction t.Metatables , t.IntrinsicFunction : ((e._) Intrinsic e.BehaviorName) = : { @@ -327,31 +327,30 @@ OptExpr-MakeSubstitutions { ; }; - s.Contractions-Mode (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) + s.Contractions-Mode (e.UsedVars) (e.Expr) (e.Args) t.Function t.Metatables /* Активные вызовы игнорируем */ , : False = t.Metatables ; - s.Contractions-Mode (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) + s.Contractions-Mode (e.UsedVars) (e.Expr) (e.Args) ((e.Name) Sentences e.Body) t.Metatables = s.Contractions-Mode : { - Contractions-Enabled = e.WholeVars; - Contractions-Disabled = e.UsedVars; + Contractions-Enabled = e.Args; + Contractions-Disabled = ; } - : e.WholeVars^ + : e.Args^ = t.Metatables ; - t.Contractions-Mode (e.UsedVars) (e.WholeVars) (e.Expr) (e.Args) + t.Contractions-Mode (e.UsedVars) (e.Expr) (e.Args) t.Function t.Metatables = t.Metatables ; } @@ -374,7 +373,7 @@ MakeColdSolution { } DoOptExpr-MakeSubstitutions { - (e.SentenceVars) (e.WholeVars) (e.Args) (e.Substitutions) + (e.SentenceVars) (e.Args) (e.Substitutions) ((e.Name) Sentences ((e.LS) (e.RS)) e.Rest) = : e.RS^ = @@ -395,7 +394,6 @@ DoOptExpr-MakeSubstitutions { «Грязное» решение допускаем только в случае прогонки. */ Success e.Solutions - , : True = ) Sentences e.Rest) >; @@ -425,7 +423,7 @@ DoOptExpr-MakeSubstitutions { >; }; - (e.SentenceVars) (e.WholeVars) (e.Args) (e.Substitutions) t.RestFunction + (e.SentenceVars) (e.Args) (e.Substitutions) t.RestFunction = e.Substitutions ; } @@ -440,16 +438,6 @@ Cleanup-Step-Drop { e.RS = e.RS; } -SafeContractions { - e.Solutions-B - (e.UsedVars (e.Contrs-B ((Var s.Mode e.Index) ':' e._) e.Contrs-E) (e.Assigns)) - e.Solutions-E - (e.WholeVars-B (s.Mode e.Index) e.WholeVars-E) - = False; - - e.Solutions (e.WholeVars) = True; -} - DropLeft { e.List 0 = e.List; t.Head e.Tail s.N = > diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index aed0ae97..593b5df6 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -8,7 +8,8 @@ $EXTERN Log-PutLine; $EXTERN DisplayName; *$FROM TreeUtils -$EXTERN HashName, ExtractVariables, IsLExpr, ApplyContractions; +$EXTERN HashName, ExtractVariables, IsLExpr, MarkAllVarsAsWhole, + ApplyContractions, UnmarkWholeVars; *$FROM OptTree-Drive-Expr $EXTERN OptTree-Drive-Expr; @@ -400,18 +401,21 @@ OptSentence { /* Если левая часть не L-выражение, сужения запрещаем */ = : { - True = /* пусто */; - False = e.SentenceVars; + True = e.Right; + False = ; } - : e.WholeVars + : e.Right^ - = + = : t.OptInfo^ e.Branches (e.NewFunctions) = ) (e.DrivenRight)); + = : e.Left^ + = : e.Left^ + = : e.DrivenRight^ + = ((e.Left) (e.DrivenRight)); } e.Branches > diff --git a/src/compiler/OptTree-StopRelation.ref b/src/compiler/OptTree-StopRelation.ref index 845420f0..f4c6cf05 100644 --- a/src/compiler/OptTree-StopRelation.ref +++ b/src/compiler/OptTree-StopRelation.ref @@ -116,6 +116,7 @@ $ENTRY OptTree-CanonizeExpr { CanonizeExpr-Term { (Var s.Mode e.Index) = (Var s.Mode); + (WhVar s.Mode e.Index) = (Var s.Mode); /* Не различаем замороженные и обычные скобки */ (ColdCallBrackets e.Expr) diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index 511ec72d..a12cffae 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -35,6 +35,9 @@ $ENTRY ExtractVariables-Expr { (Var s.VarType e.Index) e.Terms = (s.VarType e.Index) ; + (WhVar s.VarType e.Index) e.Terms + = (s.VarType e.Index) ; + (Brackets e.Inner) e.Terms = ; (ADT-Brackets (e.Name) e.Inner) e.Terms = ; @@ -335,3 +338,49 @@ ApplyAssigns-Term { t.T (e.Assigns) = t.T; } + +/** + == e.Expr^ +*/ +$ENTRY MarkAllVarsAsWhole { + e.Expr + = ); + + (ADT-Brackets (e.Name) e.Nested) + = (ADT-Brackets (e.Name) ); + + (Var s.Mode e.Index) = (WhVar s.Mode e.Index); + + t.Other = t.Other; + } + e.Expr + > +} + +/** + == e.Expr^ +*/ +$ENTRY UnmarkWholeVars { + e.Expr + = ); + + (ADT-Brackets (e.Name) e.Nested) + = (ADT-Brackets (e.Name) ); + + (WhVar s.Mode e.Index) = (Var s.Mode e.Index); + + t.Other = t.Other; + } + e.Expr + > +} From 8d365aa163b2d77e85389ab8414d0effbc85b3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 20:19:14 +0300 Subject: [PATCH 145/208] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D1=81=D0=B8=D0=BC=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D1=80=D0=B8=D1=87=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BA=D0=BB?= =?UTF-8?q?=D1=8D=D1=88=D0=B0=20=D1=81=C2=A0=D0=B7=D0=B0=D0=BC=D1=8B=D0=BA?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=D0=BC=20(#322,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 79 ++++------------------------------- 1 file changed, 9 insertions(+), 70 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index de489b38..f3d61149 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -1666,85 +1666,24 @@ Solve-SymmClashes-Aux { , : True = /* решений нет */; - /* {a} t.X {b} = {c} {{ &F e.X }} {d} ↦ обобщаем {c−d} */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.A'}') t.tX ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.tX : (Var 't' e._) - , t.Closure : (ClosureBrackets e._) - = (Generalize (('{' s.C s.D '}'))); - - /* {c} {{ &F e.X }} {d} = {a} t.X {b} ↦ обобщаем {c−d} */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.tX ('{'s.B'}')) - e.ClashesEnd (e.Assigns) - , t.tX : (Var 't' e._) - , t.Closure : (ClosureBrackets e._) - = (Generalize (('{' s.C s.D '}'))); - - /* {a} s.X {b} = {c} {{ &F e.X }} {d} ↦ обобщаем {c−d} */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.A'}') t.sX ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.sX : (Var 's' e._) - , t.Closure : (ClosureBrackets e._) - = (Generalize (('{' s.C s.D '}'))); + /* + {a} T {b} = {c} {{ &F e.X }} {d} ↦ обобщаем {c−d} + {a} {{ &F e.X }} {b} = {c} T {d} ↦ обобщаем {a−b} - /* {c} {{ &F e.X }} {d} = {a} s.X {b} ↦ обобщаем {c−d} */ + Случай {{ &F e.X }} = {{ &F e.X }} не рассматриваем, + т.к. он обрабатывается как тавтология. + */ (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.sX ('{'s.B'}')) + (T ('{'s.A'}') t._ ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) e.ClashesEnd (e.Assigns) - , t.sX : (Var 's' e._) , t.Closure : (ClosureBrackets e._) = (Generalize (('{' s.C s.D '}'))); - /* {a} X {b} = {c} {{ &F e.X }} {d} ↦ решений нет */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.A'}') t.X ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.X : (Symbol e._) - , t.Closure : (ClosureBrackets e._) - = /* решений нет */; - - /* {c} {{ &F e.X }} {d} = {a} X {b} ↦ решений нет */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.X ('{'s.B'}')) - e.ClashesEnd (e.Assigns) - , t.X : (Symbol e._) - , t.Closure : (ClosureBrackets e._) - = /* решений нет */; - - /* {a} (E) {b} = {c} {{ &F e.X }} {d} ↦ решений нет */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.A'}') t.BrE ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.BrE : (Brackets e._) - , t.Closure : (ClosureBrackets e._) - = /* решений нет */; - - /* {c} {{ &F e.X }} {d} = {a} (E) {b} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.BrE ('{'s.B'}')) + (T ('{'s.A'}') t.Closure ('{'s.B'}') '=' ('{'s.C'}') t._ ('{'s.D'}')) e.ClashesEnd (e.Assigns) - , t.BrE : (Brackets e._) , t.Closure : (ClosureBrackets e._) - = /* решений нет */; - - /* {a} [X E] {b} = {c} {{ &F e.X }} {d} ↦ решений нет */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.A'}') t.BrE ('{'s.B'}') '=' ('{'s.C'}') t.Closure ('{'s.D'}')) - e.ClashesEnd (e.Assigns) - , t.BrE : (ADT-Brackets e._) - , t.Closure : (ClosureBrackets e._) - = /* решений нет */; - - /* {c} {{ &F e.X }} {d} = {a} [X E] {b} ↦ решений нет */ - (e.UsedVars) (e.Contrs) e.ClashesStart - (T ('{'s.C'}') t.Closure ('{'s.D'}') '=' ('{'s.A'}') t.BrE ('{'s.B'}')) - e.ClashesEnd (e.Assigns) - , t.BrE : (ADT-Brackets e._) - , t.Closure : (ClosureBrackets e._) - = /* решений нет */; + = (Generalize (('{' s.A s.B '}'))); /* {a} [X E1] {b} = {c} (E2) {d} ↦ решений нет */ (e.UsedVars) (e.Contrs) e.ClashesStart From e8782f6c647f8ce4b95bfef1f03cb8e48fa3c0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 20:55:09 +0300 Subject: [PATCH 146/208] =?UTF-8?q?=D0=A3=D1=82=D0=BE=D1=87=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B8=D0=BC=D1=91=D0=BD=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 652e2294..b2759288 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -140,7 +140,7 @@ GrowDriveTree-DriveBranches { (s.TreeDepth e.canoninzedExprs) (e.NewFunctions) e.Branches = : { ((s.CntNodes^) t.OptInfo^ (e.NewFunctions^)) e.Branches^ - = ((s.CntNodes) t.OptInfo (e.NewFunctionsAccum e.NewFunctions)) + = ((s.CntNodes) t.OptInfo (e.NewFunctionsAcc e.NewFunctions)) (e.Contractions (e.DrivenRight) (e.Branches)); Generalize t.OptInfo^ s.Cnt = (Generalize t.OptInfo s.Cnt); @@ -194,8 +194,8 @@ FlatDriveTree { = : e.FlatBranches = ; From f6bce7c1ff3a3f2ad6ca9035acb6b149be935880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 21:37:31 +0300 Subject: [PATCH 147/208] =?UTF-8?q?=D0=A3=D1=82=D0=BE=D1=87=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B5=D0=BB=D1=8E=D0=B4=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=BB=D1=83=D1=87=D0=B0?= =?UTF-8?q?=D0=B9=D0=BD=D1=8B=D1=85=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Со старой версией выдавались предупреждения согласно https://github.com/bmstu-iu9/refal-5-lambda/issues/314#issuecomment-899034440 То, что функции теперь помечены $EXTERN — не страшно. Всё равно эти файлы не линкуются, поэтому определения встроенным функциям не нужны. --- autotests/positive-random-test/prelude-for-test.refi | 12 +----------- src/compiler/OptTree-Drive-Intrinsic.ref | 1 + 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/autotests/positive-random-test/prelude-for-test.refi b/autotests/positive-random-test/prelude-for-test.refi index 6d6afd10..41320150 100644 --- a/autotests/positive-random-test/prelude-for-test.refi +++ b/autotests/positive-random-test/prelude-for-test.refi @@ -1,14 +1,4 @@ *$EXTENDED -Chr { = } -Ev-met { = } -Lenw { = } -Lower { = } -Mu { = } -Ord { = } -Print { = } -Prout { = } -Type { = } -Upper { = } - +$EXTERN Chr, Ev-met, Lenw, Lower, Mu, Ord, Print, Prout, Type, Upper; $INTRINSIC Chr, Lenw, Lower, Mu, Ord, Type, Upper; diff --git a/src/compiler/OptTree-Drive-Intrinsic.ref b/src/compiler/OptTree-Drive-Intrinsic.ref index 3a16dcfc..b944c4ca 100644 --- a/src/compiler/OptTree-Drive-Intrinsic.ref +++ b/src/compiler/OptTree-Drive-Intrinsic.ref @@ -431,6 +431,7 @@ Intrinsic-Type { (CallBrackets e._) e._ = MakeColdCall; (ColdCallBrackets e._) e._ = MakeColdCall; (Var e._) e._ = MakeColdCall; + (WhVar e._) e._ = MakeColdCall; t.Term e.Rest = t.Term From 42c9ca0aba06eb324e134e3a2555a2fa91c47aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 20 Aug 2021 22:04:50 +0300 Subject: [PATCH 148/208] =?UTF-8?q?=D0=A7=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?OptTree-AutoMarkup-Drive.ref=20=D0=BE=D1=82=C2=A0=D0=BB=D0=B8?= =?UTF-8?q?=D1=88=D0=BD=D0=B5=D0=B3=D0=BE=20=D0=BA=D0=BE=D0=B4=D0=B0=20(#3?= =?UTF-8?q?14,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-AutoMarkup-Drive.ref | 273 ++-------------------- 1 file changed, 15 insertions(+), 258 deletions(-) diff --git a/src/compiler/OptTree-AutoMarkup-Drive.ref b/src/compiler/OptTree-AutoMarkup-Drive.ref index 70286c1a..476bd66c 100644 --- a/src/compiler/OptTree-AutoMarkup-Drive.ref +++ b/src/compiler/OptTree-AutoMarkup-Drive.ref @@ -12,18 +12,26 @@ $EXTERN HashName; $ENTRY OptTree-AutoMarkup-Drive { e.AST - = : t.MetaInfo e.AST^ - = t.MetaInfo : ((e.Forbidden) (e.Inlines) (e.UserdefDrives) (e.Entries)) - = : True + = (Drives e.Drives) + (Function (e.FuncName) Sentences (e.OneSentence)); + (Drives e.Drives) (Function (e.Name) Sentences e.Body) - = e.Forbidden + = : { - e._ (e.Name) e._ = e.Drives; - e._ = e.Drives (e.Name); + 0 /* пусто */ = e.Drives (e.Body); + + s.SentencesCount e.Body^, : '+' + = e.Drives (e.Body); + + s.SentencesCount e.Body^ = e.Drives (e.Name) (e.Body); } - : e.Drives^ + : e.Drives^ (e.Body^) = (Drives e.Drives) (Function (e.Name) Sentences e.Body); /* пользовательскую разметку игнорируем */ @@ -36,80 +44,6 @@ $ENTRY OptTree-AutoMarkup-Drive { > } -BuldCallGraph { - e.AST (e.Inlines) - = : (e.Metatables) e.Functions - = : e.Metatables^ - = : e.Graph - - = : e.Graph^ - - = : (e.Indirects) e.Graph^ - = : e.Graph^ - - = : (e.InlinesRef) e.Graph^ - = : e.Graph^ - = (e.Indirects) e.Graph; -} - -MetaInfo { - e.AST - = : (e.Entries) e.AST^ - = : (e.Drives) e.AST^ - = : (e.Inlines) e.AST^ - = : (e.Intrinsics) e.AST^ - = (/* forbidden list */) : t.InitMetaInfo - = : True - = - (Function - (e.FuncName) Sentences - (((Var 'e' e.Index)) /*=*/ ((Var 'e' e.Index))) - ); - - t.MetaInfo (Function (e.FuncName) Sentences e.Body) - = : s.SentencesCount e.Body^ - = /* пусто */ - : { - /* пусто */, s.SentencesCount : 0 - = ; - - /* пусто */, : '+' - = ; - - /* пусто */ = t.MetaInfo; - } - : t.MetaInfo^ - = t.MetaInfo (Function (e.FuncName) Sentences e.Body); - - t.MetaInfo t.Other = t.MetaInfo t.Other; - } - t.InitMetaInfo e.AST - > - : (e.Forbidden) e.AST^ - = ((e.Intrinsics e.Forbidden) (e.Inlines) (e.Drives) (e.Entries)) - (Entries e.Entries) - (Drives e.Drives) - (Inlines e.Inlines) - (Intrinsics e.Intrinsics) - e.AST -} - -MetaInfo-ExtractNode { - s.Node e.AST-B (s.Node e.Names) e.AST-E = (e.Names) e.AST-B e.AST-E; - s.Node e.AST = (/* пусто */) e.AST; -} - -MetaInfo-AddForbidden { - (e.Forbidden) e.Name = (e.Forbidden (e.Name)); -} - Pseudofunction-gen_e { 'gen_e__' = True; 'gen-e__' = True; @@ -119,28 +53,6 @@ Pseudofunction-gen_e { e._ = False; } -SeparateMetatables { - e.AST - = -} - MakeGraphNode { (Function (e.MetatableName) Metatable e.Metatable) = ) - } - (e.Graph) e.Metatables - > - : (e.Graph^) - = e.Graph; -} - -InlineOneMetatable { - e.Functions-B - (Func (e.Name) Children (e.Children-B (Pointer e.MetatableName) e.Children-E)) - e.Functions-E - t.Metatable - , t.Metatable : (Func (e.MetatableName) Children (e.MetatableNodes)) - = e.Functions-B - (Func (e.Name) Children (e.Children-B e.MetatableNodes e.Children-E)) - ; - - e.Functions t.Metatable = e.Functions; -} - -SeparateInlineGraphNodes { - e.Graph (e.Inlines) - = -} - -InlineInlineReferences { - e.Graph (e.Inlines) - = : e.Inlines^ - = -} - -MakeInlineClosure { - (e.InlinesAcc) e.Inlines - = - : { - e.InlinesAcc /* same */ = e.InlinesAcc; - - e.InlinesAcc^ = ; - } -} - -ApplyInlines { - e.Graph (e.Inlines) - = - : e.Inlines^ (e.Children^) - = (e.Inlines) (Func (e.Name) Children (e.Children)); - } - (e.Inlines) e.Graph - > - : (e._) e.Graph^ - = e.Graph; -} - -ApplyInlines-Children { - e.Inlines-B (Func (e.Name) Children (e.InlineChilden)) e.Inlines-E - (e.Children-B (e.Name) e.Children-E) - = e.Children-B (e.Name) e.Children-E : e.Children - = : e.Children^ - = e.Inlines-B (Func (e.Name) Children (e.InlineChilden)) - ; - - e.Inlines (e.Children) = e.Inlines (e.Children); -} - -* == e.Set1 e.Set2\Set1 -UnionChildren { - e.Unique t.Common e.NotScanned (e.New-B t.Common e.New-E) - = e.Unique t.Common ; - - e.Unique (e.New) = e.Unique e.New; -} - -SeparateIndirects { - e.Graph - = - : (e.FunctionIndirects) e.Children^ - - = (e.Indirects e.FunctionIndirects) - (Func (e.Name) Children ()); - } - (/* indirects */) - e.Graph - > - : (e.Indirects) e.Graph^ - = () e.Graph; -} - -SeparateIndirects-Children { - e.Children - = -} - -InlineIndirects { - e.Graph-B - (Func (e.Name) Children (e.Children-B INDIRECT e.Children-E)) - e.Graph-E - (e.Indirects) - = e.Graph-B - (Func (e.Name) Children ()) - ; - - e.Graph (e.Indirects) = e.Graph; -} - /* == (ToDrive e.FuncNames) (Basics e.FuncNames) (Unreachable e.FuncNames) @@ -498,20 +276,6 @@ WrapBucket { s.Hash e.Bucket = (s.Hash e.Bucket); } -SetDifference { - e.Set1-B t.Common e.Set1-E (e.Set2-B t.Common e.Set2-E) - = e.Set1-B ; - - e.Set1 (e.Set2) = e.Set1; -} - -UpdateAST { - e.AST-B (Drives e.Drives) e.AST-E (e.NewDrives) (e.BasisVertexes) - = e.AST-B - (Drives e.NewDrives) - e.AST-E -} - /** == e.AST */ @@ -519,13 +283,6 @@ $ENTRY OptTree-AutoMarkup-CureDrives { e.AST = e.AST; } -SetIntersect { - (e.Set1-B t.Common e.Set1-E) (e.Set2-B t.Common t.Set2-E) - = t.Common ; - - (e.Set1) (e.Set2) = /* пусто */; -} - /** == e.AST From ca6db291e9d7dcf3ae14e1fe879eae71cae4676f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 21 Aug 2021 10:22:44 +0300 Subject: [PATCH 149/208] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D1=83=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9=20=D0=BA=C2=A0=D0=B2=D1=8B=D1=80=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8E=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/TreeUtils.ref | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index a12cffae..2135df16 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -274,10 +274,21 @@ ApplyContractions-Expr { } ApplyContractions-Term { + (e.Contrs) ('{'s.Coord'}') = (e.Contrs) ('{'s.Coord'}'); + + (e.Contrs) (Symbol e.Symbol) + = (e.Contrs) (Symbol e.Symbol); + (e.Contrs) (Brackets e.Expr) = : (e.Contrs^) e.Expr^ = (e.Contrs) (Brackets e.Expr); + (e.B ((Var e.Var) ':' e.Contr) e.E) (Var e.Var) + = : (e.E^) e.Expr + = (e.B ((Var e.Var) ':' e.Contr) e.E) e.Expr; + + (e.Contrs) (Var e.Var) = (e.Contrs) (Var e.Var); + (e.Contrs) (CallBrackets e.Expr) = : (e.Contrs^) e.Expr^ = (e.Contrs) (CallBrackets e.Expr); @@ -292,6 +303,9 @@ ApplyContractions-Term { (e.Contrs^) e.ChangedArgs = (e.Contrs) (CallBrackets e.ChangedArgs); }; + (e.Contrs) (WhVar e.Var) = (e.Contrs) (WhVar e.Var); + (e.Contrs) (ScrVar e.Var) = (e.Contrs) (ScrVar e.Var); + (e.Contrs) (ClosureBrackets e.Expr) = : (e.Contrs^) e.Expr^ = (e.Contrs) (ClosureBrackets e.Expr); @@ -299,11 +313,6 @@ ApplyContractions-Term { (e.Contrs) (ADT-Brackets (e.Name) e.Expr) = : (e.Contrs^) e.Expr^ = (e.Contrs) (ADT-Brackets (e.Name) e.Expr); - - (e.B (t.Term ':' e.Contr) e.E) t.Term - = ; - - (e.Contrs) t.T = (e.Contrs) t.T; } /** From f3e6e4d089c8c2346c367f736503f9bf1dd467e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 21 Aug 2021 13:23:58 +0300 Subject: [PATCH 150/208] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BD=D1=83=D0=B4?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=C2=A0=D0=BA?= =?UTF-8?q?=D1=83=D1=87=D0=B5=20=D0=BC=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B1=D0=BE=D1=80=D1=8C=D0=B1=D1=8B=20=D1=81=C2=A0?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D0=BF=D1=83=D1=85=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=D0=BC=20=E2=84=96=C2=A05=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit По-нормальному, нужно каждый случай обобщения описать, сделать выводы и решить проблему в общем случае в рамках #332. А пока я анализировал лог и подсекал наиболее явные точки распухания. --- src/compiler/GST.ref | 2 +- src/compiler/HighLevelRASL-GenResult-Opt.ref | 14 +++++++++----- src/compiler/R5-Lexer.ref | 9 ++++++++- src/compiler/R5-Parser.ref | 6 ++---- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/compiler/GST.ref b/src/compiler/GST.ref index 48b7d6db..914fbf79 100644 --- a/src/compiler/GST.ref +++ b/src/compiler/GST.ref @@ -155,7 +155,7 @@ DoOverlapOffsets { OverlapChain { (e.Pattern) (e.Result) = - >; + ) ()>>; } ZipItems { diff --git a/src/compiler/HighLevelRASL-GenResult-Opt.ref b/src/compiler/HighLevelRASL-GenResult-Opt.ref index c9d765bd..b12801cc 100644 --- a/src/compiler/HighLevelRASL-GenResult-Opt.ref +++ b/src/compiler/HighLevelRASL-GenResult-Opt.ref @@ -378,31 +378,35 @@ AddOffsets { } e.Tile > - ); + ) + ; s.Offset (Var 's' e.Index) = (VarCopy s.Offset - ); + ) + ; s.Offset (Var 't' e.Index) = (VarCopy s.Offset - ); + ) + ; s.Offset (Var 'e' e.Index) = (VarCopy s.Offset - ); + ) + ; s.Offset (TkString e.String) = - (TkString e.String s.Offset); + (TkString e.String s.Offset) ; s.Offset (s.Tag e.Info) = (s.Tag e.Info s.Offset); } diff --git a/src/compiler/R5-Lexer.ref b/src/compiler/R5-Lexer.ref index dab7cfa8..562b7313 100644 --- a/src/compiler/R5-Lexer.ref +++ b/src/compiler/R5-Lexer.ref @@ -121,7 +121,13 @@ IncCol { = (RowCol s.Line <+ s.Col s.Len>); } +gen_e__ { e.arg = e.arg } + DoScan { + t.Pos e.Lines = > +} + +DoScan-GEN { t.Pos = (TkEOF t.Pos); t.Pos (' ' e.Line) e.Lines = (e.Line) e.Lines>; @@ -194,7 +200,8 @@ DoScan { t.Pos ('\'' e.Line) e.Lines = (e.Line) e.Lines>; - t.Pos ('/*' e.Line) e.Lines = ; + t.Pos ('/*' e.Line) e.Lines + = ) (e.Line) e.Lines>; t.Pos ('\"' e.Line) e.Lines = () (e.Line) e.Lines>; diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index d02156af..00140f19 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -699,9 +699,7 @@ $INLINE TokenChain, Expression; TokenChain { t.ErrorList s.Mode s.Kind e.Tokens - = ) - > + = } gen_e__ { e.arg = e.arg } @@ -709,7 +707,7 @@ gen_e__ { e.arg = e.arg } DoTokenChain { s.Mode s.Kind t.ErrorList (e.Collected) e.Tokens = ) e.Tokens + s.Mode s.Kind t.ErrorList () > } From fbc18f4aa314d26cb108f49b3f70b918fd88b46c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 21 Aug 2021 13:44:38 +0300 Subject: [PATCH 151/208] =?UTF-8?q?=D0=A3=D1=82=D0=BE=D1=87=D0=BD=D1=91?= =?UTF-8?q?=D0=BD=20=D0=BF=D1=80=D0=B8=D0=BD=D1=86=D0=B8=D0=BF=20=D0=BD?= =?UTF-8?q?=D1=83=D0=BC=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D1=8B=D1=85=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/TreeUtils.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index 2135df16..a027cc64 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -82,7 +82,7 @@ DoNewVarName { IncName { e.Name s.Digit, '0123456789' : e._B s.Digit s.Next e._E = e.Name s.Next; e.Name '9' = '0'; - e.Name = e.Name '0'; + e.Name = e.Name '1'; } From 84c8d7baf6fcb8663ed2cf2b46b16a628cc2ad8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 22 Aug 2021 13:52:06 +0300 Subject: [PATCH 152/208] =?UTF-8?q?=D0=A3=D1=81=D1=82=D0=B0=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D1=88=D0=B8=D0=B5=20=D1=83=D0=B7=D0=BB=D1=8B=20=D0=B4?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B2=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B8?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D0=B2=C2=A0?= =?UTF-8?q?Legacy=E2=80=A6=20(#314,=20#318)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker.ref | 55 +++++++++++++++---------- src/compiler/Desugaring-UnCondition.ref | 6 +-- src/compiler/Desugaring.ref | 24 ++++++----- src/compiler/Engine.ref | 9 ++-- src/compiler/R5-Parser.ref | 10 ++--- src/compiler/README.md | 6 +-- src/compiler/SR-Parser.sref | 2 +- 7 files changed, 64 insertions(+), 48 deletions(-) diff --git a/src/compiler/Checker.ref b/src/compiler/Checker.ref index ab9da41a..e847be07 100644 --- a/src/compiler/Checker.ref +++ b/src/compiler/Checker.ref @@ -67,7 +67,14 @@ PrepareMessage { DanglingDrive e.Name = '$DRIVE ' e.Name '; drive label for missed function'; NativeOptimizable s.Label e.Name - = 'Function ' e.Name ' can\'t be $' >; + = s.Label + : { + LegacyDrive = '$DRIVE'; + LegacyInline = '$INLINE'; + LegacySpec = '$SPEC'; + } + : e.Keyword + = 'Function ' e.Name ' can\'t be ' e.Keyword; /* Ошибки специализации */ RedefineSpec e.FnName = 'Specialization of function ' e.FnName 'is redefined'; @@ -139,11 +146,11 @@ CheckPseudofunctions { = : e._ (e.Name) e._ = (Error t.SrcPos TaggedPseudofunction s.Tag e.Name); - (Spec t.SrcPos (e.Name) e._) + (LegacySpec t.SrcPos (e.Name) e._) , : e._ (e.Name) e._ = (Error t.SrcPos TaggedPseudofunction Spec e.Name); @@ -216,11 +223,11 @@ CheckSpecs { * Проверка переопределения специализации CheckSpecs-Redefine { e.AST-B - (Spec t.SrcPos1 (e.Name) e.Pattern1) e.AST-M - (Spec t.SrcPos2 (e.Name) e.Pattern2) e.AST-E + (LegacySpec t.SrcPos1 (e.Name) e.Pattern1) e.AST-M + (LegacySpec t.SrcPos2 (e.Name) e.Pattern2) e.AST-E = ; @@ -232,13 +239,13 @@ CheckSpecs-Formats { e.AST = : { True = : { - /* пусто */ = (Spec t.SrcPos (e.Name) e.Pattern); + /* пусто */ = (LegacySpec t.SrcPos (e.Name) e.Pattern); e.Errors = e.Errors; }; @@ -353,7 +360,7 @@ FindVariables { * Проверка, что упоминаемые функции определены CheckSpecs-Functions { e.AST-B - (Spec t.SrcPos1 (e.Name) e.Pattern) e.AST-M + (LegacySpec t.SrcPos1 (e.Name) e.Pattern) e.AST-M (Function t.SrcPos2 s.ScopeClass (e.Name) e.Body) e.AST-E = : { @@ -380,7 +387,7 @@ CheckSpecs-Functions { e.AST-B (Function t.SrcPos1 s.ScopeClass (e.Name) e.Body) e.AST-M - (Spec t.SrcPos2 (e.Name) e.Pattern) e.AST-E + (LegacySpec t.SrcPos2 (e.Name) e.Pattern) e.AST-E = : { True = @@ -404,7 +411,7 @@ CheckSpecs-Functions { : e.AST = ; - e.AST-B (Spec t.SrcPos (e.Name) e.Pattern) e.AST-E + e.AST-B (LegacySpec t.SrcPos (e.Name) e.Pattern) e.AST-E = ; @@ -421,7 +428,8 @@ ValidBodyForSpec { : (s.BoolResult e.Messages) = s.BoolResult e.Messages; - (e.Name) t.Pattern NativeBody e.Code = False (NativeOptimizable Spec e.Name); + (e.Name) t.Pattern NativeBody e.Code + = False (NativeOptimizable LegacySpec e.Name); } ValidBodyForSpec-CheckSentensePattern { @@ -543,11 +551,11 @@ SeparateDefines { (e.Declarations) (Entry t.SrcPos GN-Entry e.Name) = (e.Declarations (Entry t.SrcPos e.Name)); - (e.Declarations) (Inline t.SrcPos s.ScopeClass e.Name) = - (e.Declarations (Inline t.SrcPos e.Name)); + (e.Declarations) (LegacyInline t.SrcPos s.ScopeClass e.Name) = + (e.Declarations (LegacyInline t.SrcPos e.Name)); - (e.Declarations) (Drive t.SrcPos s.ScopeClass e.Name) = - (e.Declarations (Drive t.SrcPos e.Name)); + (e.Declarations) (LegacyDrive t.SrcPos s.ScopeClass e.Name) = + (e.Declarations (LegacyDrive t.SrcPos e.Name)); (e.Declarations) (Intrinsic t.SrcPos s.ScopeClass e.Name) = (e.Declarations (Intrinsic t.SrcPos e.Name)); @@ -587,11 +595,11 @@ FindInvalidDriveInline { /* находим все $DRIVE и $INLINE */ = diff --git a/src/compiler/Desugaring-UnCondition.ref b/src/compiler/Desugaring-UnCondition.ref index 38e8251e..e1de69f7 100644 --- a/src/compiler/Desugaring-UnCondition.ref +++ b/src/compiler/Desugaring-UnCondition.ref @@ -460,8 +460,8 @@ UnCondition-Sentence { ) ) ) - (Drive e.CheckFunction) - (Spec e.CheckFunction) + (GROUP Drives (e.CheckFunction)) + (GROUP Specs (e.CheckFunction)) t.CheckFunction e.OpenEFunctions; } @@ -543,7 +543,7 @@ MakeOpenE-ForwardNext { ((e.T1) ((CallBrackets (Symbol Name e.NextName) e.T2))) ((e.T3) ((CallBrackets (Symbol Name e.ContName) e.T4))) ) - (Drive e.CurrentForwardName) + (GROUP Drives (e.CurrentForwardName)) (Function (e.NextName) Sentences ( (e.T5) diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index dc548fcf..bf7d2d9b 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -42,7 +42,7 @@ $ENTRY Pass-RemovePos { (NativeBlock t.SrcPos e.Code) = (NativeBlock t.SrcPos e.Code); - (Spec t.SrcPos (e.Name) e.Pattern) = (Spec e.Name); + (LegacySpec t.SrcPos (e.Name) e.Pattern) = (LegacySpec e.Name); (s.EnumSwapDeclaration t.SrcPos s.ScopeClass e.Name) = (s.EnumSwapDeclaration s.ScopeClass e.Name); @@ -159,8 +159,12 @@ $ENTRY Pass-ExtractEntries { = (e.Entries ) (Function (e.Name) e.Body); - (e.Entries) (Drive s.ScopeClass e.Name) = (e.Entries) (Drive e.Name); - (e.Entries) (Inline s.ScopeClass e.Name) = (e.Entries) (Inline e.Name); + (e.Entries) (LegacyDrive s.ScopeClass e.Name) + = (e.Entries) (LegacyDrive e.Name); + + (e.Entries) (LegacyInline s.ScopeClass e.Name) + = (e.Entries) (LegacyInline e.Name); + (e.Entries) (Intrinsic s.ScopeClass e.Name) = (e.Entries) (Intrinsic e.Name); @@ -741,7 +745,7 @@ ExtractNested-Result-Term { (/* нет захваченных переменных */) e.Body^ = e.Body : { - Sentences e.Sentences = (Drive e.ClosureName); + Sentences e.Sentences = (GROUP Drives (e.ClosureName)); NativeBody e.NativeBody = /* нет меток */; } : e.DriveLabelOpt @@ -764,8 +768,8 @@ ExtractNested-Result-Term { e.Sentences > ) - (Drive e.ClosureName) - (Spec e.ClosureName) + (GROUP Drives (e.ClosureName)) + (GROUP Specs (e.ClosureName)) diff --git a/src/compiler/Engine.ref b/src/compiler/Engine.ref index 739ef912..1974e290 100644 --- a/src/compiler/Engine.ref +++ b/src/compiler/Engine.ref @@ -436,16 +436,17 @@ PatchAST-Item { s.FnPatch (Include t.SrcPos e.IncludeName) = /* пропускаем */; s.FnPatch (s.Label t.SrcPos s.ScopeClass e.Name) - , Enum Swap Declaration Entry Inline Drive Intrinsic Meta : e._ s.Label e._ + , Enum Swap Declaration Entry LegacyInline LegacyDrive Intrinsic Meta + : e._ s.Label e._ = (s.Label s.ScopeClass ); - s.FnPatch (Spec t.SrcPos (e.Name) e.Pattern) + s.FnPatch (LegacySpec t.SrcPos (e.Name) e.Pattern) = ( - Spec () + LegacySpec () ); } @@ -620,7 +621,7 @@ CreateMetaFunctions { = (e.FunctionNames (e.Name)) (Declaration t.SrcPos GN-Entry '__Meta_' e.Name) (Declaration t.SrcPos GN-Entry '__Step-Drop') - (Inline t.SrcPos s.ScopeClass e.Name) + (LegacyInline t.SrcPos s.ScopeClass e.Name) (Function t.SrcPos s.ScopeClass (e.Name) Sentences ( diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index 00140f19..4b610724 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -16,7 +16,7 @@ $EXTERN EL-AddErrorAt, EL-AddWarningAt; t.Include ::= (Include t.Pos e.Name) t.NativeBlock ::= (NativeBlock t.Pos e.Code) t.Ident ::= (Ident t.SrcPos e.Name) - t.SpecUnit = (Spec t.Pos (e.Name) e.Pattern) + t.SpecUnit = (LegacySpec t.Pos (e.Name) e.Pattern) t.Function ::= (Function t.SrcPos s.ScopeClass (e.Name) e.Body) e.Body ::= Sentences t.Sentence* | NativeBody t.Pos e.Code @@ -208,11 +208,11 @@ TkEntryL { } TkInline { - t.Pos e.Name = (Inline t.Pos GN-Local e.Name) + t.Pos e.Name = (LegacyInline t.Pos GN-Local e.Name) } TkDrive { - t.Pos e.Name = (Drive t.Pos GN-Local e.Name) + t.Pos e.Name = (LegacyDrive t.Pos GN-Local e.Name) } TkMeta { @@ -306,7 +306,7 @@ Include { == t.ErrorList (t.SpecUnit) e.Tokens - t.SpecUnit = (Spec t.Pos (e.Name) e.Pattern) + t.SpecUnit = (LegacySpec t.Pos (e.Name) e.Pattern) */ @@ -316,7 +316,7 @@ Specialization { : t.ErrorList^ (e.Pattern) e.Tokens^ = : t.ErrorList^ e.Tokens^ - = t.ErrorList ((Spec t.Pos (e.Name) e.Pattern)) e.Tokens; + = t.ErrorList ((LegacySpec t.Pos (e.Name) e.Pattern)) e.Tokens; t.ErrorList s.Mode t.Pos t.Unexpected e.Tokens = diff --git a/src/compiler/README.md b/src/compiler/README.md index 7bdf56b0..b19a1a8b 100644 --- a/src/compiler/README.md +++ b/src/compiler/README.md @@ -135,11 +135,11 @@ | t.NativeBlock | t.Ident | t.SpecUnit t.Extern ::= (Declaration t.Pos GN-Entry e.Name) t.SingleDeclaration ::= (s.SingleDeclarationTag t.Pos s.ScopeClass e.Name) - s.SingleDeclarationTag ::= Enum | Swap | Inline | Drive | Meta + s.SingleDeclarationTag ::= Enum | Swap | LegacyInline | LegacyDrive | Meta t.Include ::= (Include t.Pos e.Name) t.NativeBlock ::= (NativeBlock t.Pos e.Code) t.Ident ::= (Ident t.SrcPos e.Name) - t.SpecUnit ::= (Spec t.Pos (e.Name) e.Pattern) + t.SpecUnit ::= (LegacySpec t.Pos (e.Name) e.Pattern) t.Function ::= (Function t.SrcPos s.ScopeClass (e.Name) e.Body) e.Body ::= @@ -177,7 +177,7 @@ (`(Declaration …)`) всегда имеют область видимости `GN-Extern`. И наоборот, списки `$INLINE` и `$DRIVE` есть только в Рефале-5λ. -Для списков `Inline`, `Drive` и `Meta` тег области видимости всегда +Для списков `LegacyInline`, `LegacyDrive` и `Meta` тег области видимости всегда `GN-Local`, в дерево он добавлен для общности. Подробное описание большинства элементов дерева в проходе 2Б. diff --git a/src/compiler/SR-Parser.sref b/src/compiler/SR-Parser.sref index 77a48f44..3297d556 100644 --- a/src/compiler/SR-Parser.sref +++ b/src/compiler/SR-Parser.sref @@ -162,7 +162,7 @@ ParseSpec { : t.ErrorList^ (e.Pattern) e.Tail^ = : t.ErrorList^ e.Tail^ - = ((#Spec s.LnNum (e.Name) e.Pattern)) t.ErrorList e.Tail; + = ((#LegacySpec s.LnNum (e.Name) e.Pattern)) t.ErrorList e.Tail; t.ErrorList t.Unexpected e.Tail = (/* ничего не генерируем */) From edd0579ef10f0bba9c433db23464a6418f1eee0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 22 Aug 2021 21:41:00 +0300 Subject: [PATCH 153/208] =?UTF-8?q?=D0=9F=D1=81=D0=B5=D0=B2=D0=B4=D0=BE?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8?= =?UTF-8?q?=D0=B8=20\*\$(NO-)=3F(OPT|DRIVE|SPEC)=20(#195,=20#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit После псевдокомментария может следовать любое количество имён, запятых и точек с запятой (знаки пунктуации игнорируются), имя должно быть как минимум одно. --- autotests/opt-tree-no-drive.ref | 19 ++++ autotests/opt-tree-no-opt-misplaced.ref | 15 +++ autotests/opt-tree-no-opt.ref | 15 +++ autotests/opt-tree-no-spec.ref | 16 +++ ...udocomments-error-misplaced.BAD-SYNTAX.ref | 12 --- autotests/pseudocomments-ok-multiline.ref | 2 + autotests/pseudocomments-ok.ref | 4 +- ...seudocomments-warning-classic.WARNING.ref} | 2 +- ...seudocomments-warning-conflict.WARNING.ref | 6 ++ ...seudocomments-warning-dangling.WARNING.ref | 5 + .../pseudocomments-warning-empty.WARNING.ref | 7 ++ ...pseudocomments-warning-lexer1.WARNING.ref} | 4 +- ...pseudocomments-warning-lexer2.WARNING.ref} | 4 +- ...udocomments-warning-multiunit.WARNING.ref} | 2 + ...pseudocomments-warning-syntax.WARNING.ref} | 2 + ...nts-warning-unexpected-format.WARNING.ref} | 2 + src/compiler/Checker.ref | 101 +++++++++++++++++- src/compiler/Config.ref | 3 +- src/compiler/Desugaring.ref | 17 +++ src/compiler/Engine.ref | 27 +++++ src/compiler/Log-AST.ref | 3 + src/compiler/OptTree-Drive.ref | 10 ++ src/compiler/OptTree-Spec.ref | 11 +- src/compiler/OptTree.ref | 2 + src/compiler/ParseCmdLine.ref | 3 + src/compiler/R5-Lexer.ref | 43 +------- src/compiler/R5-Parser.ref | 96 ++++++++++++++--- 27 files changed, 359 insertions(+), 74 deletions(-) create mode 100644 autotests/opt-tree-no-drive.ref create mode 100644 autotests/opt-tree-no-opt-misplaced.ref create mode 100644 autotests/opt-tree-no-opt.ref create mode 100644 autotests/opt-tree-no-spec.ref delete mode 100644 autotests/pseudocomments-error-misplaced.BAD-SYNTAX.ref rename autotests/{pseudocomments-warnings-classic.WARNING.ref => pseudocomments-warning-classic.WARNING.ref} (88%) create mode 100644 autotests/pseudocomments-warning-conflict.WARNING.ref create mode 100644 autotests/pseudocomments-warning-dangling.WARNING.ref create mode 100644 autotests/pseudocomments-warning-empty.WARNING.ref rename autotests/{pseudocomments-warning-extended.WARNING.ref => pseudocomments-warning-lexer1.WARNING.ref} (50%) rename autotests/{pseudocomments-error-lexer.BAD-SYNTAX.ref => pseudocomments-warning-lexer2.WARNING.ref} (56%) rename autotests/{pseudocomments-error-multiunit.BAD-SYNTAX.ref => pseudocomments-warning-multiunit.WARNING.ref} (75%) rename autotests/{pseudocomments-error-syntax.BAD-SYNTAX.ref => pseudocomments-warning-syntax.WARNING.ref} (78%) rename autotests/{pseudocomments-error-semantics.BAD-SYNTAX.ref => pseudocomments-warning-unexpected-format.WARNING.ref} (78%) diff --git a/autotests/opt-tree-no-drive.ref b/autotests/opt-tree-no-drive.ref new file mode 100644 index 00000000..4c8489c4 --- /dev/null +++ b/autotests/opt-tree-no-drive.ref @@ -0,0 +1,19 @@ +* TREE + +$ENTRY Go { + /* empty */ = /* empty */; + + X = ; +} + +*$NODRIVE Test, Double + +Test { + '*' e.Count (e.Acc) = )>; + + /* empty */ (e.Acc) = e.Acc; +} + +Double { + (e.Acc) = (e.Acc) (e.Acc) +} diff --git a/autotests/opt-tree-no-opt-misplaced.ref b/autotests/opt-tree-no-opt-misplaced.ref new file mode 100644 index 00000000..2b6a19f5 --- /dev/null +++ b/autotests/opt-tree-no-opt-misplaced.ref @@ -0,0 +1,15 @@ +* TREE + +$ENTRY Go { + /* empty */ = /* empty */; + + X = ; +} + +Test { + '*' e.Count (e.Acc) = ; + +*$NOOPT Test + + /* empty */ (e.Acc) = e.Acc; +} diff --git a/autotests/opt-tree-no-opt.ref b/autotests/opt-tree-no-opt.ref new file mode 100644 index 00000000..8ddcd463 --- /dev/null +++ b/autotests/opt-tree-no-opt.ref @@ -0,0 +1,15 @@ +* TREE + +$ENTRY Go { + /* empty */ = /* empty */; + + X = ; +} + +*$NOOPT Test + +Test { + '*' e.Count (e.Acc) = ; + + /* empty */ (e.Acc) = e.Acc; +} diff --git a/autotests/opt-tree-no-spec.ref b/autotests/opt-tree-no-spec.ref new file mode 100644 index 00000000..672f74ce --- /dev/null +++ b/autotests/opt-tree-no-spec.ref @@ -0,0 +1,16 @@ +* TREE + +$ENTRY Go { + /* empty */ = /* empty */; + + X = ; +} + +*$NODRIVE Test +*$NOSPEC Test + +Test { + '*' e.Count (e.Acc) = ; + + /* empty */ (e.Acc) = e.Acc; +} diff --git a/autotests/pseudocomments-error-misplaced.BAD-SYNTAX.ref b/autotests/pseudocomments-error-misplaced.BAD-SYNTAX.ref deleted file mode 100644 index f3cc880f..00000000 --- a/autotests/pseudocomments-error-misplaced.BAD-SYNTAX.ref +++ /dev/null @@ -1,12 +0,0 @@ -*$EXTENDED; - -Func { - s.Stat (s.Dyn) = s.Stat s.Dyn; -*$SPEC Func s.STAT (s.dyn); -} - -$ENTRY Go { - /* empty */ - = : 'ab' - = /* empty */ -} diff --git a/autotests/pseudocomments-ok-multiline.ref b/autotests/pseudocomments-ok-multiline.ref index d4632b76..b9d4bca3 100644 --- a/autotests/pseudocomments-ok-multiline.ref +++ b/autotests/pseudocomments-ok-multiline.ref @@ -1,3 +1,5 @@ +* NO-WARNINGS + *$EXTENDED; *$DRIVE Foo, diff --git a/autotests/pseudocomments-ok.ref b/autotests/pseudocomments-ok.ref index 0511c2c5..b63cbcae 100644 --- a/autotests/pseudocomments-ok.ref +++ b/autotests/pseudocomments-ok.ref @@ -1,6 +1,8 @@ +* NO-WARNINGS + *$EXTENDED; -*$SPEC Func s.STAT (s.dyn); +*$SPEC Func;,;,; Func { s.Stat (s.Dyn) = s.Stat s.Dyn; diff --git a/autotests/pseudocomments-warnings-classic.WARNING.ref b/autotests/pseudocomments-warning-classic.WARNING.ref similarity index 88% rename from autotests/pseudocomments-warnings-classic.WARNING.ref rename to autotests/pseudocomments-warning-classic.WARNING.ref index a87d9301..ef00f607 100644 --- a/autotests/pseudocomments-warnings-classic.WARNING.ref +++ b/autotests/pseudocomments-warning-classic.WARNING.ref @@ -1,4 +1,4 @@ -* WARNING ignored-pseudocomments +* WARNING pseudocomment *$CLASSIC; diff --git a/autotests/pseudocomments-warning-conflict.WARNING.ref b/autotests/pseudocomments-warning-conflict.WARNING.ref new file mode 100644 index 00000000..0e11891f --- /dev/null +++ b/autotests/pseudocomments-warning-conflict.WARNING.ref @@ -0,0 +1,6 @@ +* WARNING pseudocomment + +*$SPEC S; +*$NOSPEC S; + +$ENTRY S { = } diff --git a/autotests/pseudocomments-warning-dangling.WARNING.ref b/autotests/pseudocomments-warning-dangling.WARNING.ref new file mode 100644 index 00000000..c8085611 --- /dev/null +++ b/autotests/pseudocomments-warning-dangling.WARNING.ref @@ -0,0 +1,5 @@ +* WARNING pseudocomment + +*$OPT Undefined; + +$ENTRY Go { = } diff --git a/autotests/pseudocomments-warning-empty.WARNING.ref b/autotests/pseudocomments-warning-empty.WARNING.ref new file mode 100644 index 00000000..a539a6b9 --- /dev/null +++ b/autotests/pseudocomments-warning-empty.WARNING.ref @@ -0,0 +1,7 @@ +* WARNING pseudocomment + +*$OPT + +$ENTRY Test { + /* empty */ = /* empty */ +} diff --git a/autotests/pseudocomments-warning-extended.WARNING.ref b/autotests/pseudocomments-warning-lexer1.WARNING.ref similarity index 50% rename from autotests/pseudocomments-warning-extended.WARNING.ref rename to autotests/pseudocomments-warning-lexer1.WARNING.ref index b5bcdd0a..88845330 100644 --- a/autotests/pseudocomments-warning-extended.WARNING.ref +++ b/autotests/pseudocomments-warning-lexer1.WARNING.ref @@ -1,8 +1,8 @@ -* WARNING nul-in-compound +* WARNING pseudocomment *$EXTENDED; -*$SPEC Func s.STAT "ABC\x00DEF" s.dyn; +*$SPEC Func "unclosed quote; $ENTRY Func { s.Stat ABC s.Dyn = s.Stat s.Dyn; diff --git a/autotests/pseudocomments-error-lexer.BAD-SYNTAX.ref b/autotests/pseudocomments-warning-lexer2.WARNING.ref similarity index 56% rename from autotests/pseudocomments-error-lexer.BAD-SYNTAX.ref rename to autotests/pseudocomments-warning-lexer2.WARNING.ref index 765a8e8b..52d84d4c 100644 --- a/autotests/pseudocomments-error-lexer.BAD-SYNTAX.ref +++ b/autotests/pseudocomments-warning-lexer2.WARNING.ref @@ -1,6 +1,8 @@ +* WARNING pseudocomment + *$EXTENDED; -*$SPEC Func s.STAT 'unclosed quote; +*$SPEC Func "ABC\x00DEF"; $ENTRY Func { s.Stat ABC s.Dyn = s.Stat s.Dyn; diff --git a/autotests/pseudocomments-error-multiunit.BAD-SYNTAX.ref b/autotests/pseudocomments-warning-multiunit.WARNING.ref similarity index 75% rename from autotests/pseudocomments-error-multiunit.BAD-SYNTAX.ref rename to autotests/pseudocomments-warning-multiunit.WARNING.ref index ea01d08e..26c7f5d1 100644 --- a/autotests/pseudocomments-error-multiunit.BAD-SYNTAX.ref +++ b/autotests/pseudocomments-warning-multiunit.WARNING.ref @@ -1,3 +1,5 @@ +* WARNING pseudocomment + *$EXTENDED; *$DRIVE D; $INLINE F; diff --git a/autotests/pseudocomments-error-syntax.BAD-SYNTAX.ref b/autotests/pseudocomments-warning-syntax.WARNING.ref similarity index 78% rename from autotests/pseudocomments-error-syntax.BAD-SYNTAX.ref rename to autotests/pseudocomments-warning-syntax.WARNING.ref index 2fb61167..482e3798 100644 --- a/autotests/pseudocomments-error-syntax.BAD-SYNTAX.ref +++ b/autotests/pseudocomments-warning-syntax.WARNING.ref @@ -1,3 +1,5 @@ +* WARNING pseudocomment + *$EXTENDED; *$SPEC Func s.STAT (s.dyn; diff --git a/autotests/pseudocomments-error-semantics.BAD-SYNTAX.ref b/autotests/pseudocomments-warning-unexpected-format.WARNING.ref similarity index 78% rename from autotests/pseudocomments-error-semantics.BAD-SYNTAX.ref rename to autotests/pseudocomments-warning-unexpected-format.WARNING.ref index 34184a5e..995e384e 100644 --- a/autotests/pseudocomments-error-semantics.BAD-SYNTAX.ref +++ b/autotests/pseudocomments-warning-unexpected-format.WARNING.ref @@ -1,3 +1,5 @@ +* WARNING pseudocomment + *$EXTENDED; *$SPEC Func (s.STAT) s.dyn; diff --git a/src/compiler/Checker.ref b/src/compiler/Checker.ref index e847be07..7868c10d 100644 --- a/src/compiler/Checker.ref +++ b/src/compiler/Checker.ref @@ -126,6 +126,15 @@ PrepareMessage { IntrinsicForDefined e.Name = 'Function ' e.Name ' is defined, ' '$INTRINSIC declaration for it will be ignored'; + + OptFeaturesConflict s.Label1 s.Label2 e.Name + = 'Conflict between pseudocomments ' + '$' > ' ' e.Name '; and ' + '$' > ' ' e.Name ';, ' + '$NO... pseudocomment has priority'; + + DanglingOptPseudocomment s.Label e.Name + = '$' > ' ' e.Name '; label for missed function'; } FindErrors { @@ -146,7 +155,9 @@ CheckPseudofunctions { = : e._ (e.Name) e._ = (Error t.SrcPos TaggedPseudofunction s.Tag e.Name); @@ -557,6 +568,15 @@ SeparateDefines { (e.Declarations) (LegacyDrive t.SrcPos s.ScopeClass e.Name) = (e.Declarations (LegacyDrive t.SrcPos e.Name)); + (e.Declarations) (s.OptNode t.SrcPos e.Name) + , (Opt Drive Spec Yes) (Drive Drive Yes) (Spec Spec Yes) + (NoOpt Drive Spec No) (NoDrive Drive No) (NoSpec Spec No) + : e._ (s.OptNode e.Features s.Enable) e._ + = ( + e.Declarations + (Opt s.OptNode (e.Features) s.Enable t.SrcPos e.Name) + ); + (e.Declarations) (Intrinsic t.SrcPos s.ScopeClass e.Name) = (e.Declarations (Intrinsic t.SrcPos e.Name)); @@ -585,6 +605,9 @@ CheckDeclarations { &CheckRedefinitions &FindFinalInitEntry &CheckIntrinsics + &CheckConflictOptPseudocomments + &CleanupValidOptPseudocomments + &CheckDanglingOptPseudocomments > > } @@ -804,6 +827,82 @@ CheckIntrinsics { e.Declarations = e.Declarations; } +CheckConflictOptPseudocomments { + e.Declarations-B + (Opt s.OptNode1 (e.Feat1-B s.Feature e.Feat1-E) Yes t.YesPos e.Name) + e.Declarations-M + (Opt s.OptNode2 (e.Feat2-B s.Feature e.Feat2-E) No t.NoPos e.Name) + e.Declarations-E + = ; + + e.Declarations-B + (Opt s.OptNode1 (e.Feat1-B s.Feature e.Feat1-E) No t.NoPos e.Name) + e.Declarations-M + (Opt s.OptNode2 (e.Feat2-B s.Feature e.Feat2-E) Yes t.YesPos e.Name) + e.Declarations-E + = ; + + e.Declarations-B (Opt s._ () Yes t._ e._) e.Declarations-E + = ; + + e.Declarations = e.Declarations; +} + +CleanupValidOptPseudocomments { + e.Declarations-B + (Opt s.OptNode (e.Features) s.Enable t.OptPos e.Name) e.Declarations-M + (Define t.SrcPos s.ScopeClass e.Name) e.Declarations-E + = ; + + e.Declarations-B + (Define t.SrcPos s.ScopeClass e.Name) e.Declarations-M + (Opt s.OptNode (e.Features) s.Enable t.OptPos e.Name) e.Declarations-E + = ; + + e.Declarations = e.Declarations; +} + +CheckDanglingOptPseudocomments { + e.Declarations + = +} + CheckFunctionBody { (e.Body) = ) e.Body>; diff --git a/src/compiler/Config.ref b/src/compiler/Config.ref index 6228252b..ee9b41dc 100644 --- a/src/compiler/Config.ref +++ b/src/compiler/Config.ref @@ -20,6 +20,7 @@ $ENTRY Config-Create { (Optimize /* пусто */) (WarningIds nul-in-compound pseudofunctions repeated deprecated intrinsic + pseudocomment ) (WarningIdsAsErrors /* пусто */) (ErrorFile /* пусто */) @@ -533,7 +534,7 @@ ValidWarningId { WarningForName { 'screening' = True screening; 'nul-in-compound' = True nul-in-compound; - 'ignored-pseudocomments' = True ignored-pseudocomments; + 'pseudocomment' = True pseudocomment; 'pseudofunctions' = True pseudofunctions; 'pseudofunction' = True pseudofunctions; /* синоним */ 'repeated' = True repeated; diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index bf7d2d9b..0087d2e5 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -44,6 +44,10 @@ $ENTRY Pass-RemovePos { (LegacySpec t.SrcPos (e.Name) e.Pattern) = (LegacySpec e.Name); + (s.OptMarkup t.SrcPos e.Name) + , Opt Drive Spec NoOpt NoDrive NoSpec : e._ s.OptMarkup e._ + = (s.OptMarkup e.Name); + (s.EnumSwapDeclaration t.SrcPos s.ScopeClass e.Name) = (s.EnumSwapDeclaration s.ScopeClass e.Name); } @@ -812,6 +816,12 @@ Pass-CollectDeclarations { (Intrinsic e.Name) = (GROUP Intrinsics (e.Name)); (LegacySpec e.Name) = (GROUP Specs (e.Name)); + (s.OptMarkup e.Name) + , (Opt Drives Specs) (Drive Drives) (Spec Specs) + (NoOpt NoDrives NoSpecs) (NoDrive NoDrives) (NoSpec NoSpecs) + : e._ (s.OptMarkup e.Groups) e._ + = ; + (Function (e.Name) e.Body) = (GROUP DefinedFunctions (e.Name)) (Function (e.Name) e.Body); @@ -828,6 +838,8 @@ Pass-CollectDeclarations { (GROUP Inlines) (GROUP Intrinsics) (GROUP Specs) + (GROUP NoDrives) + (GROUP NoSpecs) (GROUP DefinedFunctions) > : e.AST^ @@ -836,6 +848,8 @@ Pass-CollectDeclarations { (GROUP Inlines e.Inlines) (GROUP Intrinsics e.Intrinsics) (GROUP Specs e.Specs) + (GROUP NoDrives e.NoDrives) + (GROUP NoSpecs e.NoSpecs) (GROUP DefinedFunctions e.DefinedFunctions) = : e.Externs^ @@ -843,6 +857,8 @@ Pass-CollectDeclarations { = : e.Inlines^ = : e.Intrinsics^ = : e.Specs^ + = : e.NoDrives^ + = : e.NoSpecs^ = : e.Externs^ = : e.Inlines^ @@ -851,6 +867,7 @@ Pass-CollectDeclarations { = (Externs e.Externs) (Drives e.Drives) (Inlines e.Inlines) (Intrinsics e.Intrinsics) (Specs e.Specs) + (NoDrives e.NoDrives) (NoSpecs e.NoSpecs) e.AST } diff --git a/src/compiler/Engine.ref b/src/compiler/Engine.ref index 1974e290..13d1f0a3 100644 --- a/src/compiler/Engine.ref +++ b/src/compiler/Engine.ref @@ -444,6 +444,10 @@ PatchAST-Item { ); + s.FnPatch (s.Label t.SrcPos e.Name) + , Opt Drive Spec NoOpt NoDrive NoSpec : e._ s.Label e._ + = (s.Label ); + s.FnPatch (LegacySpec t.SrcPos (e.Name) e.Pattern) = ( LegacySpec () @@ -730,6 +734,8 @@ $ENTRY GlobalASTStorage-AddAST { > : ((e.NewEntries) (e.Locals)) e.AST^ + = : e.AST^ + = : e.Locals^ = e.NewEntries e.Entries : e.Entries^ @@ -766,6 +772,27 @@ UpdateAccum { = ((e.Entries) (e.Locals (e.Name t.SrcPos))); } +CleanupUndefinedOpts { + (e.Entries) (e.Locals) e.AST + = : e.Entries^ + = : e.Locals^ + = : e.Defined + = +} + CleanupLocals { e.Locals-B (e.Name t._) e.Locals-E (e.Entries) , e.Entries : e._ ((e.Name) t.SrcPos) e._ diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index 47279865..084353e0 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -41,6 +41,9 @@ Element { (Specs e.Names) = ; + (NoDrives e.Names) = ; + (NoSpecs e.Names) = ; + (DriveInfo e.DriveInfo) = ('(DriveInfo ...)'); (SpecInfo e.SpecInfo) = ('(SpecInfo ...)'); } diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index 593b5df6..d269318e 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -81,10 +81,20 @@ UpdateDriveInfo { = : (e.Drives) e.AST^ = : (e.DrivesI) e.AST^ = : (e.Intrinsics) e.AST^ + = e.AST + : { + e.AST-B (NoDrives e.Names) e.AST-E + = (e.Names) e.AST-B (NoDrives e.Names) e.AST-E; + + e.AST^ = (/* пусто */) e.AST; + } + : (e.NoDrives) e.AST^ + = : e.NoDrives^ = e.Drives e.DrivesI : e.Drives^ = : e.KnownNames^ + = : e.Drives^ = : e.Drives^ = : e.Intrinsics^ diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index a411e30c..ed940660 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -56,10 +56,19 @@ Prepare-Aux { } : (e.NewNames) e.AST^ + = e.AST + : { + e.AST-B (NoSpecs e.Names) e.AST-E + = (e.Names) e.AST-B (NoSpecs e.Names) e.AST-E; + e.AST^ = (/* пусто */) e.AST; + } + : (e.NoSpecs) e.AST^ + = ; - Extended (TkPseudoComment t.Pos e.CommentTokens) e.Tokens - = - : (e.Messages) e.CommentTokens^ - = (TkPseudoComment t.Pos e.CommentTokens) - e.Messages - ; - Extended t.NextToken e.Tokens = t.NextToken ; @@ -88,13 +72,6 @@ CheckClassicTokens { = e.MaybeError (TkVariable t.Pos s.Mode e.Index) ; - Classic (TkPseudoComment t.Pos e.CommentTokens) e.Tokens - = (TkWarning - t.Pos ignored-pseudocomments - 'Pseudocomments are ignored in classic mode' - ) - ; - Classic t.NextToken e.Tokens = t.NextToken ; @@ -166,17 +143,17 @@ DoScan-GEN { 1) e.Lines>; (RowCol s.Line 1) ('*$' e.Comment) e.Lines - , + = : { - True + 'Lu' e.Comment^ = : (e.CommentLines) e.Lines^ - = (' $' e.Comment) e.CommentLines : e.CommentLines^ + = (' ' e.Comment) e.CommentLines : e.CommentLines^ = : s.Count e.CommentLines^ = : e.CommentTokens = (TkPseudoComment (RowCol s.Line 1) e.CommentTokens) 1) e.Lines>; - False = 1) e.Lines>; + e._ = 1) e.Lines>; }; (RowCol s.Line 1) ('*' e.Comment) e.Lines @@ -557,18 +534,6 @@ DoScan-Compound-HandleEscape { e.Lines>; } -ValidPseudocomment { - e.Keyword s.Space e._ - , : True - = ; - - e.Keyword = ; -} - -ValidPseudocomment-Keyword { - e.Keyword = ; -} - CollectPseudocommentLines { e.Lines = ; } diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index 4b610724..b3b68d7e 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -1,3 +1,6 @@ +$INCLUDE "LibraryEx"; + + *$FROM Error $EXTERN EL-AddErrorAt, EL-AddWarningAt; @@ -56,7 +59,84 @@ $ENTRY R5-Parse { */ Program { t.ErrorList s.Mode e.Tokens - = ; + = + : t.ErrorList^ (e.PseudocommentUnits) e.Tokens^ + = + e.PseudocommentUnits +} + +ScanPseudocomments { + t.ErrorList e.Tokens + = +} + +DoScanPseudocomments { + t.ErrorList (e.Units) (e.Scanned) + e.Tokens-B (TkPseudoComment t.Pos e.CommentTokens) e.Tokens-E + = + : t.ErrorList^ e.NewUnits + = ; + + t.ErrorList (e.Units) (e.Scanned) e.Tokens + = t.ErrorList (e.Units) e.Scanned e.Tokens; +} + +ParsePseudocomment { + t.ErrorList t.Pos (TkName t._ e.Name) e.Tokens + , Opt Drive Spec NoOpt NoDrive NoSpec : e._ s.Node e._ + , > : e.Name + = ; + + t.ErrorList t.Pos e._unrecognized + = t.ErrorList /* пропускаем неопознанный псевдокомментарий */; +} + +ParseOptPseudocomment { + t.Pos s.Node (e.Scanned) t.ErrorList + (TkName t.NamePos e.Name) e.Tokens + = ; + + t.Pos s.Node (e.Scanned) t.ErrorList (s.Separator t._) e.Tokens + , TkComma TkSemicolon : e._ s.Separator e._ + = ; + + t.Pos s.Node (/* нет имён */) t.ErrorList (TkEOF t._) + = ; + + t.Pos s.Node (e.Scanned) t.ErrorList (TkEOF t._) = t.ErrorList e.Scanned; + + t.Pos s.Node (e.Scanned) t.ErrorList (TkError t.ErrPos e.Message) e.Tokens + = + e.Tokens + >; + + t.Pos s.Node (e.Scanned) t.ErrorList (TkWarning t.WarnPos s.Type e.Message) + e.Tokens + = + e.Tokens + >; + + t.Pos s.Node (e.Scanned) t.ErrorList t.Unexpected e.Tokens + = t.Unexpected : (s.Type t.TokPos e.Value) + = ', expected name, comma or semicolon' + > + e.Tokens + >; } DoProgram { @@ -88,7 +168,6 @@ UnexpectedUnitToken { UnitStartToken { = TkEntry TkName TkSemicolon TkInclude TkNativeCode TkSpec - TkPseudoComment; } NameListTags { @@ -139,19 +218,6 @@ Unit { , : True = ; - (TkPseudoComment t.Pos e.CommentTokens) - = - : { - t.ErrorList^ (e.Units) (TkEOF t._) - = t.ErrorList (e.Units) e.Tokens; - - t.ErrorList^ (e.Units) (s.Token t.Pos^ e.Info) e._ - = - (/* no units */) e.Tokens; - }; - t.Unexpected = e.Tokens; }; } From e67a80e65d775092591e3a084b5a3e809b96c134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 22 Aug 2021 23:15:16 +0300 Subject: [PATCH 154/208] =?UTF-8?q?=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20*$NOOPT=20=D0=B2?= =?UTF-8?q?=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20gen=5Fe=5F=5F=20=D0=B2=C2=A0?= =?UTF-8?q?=D0=BD=D0=B5=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D1=85=20=D0=BC?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=B0=D1=85=20(#332,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Engine.ref | 9 +- src/compiler/GST.ref | 10 +- src/compiler/GenericMatch.ref | 159 +++++++----------- .../HighLevelRASL-GenResult-Simple.ref | 10 +- src/compiler/HighLevelRASL-GenSubst-Save.ref | 12 +- .../HighLevelRASL-GenSubst-Simple.ref | 12 +- src/compiler/R5-Lexer.ref | 8 +- src/compiler/R5-Parser.ref | 19 +-- 8 files changed, 86 insertions(+), 153 deletions(-) diff --git a/src/compiler/Engine.ref b/src/compiler/Engine.ref index 13d1f0a3..b5f5c2e6 100644 --- a/src/compiler/Engine.ref +++ b/src/compiler/Engine.ref @@ -201,14 +201,9 @@ LoadAST { } } -ResolveIncludes { - t.Config (e.BadIncludes) e.Units - = ) > -} +*$NOOPT ResolveIncludes -gen_e__ { e.Arg = e.Arg } - -ResolveIncludes-Gen { +ResolveIncludes { t.Config (e.BadIncludes-B (e.IncludeName) e.BadIncludes-E) e.Units-B ( diff --git a/src/compiler/GST.ref b/src/compiler/GST.ref index 914fbf79..bd7a36a6 100644 --- a/src/compiler/GST.ref +++ b/src/compiler/GST.ref @@ -72,15 +72,13 @@ TileCandidates { { (e.AlignedPattern t.Last) (t.First e.AlignedResult) = ) - () (e.AlignedResult) + (e.AlignedPattern) (t.Last) + (t.First) (e.AlignedResult) >; } >; } -gen_e__ { e.arg = e.arg } - EnumExprs { s.Num (e.ScannedPattern) (t.PatternItem e.Pattern) @@ -155,9 +153,11 @@ DoOverlapOffsets { OverlapChain { (e.Pattern) (e.Result) = - ) ()>>; + >; } +*$NOOPT ZipItems + ZipItems { ((s.CurIndexP t.PatternItem) e.Pattern) ((s.CurIndexR t.ResultItem) e.Result) = diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index f3d61149..d5c62e37 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -82,9 +82,9 @@ $ENTRY Solve-Drive { = : e.Expr^ = ) + (None /* сужения */) (E (e.Expr) ':' (e.Lexpr)) - () + (/* присваивания */) > : { e._ (Generalize (e.Intervals)) e._ = Undefined; @@ -159,7 +159,7 @@ Solve-Spec-DoFindGeneralization { e._ (Generalize (e.Intervals)) e._ = - () () + (e.L) (e.GenAssigns) > : (e.UsedVars^) (e.L^) (e.GenAssigns^) = ) (e.Expr) (e.Assigns) + (e.UsedVars) t.Interval (/* scanned */) (e.Expr) (e.Assigns) > : (e.UsedVars^) (e.Expr^) (e.Assigns^) = ; @@ -448,6 +450,8 @@ SimplifyCoordinates { /* пусто */ = /* пусто */; } +*$NOOPT Solve-Clashes + /* == t.Result* @@ -472,7 +476,7 @@ Solve-Clashes { (e.UsedVars) (e.Contrs) e.ClashesStart e.ClashesEnd - () + (e.Assigns (('{'s.M'}') t.T ('{'s.N'}') ':' (Var 't' e.Index))) >; /* {m} Sym {n} : s.X ↦ {m} Sym {n} ← s.X */ @@ -484,11 +488,7 @@ Solve-Clashes { (e.UsedVars) (e.Contrs) e.ClashesStart e.ClashesEnd - ( - - ) + (e.Assigns (('{'s.M'}') t.Sym ('{'s.N'}') ':' (Var 's' e.Index))) >; /* {m} #var {n} : s.X ↦ нет решений */ @@ -749,7 +749,7 @@ Solve-Clashes { = ) + (e.Assigns (e.E ':' (Var 'e' e.Index))) >; /* {m} e.X E {n} : ε ↦ e.X → ε */ @@ -805,14 +805,10 @@ Solve-Clashes { , : True = : (e.Left1) (e.Left2) = - (e.Assigns) + (e.UsedVars) (e.Contrs) e.ClashesStart + (T (e.Left1) ':' (t.Pt)) + (E (e.Left2) ':' (e.P)) + e.ClashesEnd (e.Assigns) >; /* E {m} T {n} : P Pt ↦ E {m} : P && {m} T {n} : Pt */ @@ -824,14 +820,10 @@ Solve-Clashes { , : True = : (e.Left1) (e.Left2) = - (e.Assigns) + (e.UsedVars) (e.Contrs) e.ClashesStart + (E (e.Left1) ':' (e.P)) + (T (e.Left2) ':' (t.Pt)) + e.ClashesEnd (e.Assigns) >; /* {m} e.X E {n} : Pt P ↦ e.X → t.NEW1 e.NEW2 || e.X → ε */ @@ -847,25 +839,17 @@ Solve-Clashes { : (e.Left1) (e.Left2) = - (e.Assigns) + (e.Contrs) e.ClashesStart + (T (e.Left1) ':' (t.Pt)) + (E (e.Left2) ':' (e.P)) + e.ClashesEnd (e.Assigns) > : e.Branch1 = - (e.Assigns) + (e.Contrs) e.ClashesStart + (E (('{'s.M'}') e.E ('{'s.N'}')) ':' (t.Pt e.P)) + e.ClashesEnd (e.Assigns) > : e.Branch2 /* @@ -904,25 +888,17 @@ Solve-Clashes { : (e.Left1) (e.Left2) = - (e.Assigns) + (e.Contrs) e.ClashesStart + (E (e.Left1) ':' (e.P)) + (T (e.Left2) ':' (t.Pt)) + e.ClashesEnd (e.Assigns) > : e.Branch1 = - (e.Assigns) + (e.Contrs) e.ClashesStart + (E (('{'s.M'}') e.E ('{'s.N'}')) ':' (e.P t.Pt)) + e.ClashesEnd (e.Assigns) > : e.Branch2 /* См. комментарий в предыдущем предложении. */ @@ -976,7 +952,7 @@ Solve-Clashes { t.Part ':' ((Var 'e' e.OpenIndex) e.P (Var 'e' e.ClosedIndex)) ) - e.ClashesEnd () + e.ClashesEnd (e.Assigns) > } e.Parts @@ -1093,9 +1069,9 @@ SplitLeftPart-Aux { , : True , : True = ) + (e.Begin t.T1) (t.T2 e.Rest) - () + (e.Parts (e.Begin t.T1 ('sp') t.T2 e.Rest)) >; /* Точки разбиения добавляются между двумя смежными термами */ @@ -1103,9 +1079,9 @@ SplitLeftPart-Aux { , : True , : True = ) + (e.Begin t.T1 ('{'s.Coord'}')) (t.T2 e.Rest) - () + (e.Parts (e.Begin t.T1 ('sp' ('{'s.Coord'}')) t.T2 e.Rest)) >; /* Если E заканчивается на терм, то точка разбиения добавляется в конец */ @@ -1116,23 +1092,21 @@ SplitLeftPart-Aux { (e.Begin) (t.T e.Rest) (e.Parts) , : True = ) - (e.Rest) - (e.Parts) + (e.Begin t.T) (e.Rest) (e.Parts) >; /* Точки разбиения находятся «внутри» e-параметров */ (e.Begin) (t.eX e.Rest) (e.Parts) , t.eX : (Var 'e' e.XIndex) = ) + (e.Begin t.eX) (e.Rest) - () + (e.Parts (e.Begin ('sp' t.eX) e.Rest)) >; (e.Begin) (('{'s.Coord'}') e.Rest) (e.Parts) = ) + (e.Begin ('{'s.Coord'}')) (e.Rest) (e.Parts) >; @@ -1161,8 +1135,8 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = - () + (E (('{'s.M'}') e.E ('{'s.N'}')) ':' (e.P t.eY)) e.ClashesEnd + (e.Assigns (/* пусто */ ':' t.eX)) >; * {k} E1 T2 {m} T3 E4 {n} : e.X P e.Y ↦ {k} E1 T2 {m} ← e.X, @@ -1183,10 +1157,8 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = - () + (E (('{'s.M'}') t.T3 e.E4 ('{'s.N'}')) ':' (e.P t.eY)) e.ClashesEnd + (e.Assigns (('{'s.K'}') e.E1 t.T2 ('{'s.M'}') ':' t.eX)) >; * E1 {m} E2* T3 . T4 E5* {n} E6 : e.X P e.Y ↦ E1 {m} E2* T3 {n} ← e.X, @@ -1209,11 +1181,9 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = - () + (E (('{'s.M'}') t.T4 e.E5 ('{'s.N'}') e.E6) ':' (e.P t.eY)) + e.ClashesEnd + (e.Assigns (e.E1 ('{'s.M'}') e.E2 t.T3 ('{'s.N'}') ':' t.eX)) >; * {m} E {n} : e.X P e.Y ↦ {m} E {n} ← e.X, ε : P e.Y @@ -1228,8 +1198,8 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = - () + (E (/* пусто */) ':' (e.P t.eY)) e.ClashesEnd + (e.Assigns (('{'s.M'}') e.E ('{'s.N'}') ':' t.eX)) >; * ε : e.X P e.Y ↦ ε ← e.X, ε : P e.Y @@ -1241,8 +1211,8 @@ SplitSolve { , t.eY : (Var 'e' e.YIndex) = - () + (E (/* пусто */) ':' (e.P t.eY)) e.ClashesEnd + (e.Assigns (/* пусто */ ':' t.eX)) >; * E1 e.X {m} e.Y E2 : e.L P e.R ↦ e.X → e.NEW1! t.NEW2 e.NEW3, @@ -1269,14 +1239,12 @@ SplitSolve { - () + (E + (('{'s.N'}') t.tNew2 t.eNew3 ('{'s.M'}') t.eY e.E2) + ':' (e.P t.eR) + ) + e.ClashesEnd + (e.Assigns (e.E1 t.eNew1 ('{'s.M'}') ':' t.eL)) > >; @@ -1304,8 +1272,8 @@ SplitSolve { - () + (E (('{'s.N'}') t.eNew2 e.E2) ':' (e.P t.eR)) e.ClashesEnd + (e.Assigns (e.E1 t.eNew1 ('{'s.M'}') ':' t.eL)) > >; } @@ -1524,7 +1492,7 @@ Solve-SymmClashes { (e.UsedVars) (e.Contrs) e.SymmClashes (e.Assigns) = : e.SymmClashes^ = ) e.SymmClashes (e.Assigns) + (e.UsedVars) (e.Contrs) e.SymmClashes (e.Assigns) >; } @@ -1534,6 +1502,8 @@ MinMode { ('e' e.Index) ('e' e._) = 'e' e.Index; } +*$NOOPT Solve-SymmClashes-Aux + Solve-SymmClashes-Aux { /* {a} u.X {b} = {c} v.Y {d} ↦ u.X → w.NEW, v.Y → w.NEW, w = min(u,v) */ (e.UsedVars) (e.Contrs) e.ClashesStart @@ -2200,6 +2170,7 @@ AddContraction-Spec-Symm { t._ = s.OpenFlag; } : s.OpenFlag^ + = : t.toAdd^ = (s.OpenFlag e.Contrs t.toAdd) (e.Assigns); diff --git a/src/compiler/HighLevelRASL-GenResult-Simple.ref b/src/compiler/HighLevelRASL-GenResult-Simple.ref index f422ae57..08db9b90 100644 --- a/src/compiler/HighLevelRASL-GenResult-Simple.ref +++ b/src/compiler/HighLevelRASL-GenResult-Simple.ref @@ -75,17 +75,9 @@ GenResult { >; } -gen_e__ { e.arg = e.arg } +*$NOOPT DoGenResult DoGenResult { - (e.Vars) (e.AllocCommands) (e.Commands) s.Counter e.Result - = ) () - s.Counter e.Result - >; -} - -DoGenResult-GEN { (e.Vars) (e.AllocCommands) (e.Commands) s.Counter (TkOpenCallCond s.Offset) e.Result = ; } -DoGenSubst { - s.ContextOffset e.Substitutes (e.Vars) (e.Commands) - = () - () - > -} +*$NOOPT DoGenSubst -gen_e__ { e.arg = e.arg } - -DoGenSubst-GEN { +DoGenSubst { /* Распознавание T-подстановки */ s.ContextOffset e.Substs-B diff --git a/src/compiler/HighLevelRASL-GenSubst-Simple.ref b/src/compiler/HighLevelRASL-GenSubst-Simple.ref index 383ce109..ca1c1c46 100644 --- a/src/compiler/HighLevelRASL-GenSubst-Simple.ref +++ b/src/compiler/HighLevelRASL-GenSubst-Simple.ref @@ -23,17 +23,9 @@ $ENTRY GenSubst-Simple { >; } -DoGenSubst { - s.ContextOffset e.Substitutes (e.Vars) (e.Commands) - = () - () - > -} +*$NOOPT DoGenSubst -gen_e__ { e.arg = e.arg } - -DoGenSubst-GEN { +DoGenSubst { /* Распознавание T-подстановки */ s.ContextOffset e.Substs-B diff --git a/src/compiler/R5-Lexer.ref b/src/compiler/R5-Lexer.ref index e55bfc0c..8ab7ec93 100644 --- a/src/compiler/R5-Lexer.ref +++ b/src/compiler/R5-Lexer.ref @@ -98,13 +98,9 @@ IncCol { = (RowCol s.Line <+ s.Col s.Len>); } -gen_e__ { e.arg = e.arg } +*$NOOPT DoScan DoScan { - t.Pos e.Lines = > -} - -DoScan-GEN { t.Pos = (TkEOF t.Pos); t.Pos (' ' e.Line) e.Lines = (e.Line) e.Lines>; @@ -178,7 +174,7 @@ DoScan-GEN { = (e.Line) e.Lines>; t.Pos ('/*' e.Line) e.Lines - = ) (e.Line) e.Lines>; + = ; t.Pos ('\"' e.Line) e.Lines = () (e.Line) e.Lines>; diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index b3b68d7e..d5270416 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -593,9 +593,11 @@ SentenceTail { CheckExceedBlocks { t.ErrorList s.Mode e.ExceedBlocks - = ) e.ExceedBlocks>; + = ; } +*$NOOPT DoCheckExceedBlocks + DoCheckExceedBlocks { s.Mode t.ErrorList (e.ScannedBlocks) (t.Pos e.Body) e.RestBlocks = @@ -699,11 +701,13 @@ Pattern { Result { t.ErrorList s.Mode e.Tokens = ) + s.Mode (/* blocks */) >; } +*$NOOPT Result-Blocks + Result-Blocks { s.Mode (e.Blocks) t.ErrorList t.Result (TkRefal5Mode t.ModePos s.NewMode) e.Tokens @@ -768,16 +772,9 @@ TokenChain { = } -gen_e__ { e.arg = e.arg } +*$NOOPT DoTokenChain DoTokenChain { - s.Mode s.Kind t.ErrorList (e.Collected) e.Tokens - = ) - > -} - -DoTokenChain-GEN { s.Mode s.Kind t.ErrorList (e.Collected) t.NextToken e.Tokens = t.NextToken : { @@ -836,14 +833,12 @@ DoTokenChain-GEN { t.ErrorList s.Mode t.Pos 'Identifier expected after \'<\'' > : t.ErrorList^ - = : e.Collected^ = >; (TkOpenCall t.Pos e.FuncName) - = : e.Collected^ = From 15369932fa1977bdfdc09b1a2d62f6acc7ee0100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 22 Aug 2021 23:39:44 +0300 Subject: [PATCH 155/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D1=91=D0=BD=20=D0=BD=D0=B5=D0=B0=D0=BA=D1=82=D1=83=D0=B0=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=BA=D1=83=D1=81=D0=BE=D0=BA=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=D0=B0=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Код стал неактуальным после коммита 855d138e8c, изменившего логику присваиваний при динамическом обобщении (коммит был с ошибками, его исправления d7e729b01 и ff803b5c19). --- src/compiler/GenericMatch.ref | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index d5c62e37..8286dba9 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -274,10 +274,7 @@ DoGeneralize-Rec { (e.UsedVars) ('{' s.A s.B '}') (e.Begin) (e.E1 ('{'s.A'}') e.Inner ('{'s.B'}') e.E2) (e.Assigns) = : s.VarType - = - > - : e.VarVal + = : e.VarVal = : (e.UsedVars^) s.VarType^ e.New = (e.UsedVars) (e.Begin e.E1 ('{'s.A'}') (Var s.VarType e.New) ('{'s.B'}') e.E2) @@ -322,36 +319,6 @@ GetVarType { e.Other = 'e'; } -* TODO: присваивания должны быть параллельными -ApplyAssignments-toExpr { - (t.Assign e.Rest) e.Expr - = - >; - - () e.Expr = e.Expr; -} - -ApplyAssignment-toExpr { - (e.Val ':' (s.Type e.Index)) e.Begin (Var s.Type e.Index) e.End - = - e.Val - ; - - t.Assign e.Begin (Brackets e.E) e.End - = - (Brackets ) - ; - - t.Assign e.Begin (ADT-Brackets e.E) e.End - = - (ADT-Brackets ) - ; - - t.Assign e.E = e.E; -} - /* Добавляет в левую часть уравнения метки координат From 2b6be6371315a9e92be5d1a70b0c260f54ca1509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 22 Aug 2021 23:46:53 +0300 Subject: [PATCH 156/208] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D1=8B=D0=B5=20TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 6 ++---- src/compiler/OptTree.ref | 7 ------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index ed940660..3299473e 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -509,12 +509,10 @@ ReplaceToGuards { (ADT-Brackets (e.Name) e.Nested) = (ADT-Brackets (e.Name) ); - /* Уже пустая функция, ничего не делаем с ней */ - (Symbol Name e.Name '@' 0) = (Symbol Name e.Name '@' 0); - -* TODO: это костыль. Нужно понять, в чём проблема и удалить эту затычку. + /* вызов экземпляра, заменяем его суффикс пустую функцию */ (Symbol Name e.Name '@' s._) = (Symbol Name e.Name '@' 0); + /* любой другой функции добавляем суффикс @0 */ (Symbol Name e.Name) = (Symbol Name ); t.Other = t.Other; diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index c4a5f528..b9dbeb96 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -176,13 +176,6 @@ ExpandClosures-Sentence { * Интерпретатор императивного кода оптимизаций -* TODO: удалить следующие пометки после оптимизации алгоритма оптимизации! -* Сейчас компиляция в режиме -OADiS для этого файла требует десятки минут. -$SPEC Int-Code e.arg; -$SPEC Int-Command e.arg; -$SPEC Int-LoopForWarmFunctions e.arg; - - Int { e.Defines s.Cycles (e.AST) = e.Defines : (define s.StartPoint e._) e._ From a992804fd7515761729521c79f8131e0c913d7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 01:22:55 +0300 Subject: [PATCH 157/208] =?UTF-8?q?=D0=92=C2=A0=D0=B0=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=B0=D1=85=20=D0=BD=D0=B0=C2=A0=D0=BE?= =?UTF-8?q?=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8E=20?= =?UTF-8?q?=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83=D1=8E=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D0=BF=D1=81=D0=B5=D0=B2=D0=B4=D0=BE=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B8=20(#195,?= =?UTF-8?q?=20#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/opt-tree-drive-spec1.ref | 11 ++++++---- autotests/opt-tree-drive-spec2.ref | 3 +-- autotests/opt-tree-drive-spec3-block.ref | 2 +- autotests/opt-tree-drive-spec4-closure.ref | 2 +- autotests/opt-tree-drive1-merged.ref | 18 ++++++++--------- autotests/opt-tree-drive2-identic-equals.ref | 2 +- .../opt-tree-drive3-cond-last-sentence.ref | 2 +- autotests/opt-tree-drive4-empty.ref | 2 +- ...opt-tree-higman-kruskal-relation1-spec.ref | 2 +- ...opt-tree-higman-kruskal-relation2-spec.ref | 6 ++++-- ...opt-tree-higman-kruskal-relation3-spec.ref | 6 ++++-- ...opt-tree-higman-kruskal-relation4-spec.ref | 6 ++++-- ...opt-tree-higman-kruskal-relation5-spec.ref | 4 ++-- ...pt-tree-higman-kruskal-relation7-drive.ref | 2 +- autotests/opt-tree-markup6-inline.ref | 2 +- autotests/opt-tree-spec-intrinsic.ref | 2 +- autotests/opt-tree-spec1-merged.ref | 20 +++++++++---------- autotests/opt-tree-spec10.ref | 2 +- autotests/opt-tree-spec11.ref | 2 +- autotests/opt-tree-spec12.ref | 2 +- autotests/opt-tree-spec13.ref | 2 +- autotests/opt-tree-spec14.ref | 2 +- autotests/opt-tree-spec17.ref | 2 +- autotests/opt-tree-spec2.ref | 2 +- autotests/opt-tree-spec3-in-condition.ref | 2 +- autotests/opt-tree-spec4-x-vars.ref | 4 ++-- autotests/opt-tree-spec5-call-vars.ref | 2 +- autotests/opt-tree-spec6-closure-gen.ref | 6 ++++-- autotests/opt-tree-spec7.ref | 2 +- autotests/opt-tree-spec8.ref | 2 +- autotests/opt-tree-spec9.ref | 2 +- autotests/varcopy-fail.ref | 7 ++----- 32 files changed, 70 insertions(+), 63 deletions(-) diff --git a/autotests/opt-tree-drive-spec1.ref b/autotests/opt-tree-drive-spec1.ref index cd84da21..b0f44d02 100644 --- a/autotests/opt-tree-drive-spec1.ref +++ b/autotests/opt-tree-drive-spec1.ref @@ -7,18 +7,21 @@ $ENTRY Go { } $ENTRY F { - s.X = ; - t.X = ; + s.X = { = s.X }> ; + t.X = { = t.X }> ; } -$SPEC EqS t.x t.Y; +*TODO: заменить на gen_s__ +gen_e__ { e.arg = e.arg } + +*$SPEC EqS; EqS { t.X t.X = True; t.X t.Y = False; } -$DRIVE EqD; +*$DRIVE EqD; EqD { t.X t.X = True; diff --git a/autotests/opt-tree-drive-spec2.ref b/autotests/opt-tree-drive-spec2.ref index 99332850..188bfac3 100644 --- a/autotests/opt-tree-drive-spec2.ref +++ b/autotests/opt-tree-drive-spec2.ref @@ -12,8 +12,7 @@ Test { e.X = ; } -$DRIVE DS; -$SPEC DS s.STAT e.dyn; +*$OPT DS; DS { s.Mark /* empty */ = s.Mark s.Mark; diff --git a/autotests/opt-tree-drive-spec3-block.ref b/autotests/opt-tree-drive-spec3-block.ref index 29bbc714..ca5d42fd 100644 --- a/autotests/opt-tree-drive-spec3-block.ref +++ b/autotests/opt-tree-drive-spec3-block.ref @@ -9,7 +9,7 @@ $ENTRY Go { = /* empty */; } -$SPEC F s.STAT e.dyn; +*$SPEC F; F { s.Mark e.X diff --git a/autotests/opt-tree-drive-spec4-closure.ref b/autotests/opt-tree-drive-spec4-closure.ref index c5439d17..adf36b07 100644 --- a/autotests/opt-tree-drive-spec4-closure.ref +++ b/autotests/opt-tree-drive-spec4-closure.ref @@ -10,7 +10,7 @@ Test { s.X = } -$DRIVE F; +*$DRIVE F; F { t.Mark diff --git a/autotests/opt-tree-drive1-merged.ref b/autotests/opt-tree-drive1-merged.ref index 09b9e322..b3d5afdd 100644 --- a/autotests/opt-tree-drive1-merged.ref +++ b/autotests/opt-tree-drive1-merged.ref @@ -8,7 +8,7 @@ Go1 { e.X = ; } -$DRIVE F1; +*$DRIVE F1; F1 { e.X = e.X; @@ -23,7 +23,7 @@ Q { e.X '=' e.Y = ; } -$DRIVE EQ; +*$DRIVE EQ; EQ { (e.X) e.X = EQ; @@ -37,20 +37,20 @@ Go3 { B = 4; } -$DRIVE Go3; +*$DRIVE Go3; Go4 { e.X = ; } -$SPEC S s.X; +*$SPEC S; S { s.X = s.X } -$DRIVE D; +*$DRIVE D; D { s.X = s.X } -$INLINE I; +*$INLINE I; I { s.X = s.X } @@ -58,7 +58,7 @@ Go5 { e.X = [Go5 ]; } -$DRIVE F2; +*$DRIVE F2; F2 { A e.Z = e.Z; @@ -80,7 +80,7 @@ F3 { e.Z s.X = e.Z; } -$DRIVE F3; +*$DRIVE F3; Go-h1 { = > } @@ -89,7 +89,7 @@ fact { = (fact DUP (0) '=' if (DROP (1)) else (DUP (1) '-' fact '*')); } -$INLINE Lookup; +*$INLINE Lookup; Lookup { s.Func (s.Func e.Code) e.Program = e.Code; diff --git a/autotests/opt-tree-drive2-identic-equals.ref b/autotests/opt-tree-drive2-identic-equals.ref index ccabb957..8111c6dc 100644 --- a/autotests/opt-tree-drive2-identic-equals.ref +++ b/autotests/opt-tree-drive2-identic-equals.ref @@ -16,7 +16,7 @@ Test { s.X e.Y = ; } -$DRIVE F; +*$DRIVE F; F { e.Y s.X s.X = True (e.Y); diff --git a/autotests/opt-tree-drive3-cond-last-sentence.ref b/autotests/opt-tree-drive3-cond-last-sentence.ref index 83fbf4df..aa6d550c 100644 --- a/autotests/opt-tree-drive3-cond-last-sentence.ref +++ b/autotests/opt-tree-drive3-cond-last-sentence.ref @@ -10,7 +10,7 @@ Test { e.X = ; } -$DRIVE D; +*$DRIVE D; D { e.X, e.X : '***' = Ok; diff --git a/autotests/opt-tree-drive4-empty.ref b/autotests/opt-tree-drive4-empty.ref index 7d42c553..6cae9c5a 100644 --- a/autotests/opt-tree-drive4-empty.ref +++ b/autotests/opt-tree-drive4-empty.ref @@ -5,5 +5,5 @@ $ENTRY Go { ZZ = ; } -$DRIVE D; +*$DRIVE D; D {} diff --git a/autotests/opt-tree-higman-kruskal-relation1-spec.ref b/autotests/opt-tree-higman-kruskal-relation1-spec.ref index 85940949..a3f32d8d 100644 --- a/autotests/opt-tree-higman-kruskal-relation1-spec.ref +++ b/autotests/opt-tree-higman-kruskal-relation1-spec.ref @@ -6,7 +6,7 @@ $ENTRY Go { = /* empty */; } -$SPEC Test t.STAT e.dyn; +*$SPEC; Test { t.Acc s._ e.Rest = ; diff --git a/autotests/opt-tree-higman-kruskal-relation2-spec.ref b/autotests/opt-tree-higman-kruskal-relation2-spec.ref index ae2d151c..b5b28cc6 100644 --- a/autotests/opt-tree-higman-kruskal-relation2-spec.ref +++ b/autotests/opt-tree-higman-kruskal-relation2-spec.ref @@ -2,11 +2,13 @@ $ENTRY Go { /* empty */ - = : 'bzb' + = > : 'bzb' = /* empty */; } -$SPEC Test (e.ACC) e.input; +gen_e__ { e.arg = e.arg } + +*$SPEC Test; Test { (e.Acc) 'a' e.Rest = ; diff --git a/autotests/opt-tree-higman-kruskal-relation3-spec.ref b/autotests/opt-tree-higman-kruskal-relation3-spec.ref index d725c87a..2baea7ea 100644 --- a/autotests/opt-tree-higman-kruskal-relation3-spec.ref +++ b/autotests/opt-tree-higman-kruskal-relation3-spec.ref @@ -2,11 +2,13 @@ $ENTRY Go { /* empty */ - = : 'bzb' + = > : 'bzb' = /* empty */; } -$SPEC Test (e.ACC) e.input; +gen_e__ { e.arg = e.arg } + +*$SPEC Test; Test { (e.Acc) 'a' e.Rest = ; diff --git a/autotests/opt-tree-higman-kruskal-relation4-spec.ref b/autotests/opt-tree-higman-kruskal-relation4-spec.ref index 2ad71791..68f1bb49 100644 --- a/autotests/opt-tree-higman-kruskal-relation4-spec.ref +++ b/autotests/opt-tree-higman-kruskal-relation4-spec.ref @@ -2,11 +2,13 @@ $ENTRY Go { /* empty */ - = : (X) (Y) (Z) (T) + = )> : (X) (Y) (Z) (T) = /* empty */; } -$SPEC Loop (e.UNUSED) (e.RES) (e.items); +gen_e__ { e.arg = e.arg } + +*$SPEC Loop; Loop { (e.Unused) (e.Res) (t.Item e.Items) diff --git a/autotests/opt-tree-higman-kruskal-relation5-spec.ref b/autotests/opt-tree-higman-kruskal-relation5-spec.ref index 3707ac22..c8db75ec 100644 --- a/autotests/opt-tree-higman-kruskal-relation5-spec.ref +++ b/autotests/opt-tree-higman-kruskal-relation5-spec.ref @@ -6,8 +6,8 @@ $ENTRY Go { = /* empty */; } -$INLINE F; -$SPEC F (e.ACC) s.mark e.string; +*$INLINE F; +*$SPEC F; F { (e.Acc) 5 e.String = 5; diff --git a/autotests/opt-tree-higman-kruskal-relation7-drive.ref b/autotests/opt-tree-higman-kruskal-relation7-drive.ref index 82f399cc..5491faf4 100644 --- a/autotests/opt-tree-higman-kruskal-relation7-drive.ref +++ b/autotests/opt-tree-higman-kruskal-relation7-drive.ref @@ -16,7 +16,7 @@ GST3 { = () (); } -$DRIVE Mapa1, Boom; +*$DRIVE Mapa1, Boom; Mapa1 { (Num1 s.Trash1 t.Trash2) e.Trash0 = ; diff --git a/autotests/opt-tree-markup6-inline.ref b/autotests/opt-tree-markup6-inline.ref index 184b8a9e..e52f36c7 100644 --- a/autotests/opt-tree-markup6-inline.ref +++ b/autotests/opt-tree-markup6-inline.ref @@ -5,7 +5,7 @@ $ENTRY Go { e.X = ; } -$INLINE Basic; +*$INLINE Basic; Basic { e.X = ; diff --git a/autotests/opt-tree-spec-intrinsic.ref b/autotests/opt-tree-spec-intrinsic.ref index 3ca9648a..3e1ff2a0 100644 --- a/autotests/opt-tree-spec-intrinsic.ref +++ b/autotests/opt-tree-spec-intrinsic.ref @@ -8,7 +8,7 @@ $ENTRY Go { = /* empty */; } -$SPEC EnumExprs s.NUM (e.PAT) (e.pat) (e.RES) (e.res); +*$SPEC EnumExprs; EnumExprs { s.Num diff --git a/autotests/opt-tree-spec1-merged.ref b/autotests/opt-tree-spec1-merged.ref index e94a0194..effdd51f 100644 --- a/autotests/opt-tree-spec1-merged.ref +++ b/autotests/opt-tree-spec1-merged.ref @@ -8,7 +8,7 @@ Go1 { = ; } -$SPEC Test1 [Go e.STAT] e.dyn; +*$SPEC Test1; Test1 { [Go e.Stat] e.Dyn = e.Stat e.Dyn; @@ -26,7 +26,7 @@ Test2 { = ; } -$SPEC S2 (e.S1) (e.d2) (e.S3) (e.d4) (e.S5) (e.d6); +*$SPEC S2; S2 { (e.a) (e.b) (e.c) (e.d) (e.f) (e.g) @@ -44,7 +44,7 @@ F3 { (e.X) (e.X1) = ; } -$SPEC S3 (e.S) e.d; +*$SPEC S3; S3 { (e.A) e.X (e.X0) = e.A e.X e.X0; @@ -57,7 +57,7 @@ Go4 { = /* пусто */; } -$SPEC Spec (e.STATIC) e.dynamic; +*$SPEC Spec; Spec { (e.X) e.y, 'abc' : e.X, 'def' : e.y = e.X e.y; @@ -72,7 +72,7 @@ Go5 { $SWAP DATA; -$SPEC SF e.dyn (e.STAT); +*$SPEC SF; SF { e.Dyn (e.Stat) = e.Stat e.Dyn e.Stat; @@ -84,7 +84,7 @@ Go6 { = ; } -$SPEC Eq6 t.X t.y; +*$SPEC Eq6; Eq6 { t.Eq t.Eq = True; @@ -94,7 +94,7 @@ Eq6 { F6 { = '*' } -$SPEC F7 t.STAT e.dyn; +*$SPEC F7; F7 { t.Stat e.Dyn = STAT t.Stat DYN e.Dyn } @@ -105,7 +105,7 @@ Go7 { } -$SPEC F8 t.dyn e.STAT; +*$SPEC F8; F8 { t.Dyn e.Stat = DYN t.Dyn STAT e.Stat } @@ -120,7 +120,7 @@ Go9 { e.X = ; } -$SPEC Eq9 t.STAT t.dyn; +*$SPEC Eq9; Eq9 { t.X t.X = True; @@ -135,6 +135,6 @@ Go10 { = /* пусто */ } -$SPEC S10 (e.S1) (e.S2); +*$SPEC S10; S10 { (e.X) (e.Y) = e.Y '+' e.X } diff --git a/autotests/opt-tree-spec10.ref b/autotests/opt-tree-spec10.ref index 74265b75..d3047752 100644 --- a/autotests/opt-tree-spec10.ref +++ b/autotests/opt-tree-spec10.ref @@ -8,7 +8,7 @@ F { t.X = } -$SPEC Eq e.arg; +*$SPEC Eq; Eq { t.Eq t.Eq = True; diff --git a/autotests/opt-tree-spec11.ref b/autotests/opt-tree-spec11.ref index 537d6e1f..d8bd3fed 100644 --- a/autotests/opt-tree-spec11.ref +++ b/autotests/opt-tree-spec11.ref @@ -8,7 +8,7 @@ F { e.X = } -$SPEC G e.arg; +*$SPEC G; G { (e.A '@' e.B) s.R (e.C '#' e.D) = (e.A) s.R (e.B) s.R (e.C) s.R (e.D); diff --git a/autotests/opt-tree-spec12.ref b/autotests/opt-tree-spec12.ref index 588376a0..ac72072f 100644 --- a/autotests/opt-tree-spec12.ref +++ b/autotests/opt-tree-spec12.ref @@ -23,7 +23,7 @@ F { (e.1) (e.2) = ; } -$SPEC S e.arg; +*$SPEC S; S { e.A e.B e.A e.C 9 e.D diff --git a/autotests/opt-tree-spec13.ref b/autotests/opt-tree-spec13.ref index 3f9e1831..0dcc3dc8 100644 --- a/autotests/opt-tree-spec13.ref +++ b/autotests/opt-tree-spec13.ref @@ -8,7 +8,7 @@ F { (e.A) (e.B) = } -$SPEC S e.arg; +*$SPEC S; S { (e.Z) (e.1 A s.X e.2) (e.3 B s.X e.4) diff --git a/autotests/opt-tree-spec14.ref b/autotests/opt-tree-spec14.ref index 58b8b69b..80e93d05 100644 --- a/autotests/opt-tree-spec14.ref +++ b/autotests/opt-tree-spec14.ref @@ -11,7 +11,7 @@ F { (e.A) (e.B) (e.C) (e.D) = ; } -$SPEC S (e.S) e.d; +*$SPEC S; S { (e.A) 'B' e.A e.E, e.E : e.E = '1'; diff --git a/autotests/opt-tree-spec17.ref b/autotests/opt-tree-spec17.ref index c364f76a..0160d348 100644 --- a/autotests/opt-tree-spec17.ref +++ b/autotests/opt-tree-spec17.ref @@ -12,7 +12,7 @@ $ENTRY Go { gen_e__ { e.arg = e.arg } -$SPEC S e.arg; +*$SPEC S; S { (e.Y e.Z) e.R e.R = (e.Y) (e.Z) (e.R); diff --git a/autotests/opt-tree-spec2.ref b/autotests/opt-tree-spec2.ref index 5e1e14f7..0e42ddc8 100644 --- a/autotests/opt-tree-spec2.ref +++ b/autotests/opt-tree-spec2.ref @@ -43,7 +43,7 @@ Symb { 1 = '1'; 2 = '2'; 3 = '3'; } -$SPEC Map s.FUNC e.items; +*$SPEC Map; Map { s.Fn t.Next e.Rest = ; diff --git a/autotests/opt-tree-spec3-in-condition.ref b/autotests/opt-tree-spec3-in-condition.ref index 7d28dd97..2173f09d 100644 --- a/autotests/opt-tree-spec3-in-condition.ref +++ b/autotests/opt-tree-spec3-in-condition.ref @@ -7,7 +7,7 @@ $ENTRY Go { = /* пусто */; } -$SPEC S s.A e.rest; +*$SPEC S; S { s.A s.X e.Rest = s.A ; diff --git a/autotests/opt-tree-spec4-x-vars.ref b/autotests/opt-tree-spec4-x-vars.ref index ef6706b8..fc042651 100644 --- a/autotests/opt-tree-spec4-x-vars.ref +++ b/autotests/opt-tree-spec4-x-vars.ref @@ -7,13 +7,13 @@ $ENTRY Go { = /* empty */; } -$SPEC F (e.LEFT) e.RIGHT; +*$SPEC F; F { (e.Left) e.Right = ; } -$SPEC G (e.LEFT) e.right; +*$SPEC G; G { (e.Left) '*' e.Right = ; diff --git a/autotests/opt-tree-spec5-call-vars.ref b/autotests/opt-tree-spec5-call-vars.ref index e7a3170a..81221f3c 100644 --- a/autotests/opt-tree-spec5-call-vars.ref +++ b/autotests/opt-tree-spec5-call-vars.ref @@ -7,7 +7,7 @@ $ENTRY Go { = /* empty */; } -$SPEC G (e.RES) e.str; +*$SPEC G; G { (e.Res) t.Term e.Tail = ) e.Tail>; diff --git a/autotests/opt-tree-spec6-closure-gen.ref b/autotests/opt-tree-spec6-closure-gen.ref index 57b83206..8a21b7a5 100644 --- a/autotests/opt-tree-spec6-closure-gen.ref +++ b/autotests/opt-tree-spec6-closure-gen.ref @@ -2,12 +2,14 @@ $ENTRY Go { e.X - = : s.Closure + = > : s.Closure = <<<>>> : e.X = /* empty */; } -$SPEC S s.CLOSURE e.items; +gen_e__ { e.arg = e.arg } + +*$SPEC S; S { s.Closure s._ e.Y = ; diff --git a/autotests/opt-tree-spec7.ref b/autotests/opt-tree-spec7.ref index a786632f..232187fd 100644 --- a/autotests/opt-tree-spec7.ref +++ b/autotests/opt-tree-spec7.ref @@ -4,7 +4,7 @@ $ENTRY Go { e.X = : False = /* empty */; } -$SPEC S s.X; +*$SPEC S; S { s.X, A : s.X = True; diff --git a/autotests/opt-tree-spec8.ref b/autotests/opt-tree-spec8.ref index b0c699a8..9a24b105 100644 --- a/autotests/opt-tree-spec8.ref +++ b/autotests/opt-tree-spec8.ref @@ -1,6 +1,6 @@ * TREE -$SPEC Rot e.dyn; +*$SPEC Rot; Rot { e.1 s.2 = s.2 e.1; diff --git a/autotests/opt-tree-spec9.ref b/autotests/opt-tree-spec9.ref index fc62bcb3..e6b23086 100644 --- a/autotests/opt-tree-spec9.ref +++ b/autotests/opt-tree-spec9.ref @@ -4,7 +4,7 @@ $ENTRY Go { e.X = ; } -$SPEC Eq e.arg; +*$SPEC Eq; Eq { t.X t.X = True t.X; diff --git a/autotests/varcopy-fail.ref b/autotests/varcopy-fail.ref index c67c3d85..7f2561a7 100644 --- a/autotests/varcopy-fail.ref +++ b/autotests/varcopy-fail.ref @@ -26,8 +26,7 @@ MapAccum { t.Fn t.Acc e.Tail = ; } -$SPEC MapAccum t.FUNC t.accum e.items; -$INLINE MapAccum; +*$OPT MapAccum; DoMapAccum { t.Fn t.Acc (e.Scanned) t.Next e.Tail @@ -39,6 +38,4 @@ DoMapAccum { t.Fn t.Acc (e.Scanned) /* пусто */ = t.Acc e.Scanned; } -$SPEC DoMapAccum t.FUNC t.acc (e.scanned) e.items; - - +*$SPEC DoMapAccum; From 87cb093d0122a505107563bbccd226ef51224282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 10:50:19 +0300 Subject: [PATCH 158/208] =?UTF-8?q?FIXED:=20=D0=BD=D0=B5=C2=A0=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=D0=BB=D0=B8=20-Wall=20-Werror=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20pseudocomments=20=D0=B8=C2=A0intrinsic=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Config.ref | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/Config.ref b/src/compiler/Config.ref index ee9b41dc..b3201af4 100644 --- a/src/compiler/Config.ref +++ b/src/compiler/Config.ref @@ -545,7 +545,11 @@ WarningForName { } $ENTRY Config-AllWarningIds { - /* пусто */ = (screening nul-in-compound pseudofunctions repeated deprecated) + /* пусто */ + = ( + screening nul-in-compound pseudocomment pseudofunctions repeated + deprecated intrinsic + ) } WarningIds-Add { From 8fd84dcf0a1304e5d05f55298ab9b2a8c364a25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 10:51:52 +0300 Subject: [PATCH 159/208] =?UTF-8?q?FIXED:=20=D0=BF=D1=81=D0=B5=D0=B2=D0=B4?= =?UTF-8?q?=D0=BE=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80?= =?UTF-8?q?=D0=B8=D0=B8=20*$OPT=20=D0=B8=C2=A0=D0=BD=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D0=B2=D0=BD=D1=8B=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В этом случае выдаётся предупреждение, а псевдокомментарий игнорируется. Если функция объявлена как $SWAP, то предупреждений не выдаётся, пометка просто молча игнорируется. Для псевдокомментариев $NO… такой проверки не делается, т.к. это не имеет смысла. --- ...ocomments-warning-native-drive.WARNING.ref | 12 +++++++ ...udocomments-warning-native-opt.WARNING.ref | 12 +++++++ ...docomments-warning-native-spec.WARNING.ref | 12 +++++++ autotests/run.bat | 2 ++ autotests/run.sh | 3 +- src/compiler/Checker.ref | 32 +++++++++++++++---- src/compiler/Desugaring.ref | 17 ++++++++++ 7 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 autotests/pseudocomments-warning-native-drive.WARNING.ref create mode 100644 autotests/pseudocomments-warning-native-opt.WARNING.ref create mode 100644 autotests/pseudocomments-warning-native-spec.WARNING.ref diff --git a/autotests/pseudocomments-warning-native-drive.WARNING.ref b/autotests/pseudocomments-warning-native-drive.WARNING.ref new file mode 100644 index 00000000..3e1ee854 --- /dev/null +++ b/autotests/pseudocomments-warning-native-drive.WARNING.ref @@ -0,0 +1,12 @@ +* WARNING pseudocomment + +*$DRIVE D; + +$ENTRY Go { = } + +D { +%% + refalrts::splice_to_freelist(vm, arg_begin, arg_end); + return refalrts::cSuccess; +%% +} \ No newline at end of file diff --git a/autotests/pseudocomments-warning-native-opt.WARNING.ref b/autotests/pseudocomments-warning-native-opt.WARNING.ref new file mode 100644 index 00000000..5e133902 --- /dev/null +++ b/autotests/pseudocomments-warning-native-opt.WARNING.ref @@ -0,0 +1,12 @@ +* WARNING pseudocomment + +*$OPT S; + +$ENTRY Go { = } + +S { +%% + refalrts::splice_to_freelist(vm, arg_begin, arg_end); + return refalrts::cSuccess; +%% +} \ No newline at end of file diff --git a/autotests/pseudocomments-warning-native-spec.WARNING.ref b/autotests/pseudocomments-warning-native-spec.WARNING.ref new file mode 100644 index 00000000..811fd940 --- /dev/null +++ b/autotests/pseudocomments-warning-native-spec.WARNING.ref @@ -0,0 +1,12 @@ +* WARNING pseudocomment + +*$SPEC S; + +$ENTRY Go { = } + +S { +%% + refalrts::splice_to_freelist(vm, arg_begin, arg_end); + return refalrts::cSuccess; +%% +} \ No newline at end of file diff --git a/autotests/run.bat b/autotests/run.bat index 0a3a7c66..3736ae25 100644 --- a/autotests/run.bat +++ b/autotests/run.bat @@ -379,6 +379,7 @@ setlocal set SREF=%1 set RASL=%~n1.rasl + set CPP=%~n1.cpp set WARN=-W echo Passing %1 (flag %WARN%%FLAG%)... if exist __dump_rlc-core.txt erase __dump_rlc-core.txt @@ -396,6 +397,7 @@ setlocal type __error.txt erase __error.txt erase %RASL% + if exist %CPP% erase %CPP% echo Ok! Compilation didn't abort echo. diff --git a/autotests/run.sh b/autotests/run.sh index 6a97da47..dd4dd668 100755 --- a/autotests/run.sh +++ b/autotests/run.sh @@ -203,6 +203,7 @@ run_test_aux.WARNING() { echo Passing $1 \(flag "${WARN}"\)... SREF=$1 RASL=${SREF%.*}.rasl + CPP=${SREF%.*}.cpp EXE=${SREF%.*}$(platform_exe_suffix) rm -f __dump_rlc-core.txt @@ -219,7 +220,7 @@ run_test_aux.WARNING() { fi cat __error.txt rm __error.txt - rm ${RASL} + rm -f ${RASL} ${CPP} echo "Ok! Compiler didn't abort" echo diff --git a/src/compiler/Checker.ref b/src/compiler/Checker.ref index 7868c10d..8d857107 100644 --- a/src/compiler/Checker.ref +++ b/src/compiler/Checker.ref @@ -72,6 +72,9 @@ PrepareMessage { LegacyDrive = '$DRIVE'; LegacyInline = '$INLINE'; LegacySpec = '$SPEC'; + Drive = '*$DRIVE'; + Spec = '*$SPEC'; + Opt = '*$OPT'; } : e.Keyword = 'Function ' e.Name ' can\'t be ' e.Keyword; @@ -642,7 +645,9 @@ FindInvalidDriveInline { = (Error t.SrcPos NativeOptimizable s.Label e.Name); e._ = /* пропускаем */; - }; + } + : e.Error + = (NativeBody e.Name) e.Error; t.Other = t.Other; } @@ -862,13 +867,27 @@ CheckConflictOptPseudocomments { e.Declarations-E >; - e.Declarations-B (Opt s._ () Yes t._ e._) e.Declarations-E - = ; - e.Declarations = e.Declarations; } CleanupValidOptPseudocomments { + e.Declarations-B + (Opt s.OptNode (e.Features) Yes t.OptPos e.Name) e.Declarations-M + (NativeBody e.Name) e.Declarations-E + = ; + + e.Declarations-B (NativeBody e.Name) e.Declarations-M + (Opt s.OptNode (e.Features) Yes t.OptPos e.Name) e.Declarations-E + = ; + e.Declarations-B (Opt s.OptNode (e.Features) s.Enable t.OptPos e.Name) e.Declarations-M (Define t.SrcPos s.ScopeClass e.Name) e.Declarations-E @@ -881,8 +900,9 @@ CleanupValidOptPseudocomments { (Define t.SrcPos s.ScopeClass e.Name) e.Declarations-M (Opt s.OptNode (e.Features) s.Enable t.OptPos e.Name) e.Declarations-E = ; e.Declarations = e.Declarations; diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index 0087d2e5..e4f42c4c 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -822,6 +822,11 @@ Pass-CollectDeclarations { : e._ (s.OptMarkup e.Groups) e._ = ; + (Function (e.Name) Sentences e.Sentences) + = (GROUP DefinedFunctions (e.Name)) + (GROUP RefalFunctions (e.Name)) + (Function (e.Name) Sentences e.Sentences); + (Function (e.Name) e.Body) = (GROUP DefinedFunctions (e.Name)) (Function (e.Name) e.Body); @@ -841,6 +846,7 @@ Pass-CollectDeclarations { (GROUP NoDrives) (GROUP NoSpecs) (GROUP DefinedFunctions) + (GROUP RefalFunctions) > : e.AST^ (GROUP Externs e.Externs) @@ -851,6 +857,7 @@ Pass-CollectDeclarations { (GROUP NoDrives e.NoDrives) (GROUP NoSpecs e.NoSpecs) (GROUP DefinedFunctions e.DefinedFunctions) + (GROUP RefalFunctions e.RefalFunctions) = : e.Externs^ = : e.Drives^ @@ -860,6 +867,9 @@ Pass-CollectDeclarations { = : e.NoDrives^ = : e.NoSpecs^ + = : e.Drives^ + = : e.Specs^ + = : e.Externs^ = : e.Inlines^ = : e.Intrinsics^ @@ -881,6 +891,13 @@ CollectDeclarations-Group { e.AST = e.AST; } +Set-Intersect { + (e.Set1-B t.Repeated e.Set1-E) (e.Set2-B t.Repeated e.Set2-E) + = t.Repeated ; + + (e.Set1) (e.Set2) = /* нет общих элементов */; +} + Set-Reject { (e.Minuent-B t.Repeated e.Minuent-E) (e.Subtr-B t.Repeated e.Subtr-E) = e.Minuent-B ; From 4696449c4483f37916cd20a63569acec0ff7a1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 12:15:40 +0300 Subject: [PATCH 160/208] =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=81=D0=B0=D1=85?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=20=D1=81?= =?UTF-8?q?=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D1=82=20=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=B2=D0=BE=D0=B5=20=D1=81=D0=BB=D0=BE=D0=B2=D0=BE=20$IN?= =?UTF-8?q?LINE=20=D1=81=D0=B8=D0=BD=D0=BE=D0=BD=D0=B8=D0=BC=D0=BE=D0=BC?= =?UTF-8?q?=20$DRIVE=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В коммите 18e35b7c7c7c9 их не различал только прогонщик, поскольку из соображений отладки сохранялось поведение авторазметки (меньше изменений поведения в одном коммите). Теперь, когда авторазметка упрощена, их можно не различать и на более ранней стадии. Смешивать их на стадии синтаксического анализа пока нельзя, т.к. их должна различать проверка семантики (выдавать адекватные сообщения об ошибках). --- src/compiler/Desugaring.ref | 11 +++-------- src/compiler/Log-AST.ref | 1 - src/compiler/OptTree-Drive.ref | 2 -- src/compiler/OptTree.ref | 1 - src/compiler/README.md | 5 +++-- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index e4f42c4c..9912d211 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -812,7 +812,7 @@ Pass-CollectDeclarations { (Declaration GN-Entry e.Name) = (GROUP Externs (e.Name)); (LegacyDrive e.Name) = (GROUP Drives (e.Name)); - (LegacyInline e.Name) = (GROUP Inlines (e.Name)); + (LegacyInline e.Name) = (GROUP Drives (e.Name)); (Intrinsic e.Name) = (GROUP Intrinsics (e.Name)); (LegacySpec e.Name) = (GROUP Specs (e.Name)); @@ -840,7 +840,6 @@ Pass-CollectDeclarations { e.AST (GROUP Externs) (GROUP Drives) - (GROUP Inlines) (GROUP Intrinsics) (GROUP Specs) (GROUP NoDrives) @@ -851,7 +850,6 @@ Pass-CollectDeclarations { : e.AST^ (GROUP Externs e.Externs) (GROUP Drives e.Drives) - (GROUP Inlines e.Inlines) (GROUP Intrinsics e.Intrinsics) (GROUP Specs e.Specs) (GROUP NoDrives e.NoDrives) @@ -861,7 +859,6 @@ Pass-CollectDeclarations { = : e.Externs^ = : e.Drives^ - = : e.Inlines^ = : e.Intrinsics^ = : e.Specs^ = : e.NoDrives^ @@ -871,12 +868,10 @@ Pass-CollectDeclarations { = : e.Specs^ = : e.Externs^ - = : e.Inlines^ = : e.Intrinsics^ - = (Externs e.Externs) - (Drives e.Drives) (Inlines e.Inlines) (Intrinsics e.Intrinsics) - (Specs e.Specs) + = (Externs e.Externs) (Intrinsics e.Intrinsics) + (Drives e.Drives) (Specs e.Specs) (NoDrives e.NoDrives) (NoSpecs e.NoSpecs) e.AST } diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index 084353e0..71482ccf 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -31,7 +31,6 @@ Element { = ; (Externs e.Names) = ; - (Inlines e.Names) = ; (Drives e.Names) = ; (Intrinsics e.Names) = ; diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index d269318e..a50c8a66 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -79,7 +79,6 @@ UpdateDriveInfo { s.OptDrive s.OptIntrinsic ((e.KnownNames) e.KnownFunctions) e.AST = e.KnownFunctions : s._ (e._) e.KnownFunctions^ = : (e.Drives) e.AST^ - = : (e.DrivesI) e.AST^ = : (e.Intrinsics) e.AST^ = e.AST : { @@ -90,7 +89,6 @@ UpdateDriveInfo { } : (e.NoDrives) e.AST^ = : e.NoDrives^ - = e.Drives e.DrivesI : e.Drives^ = : e.KnownNames^ diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index b9dbeb96..761bb3ba 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -108,7 +108,6 @@ $ENTRY OptTree-CleanupMarkup { = Date: Mon, 23 Aug 2021 13:15:39 +0300 Subject: [PATCH 161/208] =?UTF-8?q?-Wpseudocomments=20=D0=BA=D0=B0=D0=BA?= =?UTF-8?q?=20=D1=81=D0=B8=D0=BD=D0=BE=D0=BD=D0=B8=D0=BC=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20-Wpseudocomment=20(#195,=20#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Config.ref | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/Config.ref b/src/compiler/Config.ref index b3201af4..0531362e 100644 --- a/src/compiler/Config.ref +++ b/src/compiler/Config.ref @@ -534,6 +534,7 @@ ValidWarningId { WarningForName { 'screening' = True screening; 'nul-in-compound' = True nul-in-compound; + 'pseudocomments' = True pseudocomment; /* синоним */ 'pseudocomment' = True pseudocomment; 'pseudofunctions' = True pseudofunctions; 'pseudofunction' = True pseudofunctions; /* синоним */ From 9fc68d4a0384ffdd7915542926304bed6aa12107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 13:15:52 +0300 Subject: [PATCH 162/208] =?UTF-8?q?=D0=A1=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Config.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/Config.ref b/src/compiler/Config.ref index 0531362e..9971c73f 100644 --- a/src/compiler/Config.ref +++ b/src/compiler/Config.ref @@ -537,7 +537,7 @@ WarningForName { 'pseudocomments' = True pseudocomment; /* синоним */ 'pseudocomment' = True pseudocomment; 'pseudofunctions' = True pseudofunctions; - 'pseudofunction' = True pseudofunctions; /* синоним */ + 'pseudofunction' = True pseudofunctions; /* синоним */ 'repeated' = True repeated; 'deprecated' = True deprecated; 'intrinsic' = True intrinsic; From b1e5764a73b0422a6c5f62f12c767183b8f863d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 15:58:19 +0300 Subject: [PATCH 163/208] =?UTF-8?q?FIXED:=20=D0=B7=D0=B0=D0=BF=D1=80=D0=B5?= =?UTF-8?q?=D1=82=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B4=D0=BB=D1=8F=20gen-=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D0=B9=20(#314,=20#331)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Во-первых, если псевдокомментарий разрешает оптимизацию и включает имя gen-функции, то выдаётся предупреждение (даже если сама gen-функция написана неправильно). Ранее эта функция не работала, т.к. в коде CheckPseudofunction была ошибка. Во-вторых, поскольку предупреждение не блокирует дальнейшую компиляцию, на стадии рассахаривания для gen-функций оптимизация запрещается (имена помещаются в узлы (NoDrives …) и (NoSpecs …)). Поскольку оптимизация gen-функций заранее отсекается на стадии рассахаривания, в авторазметках можно их не учитывать. --- ...docomments-warning-gen_e-drive.WARNING.ref | 7 ++++ src/compiler/Checker.ref | 9 +++-- src/compiler/Desugaring.ref | 36 +++++++++++++++++++ src/compiler/OptTree-AutoMarkup-Drive.ref | 16 --------- src/compiler/OptTree-AutoMarkup-Spec.ref | 22 ------------ 5 files changed, 49 insertions(+), 41 deletions(-) create mode 100644 autotests/pseudocomments-warning-gen_e-drive.WARNING.ref diff --git a/autotests/pseudocomments-warning-gen_e-drive.WARNING.ref b/autotests/pseudocomments-warning-gen_e-drive.WARNING.ref new file mode 100644 index 00000000..dbe94e0a --- /dev/null +++ b/autotests/pseudocomments-warning-gen_e-drive.WARNING.ref @@ -0,0 +1,7 @@ +* WARNING pseudocomment + +$ENTRY Go { = } + +*$DRIVE gen_e__ + +gen_e__ { e.arg = e.arg } diff --git a/src/compiler/Checker.ref b/src/compiler/Checker.ref index 8d857107..eee33891 100644 --- a/src/compiler/Checker.ref +++ b/src/compiler/Checker.ref @@ -158,12 +158,15 @@ CheckPseudofunctions { = : e._ (e.Name) e._ = (Error t.SrcPos TaggedPseudofunction s.Tag e.Name); + (s.Tag t.SrcPos e.Name) + , Opt Drive Spec : e._ s.Tag e._ + , : e._ (e.Name) e._ + = (Warning pseudocomment t.SrcPos TaggedPseudofunction s.Tag e.Name); + (LegacySpec t.SrcPos (e.Name) e._) , : e._ (e.Name) e._ = (Error t.SrcPos TaggedPseudofunction Spec e.Name); diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index 9912d211..384e3dbf 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -26,6 +26,7 @@ $ENTRY Desugar { Conditions-Transform = (&Pass-UnCondition s.MarkupContext); } > + &Pass-DisableGenFunctionOptimizations &Pass-CollectDeclarations > >; @@ -804,6 +805,41 @@ CheckBorrowed { (e.ScopeVars) (e.BorrowedVars) (s.Mode e.Index) = (e.BorrowedVars); } +Pass-DisableGenFunctionOptimizations { + e.AST + = : True + = (e.GenFunctions (e.FuncName)) + (Function + (e.FuncName) Sentences + (((Var 'e' e.Index)) /*=*/ ((Var 'e' e.Index))) + ); + + (e.GenFunctions) t.Other = (e.GenFunctions) t.Other; + } + (/* gen functions */) e.AST + > + : (e.GenFunctions) e.AST^ + = (GROUP NoDrives e.GenFunctions) + (GROUP NoSpecs e.GenFunctions) + e.AST +} + +Pseudofunction-gen_e { + 'gen_e__' = True; + 'gen-e__' = True; + 'gen_e__' SUF '~' s.N = True; + 'gen-e__' SUF '~' s.N = True; + + e._ = False; +} + Pass-CollectDeclarations { e.AST = : True - = (Drives e.Drives) - (Function (e.FuncName) Sentences (e.OneSentence)); - (Drives e.Drives) (Function (e.Name) Sentences e.Body) = : { @@ -44,15 +37,6 @@ $ENTRY OptTree-AutoMarkup-Drive { > } -Pseudofunction-gen_e { - 'gen_e__' = True; - 'gen-e__' = True; - 'gen_e__' SUF '~' s.N = True; - 'gen-e__' SUF '~' s.N = True; - - e._ = False; -} - MakeGraphNode { (Function (e.MetatableName) Metatable e.Metatable) = : True - = (Specs e.Specs) - (Function - (e.FuncName) Sentences - (((Var 'e' e.Index)) /*=*/ ((Var 'e' e.Index))) - ); - (Specs e.Specs) (Function (e.FuncName) Sentences e.Body) = (Specs e.Specs (e.FuncName)) (Function (e.FuncName) Sentences e.Body); @@ -43,12 +30,3 @@ $ENTRY OptTree-AutoMarkup-Spec { (Specs /* пусто */) e.AST > } - -Pseudofunction-gen_e { - 'gen_e__' = True; - 'gen-e__' = True; - 'gen_e__' SUF '~' s.N = True; - 'gen-e__' SUF '~' s.N = True; - - e._ = False; -} From 0212a2e3584bc737dbcf02449cb8f6fdec59b13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 16:08:52 +0300 Subject: [PATCH 164/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=83=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4=D1=83=D0=B1=D0=BB?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B8=D0=BC?= =?UTF-8?q?=D1=91=D0=BD=20gen-=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9?= =?UTF-8?q?=20(#314,=20#331)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Checker.ref | 16 ++++++---------- src/compiler/Desugaring.ref | 14 +++----------- src/compiler/TreeUtils.ref | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/compiler/Checker.ref b/src/compiler/Checker.ref index eee33891..3d366f1e 100644 --- a/src/compiler/Checker.ref +++ b/src/compiler/Checker.ref @@ -10,7 +10,7 @@ $EXTERN GenericMatch; $EXTERN RemovePos-Expr; *$FROM TreeUtils -$EXTERN ExtractVariables-Expr; +$EXTERN ExtractVariables-Expr, IsGenFunctionName; *$FROM Checker-Screening $EXTERN CheckScreening; @@ -159,24 +159,24 @@ CheckPseudofunctions { { (s.Tag t.SrcPos s.ScopeClass e.Name) , LegacyDrive LegacyInline Intrinsic : e._ s.Tag e._ - , : e._ (e.Name) e._ + , : True = (Error t.SrcPos TaggedPseudofunction s.Tag e.Name); (s.Tag t.SrcPos e.Name) , Opt Drive Spec : e._ s.Tag e._ - , : e._ (e.Name) e._ + , : True = (Warning pseudocomment t.SrcPos TaggedPseudofunction s.Tag e.Name); (LegacySpec t.SrcPos (e.Name) e._) - , : e._ (e.Name) e._ + , : True = (Error t.SrcPos TaggedPseudofunction Spec e.Name); (Entry t.SrcPos GN-Entry e.Name) - , : e._ (e.Name) e._ + , : True = (Warning pseudofunctions t.SrcPos EntryPseudofunction e.Name); (Function t.SrcPos s.ScopeClass (e.Name) e.Body) - , : e._ (e.Name) e._ + , : True = (Function t.SrcPos s.ScopeClass (e.Name) e.Body) ; @@ -202,10 +202,6 @@ SeparateErrors { > } -Pseudofunctions { - = ('gen_e__') ('gen-e__') -} - CheckPseudofunctions-Entry { t.SrcPos e.Name GN-Local = /* нет ошибок */; diff --git a/src/compiler/Desugaring.ref b/src/compiler/Desugaring.ref index 384e3dbf..f39456ed 100644 --- a/src/compiler/Desugaring.ref +++ b/src/compiler/Desugaring.ref @@ -4,7 +4,8 @@ $INCLUDE "LibraryEx"; $EXTERN Pass-UnCondition; *$FROM TreeUtils -$EXTERN NewVarName, AddSuffix, CreateContext, ExtractVariables-Expr; +$EXTERN NewVarName, AddSuffix, CreateContext, ExtractVariables-Expr, + IsGenFunctionDecoratedName; $ENTRY Desugar { @@ -814,7 +815,7 @@ Pass-DisableGenFunctionOptimizations { (e.FuncName) Sentences (((Var 'e' e.Index)) /*=*/ ((Var 'e' e.Index))) ) - , : True + , : True = (e.GenFunctions (e.FuncName)) (Function (e.FuncName) Sentences @@ -831,15 +832,6 @@ Pass-DisableGenFunctionOptimizations { e.AST } -Pseudofunction-gen_e { - 'gen_e__' = True; - 'gen-e__' = True; - 'gen_e__' SUF '~' s.N = True; - 'gen-e__' SUF '~' s.N = True; - - e._ = False; -} - Pass-CollectDeclarations { e.AST = } + +*$OPT IsGenFunctionName, IsGenFunctionDecoratedName + +/** + == True | False +*/ +$ENTRY IsGenFunctionName { + 'gen_e__' = True; + 'gen-e__' = True; + e._ = False; +} + +/** + == True | False +*/ +$ENTRY IsGenFunctionDecoratedName { + e.Name SUF '~' s._ = ; + e.Name = ; +} From 5239af7b6064f70c97ff53705482b744fc9da8ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 18:00:01 +0300 Subject: [PATCH 165/208] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC.?= =?UTF-8?q?=20OptTree-AutoMarkup-Drive.ref=20=E2=86=92=20OptTree-AutoMarku?= =?UTF-8?q?p.ref=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Слияние выполняется через два последовательных переименования для сохранения истории правок. --- .../{OptTree-AutoMarkup-Drive.ref => OptTree-AutoMarkup.ref} | 0 src/compiler/OptTree.ref | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/compiler/{OptTree-AutoMarkup-Drive.ref => OptTree-AutoMarkup.ref} (100%) diff --git a/src/compiler/OptTree-AutoMarkup-Drive.ref b/src/compiler/OptTree-AutoMarkup.ref similarity index 100% rename from src/compiler/OptTree-AutoMarkup-Drive.ref rename to src/compiler/OptTree-AutoMarkup.ref diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index 761bb3ba..4151054f 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -7,7 +7,7 @@ $EXTERN Config-GetTreeOptCycles, Config-GetOptDrive, Config-GetOptSpec, *$FROM OptTree-AutoMarkup-Spec $EXTERN OptTree-AutoMarkup-Spec; -*$FROM OptTree-AutoMarkup-Drive +*$FROM OptTree-AutoMarkup $EXTERN OptTree-AutoMarkup-Drive, OptTree-AutoMarkup-CureDrives, OptTree-AutoMarkup-CleanupUnusedFunctions; From cc1c43f75ffa494075e090b9bf1717df81a86f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 18:02:05 +0300 Subject: [PATCH 166/208] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC.?= =?UTF-8?q?=20OptTree-AutoMarkup-Spec.ref=20=E2=86=92=20OptTree-AutoMarkup?= =?UTF-8?q?.ref=20(#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Слияние выполняется через два последовательных переименования для сохранения истории правок. --- .../{OptTree-AutoMarkup-Spec.ref => OptTree-AutoMarkup.ref} | 0 src/compiler/OptTree.ref | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/compiler/{OptTree-AutoMarkup-Spec.ref => OptTree-AutoMarkup.ref} (100%) diff --git a/src/compiler/OptTree-AutoMarkup-Spec.ref b/src/compiler/OptTree-AutoMarkup.ref similarity index 100% rename from src/compiler/OptTree-AutoMarkup-Spec.ref rename to src/compiler/OptTree-AutoMarkup.ref diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index 761bb3ba..5a54ded3 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -4,7 +4,7 @@ $INCLUDE "LibraryEx"; $EXTERN Config-GetTreeOptCycles, Config-GetOptDrive, Config-GetOptSpec, Config-GetOptAutoMarkup, Config-GetOptIntrinsic; -*$FROM OptTree-AutoMarkup-Spec +*$FROM OptTree-AutoMarkup $EXTERN OptTree-AutoMarkup-Spec; *$FROM OptTree-AutoMarkup-Drive From ad36147ea5645348b1bc542e3ac01c7f47cc75a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 18:20:24 +0300 Subject: [PATCH 167/208] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=B0=D0=BA=D1=82=D1=83=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BF=D1=80=D0=BE=D1=85=D0=BE=D0=B4=20=C2=ABCur?= =?UTF-8?q?e=20drives=C2=BB=20(#314,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit После удаления интеллектуальной авторазметки данный проход стал пустым, теперь он и вовсе удалён. Это не рефакторинг, поскольку содержимое лога изменилось. --- src/compiler/OptTree-AutoMarkup.ref | 8 -------- src/compiler/OptTree.ref | 5 +---- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/compiler/OptTree-AutoMarkup.ref b/src/compiler/OptTree-AutoMarkup.ref index 0f5a834e..1b2da8cc 100644 --- a/src/compiler/OptTree-AutoMarkup.ref +++ b/src/compiler/OptTree-AutoMarkup.ref @@ -260,14 +260,6 @@ WrapBucket { s.Hash e.Bucket = (s.Hash e.Bucket); } -/** - == e.AST -*/ -$ENTRY OptTree-AutoMarkup-CureDrives { - e.AST = e.AST; -} - - /** == e.AST */ diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index 891d611b..5cd66833 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -6,7 +6,7 @@ $EXTERN Config-GetTreeOptCycles, Config-GetOptDrive, Config-GetOptSpec, *$FROM OptTree-AutoMarkup $EXTERN OptTree-AutoMarkup-Spec, OptTree-AutoMarkup-Drive, - OptTree-AutoMarkup-CureDrives, OptTree-AutoMarkup-CleanupUnusedFunctions; + OptTree-AutoMarkup-CleanupUnusedFunctions; *$FROM OptTree-Drive $EXTERN OptTree-Drive-Prepare, OptTree-Drive, OptTree-Drive-CleanupColdCalls; @@ -53,9 +53,6 @@ $ENTRY OptTree { (call &OptTree-Drive-Prepare t.OptDrive) (DriveLoop)) (begin - (when (or s.OptDrive s.OptIntrinsic) - (trace 'before Curing drives') - (call &OptTree-AutoMarkup-CureDrives)) (DriveSpecLoop))) (trace 'before Cleanup unused functions') (call &OptTree-AutoMarkup-CleanupUnusedFunctions) From 05d0884d2c022ab46c4293ec1c482b5914d79590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 18:41:10 +0300 Subject: [PATCH 168/208] =?UTF-8?q?=D0=A3=D1=82=D0=BE=D1=87=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BD=D0=B0=C2=A0=D1=81=D0=B8?= =?UTF-8?q?=D0=BD=D1=82=D0=B0=D0=BA=D1=81=D0=B8=D1=87=D0=B5=D1=81=D0=BA?= =?UTF-8?q?=D0=BE=D0=B5=20=D0=B4=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/README.md b/src/compiler/README.md index 4430861c..da2f67b5 100644 --- a/src/compiler/README.md +++ b/src/compiler/README.md @@ -132,13 +132,14 @@ s.Mode ::= Classic | Extended t.Unit ::= t.Function | t.Extern | t.SingleDeclaration | t.Include - | t.NativeBlock | t.Ident | t.SpecUnit + | t.NativeBlock | t.Markup | t.SpecUnit t.Extern ::= (Declaration t.Pos GN-Entry e.Name) t.SingleDeclaration ::= (s.SingleDeclarationTag t.Pos s.ScopeClass e.Name) s.SingleDeclarationTag ::= Enum | Swap | LegacyInline | LegacyDrive | Meta t.Include ::= (Include t.Pos e.Name) t.NativeBlock ::= (NativeBlock t.Pos e.Code) - t.Ident ::= (Ident t.SrcPos e.Name) + t.Markup ::= (s.Markup t.SrcPos e.Name) + s.Markup ::= Ident | Opt | Drive | Spec | NoOpt | NoDrive | NoSpec t.SpecUnit ::= (LegacySpec t.Pos (e.Name) e.Pattern) t.Function ::= (Function t.SrcPos s.ScopeClass (e.Name) e.Body) From c98fd25e263a04d8d85b9fdacc551ad4c72ef829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 19:07:08 +0300 Subject: [PATCH 169/208] =?UTF-8?q?=D0=9F=D1=81=D0=B5=D0=B2=D0=B4=D0=BE?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8?= =?UTF-8?q?=D0=B9=20*$IDENT=20=D0=BA=D0=B0=D0=BA=20=D0=B7=D0=B0=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=B2=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D1=81=D0=BB=D0=BE=D0=B2=D0=B0=20$LABEL=20(#195)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В заявке #195 предлагалось заменить $LABEL на *$PRAGMA-NATIVE-IDENTS, но было выбрано слово $IDENT. Во-первых, вещь второстепенная и с удалением нативных вставок (см. #318) она будет удалена, во-вторых, имеющийся код легко расширить новым ключевым словом, если оно совпадает с точностью до регистра с узлом дерева. А директива $LABEL отображается на узел дерева (Ident t.Pos e.Name). --- autotests/refal5-pseudocomment-ident.ref | 15 +++++++++++++++ src/compiler/R5-Parser.ref | 22 +++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 autotests/refal5-pseudocomment-ident.ref diff --git a/autotests/refal5-pseudocomment-ident.ref b/autotests/refal5-pseudocomment-ident.ref new file mode 100644 index 00000000..8a2481cc --- /dev/null +++ b/autotests/refal5-pseudocomment-ident.ref @@ -0,0 +1,15 @@ +*$IDENT _-x; + +$ENTRY Go { +%% + (void) arg_begin; + (void) arg_end; + + refalrts::RefalIdentifier mingled = refalrts::ident_implode(vm, "_-x"); + if (mingled != identifiers[ident_u_m_x]) { + return refalrts::cRecognitionImpossible; + } + + return refalrts::cSuccess; +%% +} diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index d5270416..18be12b5 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -85,35 +85,39 @@ DoScanPseudocomments { ParsePseudocomment { t.ErrorList t.Pos (TkName t._ e.Name) e.Tokens - , Opt Drive Spec NoOpt NoDrive NoSpec : e._ s.Node e._ + , Opt Drive Spec NoOpt NoDrive NoSpec Ident : e._ s.Node e._ , > : e.Name - = ; + = ; t.ErrorList t.Pos e._unrecognized = t.ErrorList /* пропускаем неопознанный псевдокомментарий */; } -ParseOptPseudocomment { +ParseNameListPseudocomment { t.Pos s.Node (e.Scanned) t.ErrorList (TkName t.NamePos e.Name) e.Tokens - = ; t.Pos s.Node (e.Scanned) t.ErrorList (s.Separator t._) e.Tokens , TkComma TkSemicolon : e._ s.Separator e._ - = ; + = ; t.Pos s.Node (/* нет имён */) t.ErrorList (TkEOF t._) = ; t.Pos s.Node (e.Scanned) t.ErrorList (TkEOF t._) = t.ErrorList e.Scanned; t.Pos s.Node (e.Scanned) t.ErrorList (TkError t.ErrPos e.Message) e.Tokens - = e.Tokens @@ -121,7 +125,7 @@ ParseOptPseudocomment { t.Pos s.Node (e.Scanned) t.ErrorList (TkWarning t.WarnPos s.Type e.Message) e.Tokens - = e.Tokens @@ -129,7 +133,7 @@ ParseOptPseudocomment { t.Pos s.Node (e.Scanned) t.ErrorList t.Unexpected e.Tokens = t.Unexpected : (s.Type t.TokPos e.Value) - = Date: Mon, 23 Aug 2021 22:07:32 +0300 Subject: [PATCH 170/208] =?UTF-8?q?src/lib:=20=D0=BF=D1=81=D0=B5=D0=B2?= =?UTF-8?q?=D0=B4=D0=BE=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0?= =?UTF-8?q?=D1=80=D0=B8=D0=B8=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20?= =?UTF-8?q?=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=B2=D1=8B=D1=85=20=D1=81=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20(#195,=20#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/Library.ref | 10 +++++----- src/lib/common/LibraryEx.refi | 25 ++++++++++--------------- src/lib/common/refal5-builtins.refi | 2 +- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/lib/Library.ref b/src/lib/Library.ref index 4e8b36f6..24d21b4e 100644 --- a/src/lib/Library.ref +++ b/src/lib/Library.ref @@ -839,7 +839,7 @@ ZeroHandle { s.FileNo s.Default = s.FileNo; } -$LABEL stdin, stdout, stderr, stout; +*$IDENT stdin, stdout, stderr, stout %% namespace { @@ -2542,7 +2542,7 @@ $ENTRY Close { 55. == True | False e.FileName ::= s.CHAR* */ -$LABEL True, False; +*$IDENT True, False $ENTRY ExistFile { %% @@ -3585,7 +3585,7 @@ $ENTRY FTell { s.Sign ::= '+' | '-' s.Offset ::= s.MACRODIGIT */ -$LABEL CURRENT, BEGIN, END; +*$IDENT CURRENT, BEGIN, END $ENTRY FSeek { %% @@ -3706,7 +3706,7 @@ $ENTRY RenameFile { e.Errors ::= пусто TODO: поддержка сообщений об ошибках */ -$LABEL Success, Fails; +*$IDENT Success, Fails $ENTRY Module-Load { %% @@ -3799,7 +3799,7 @@ $ENTRY Module-Unload { s.FunctionName ::= s.COMPOUND e.FunctionName ::= s.CHAR+ */ -$LABEL GLOBAL, CURRENT, CURRENT-AND-GLOBAL; +*$IDENT GLOBAL, CURRENT, CURRENT-AND-GLOBAL %% namespace cookie_ns { diff --git a/src/lib/common/LibraryEx.refi b/src/lib/common/LibraryEx.refi index aea07b56..1e985445 100644 --- a/src/lib/common/LibraryEx.refi +++ b/src/lib/common/LibraryEx.refi @@ -15,7 +15,7 @@ Apply { = ; } -$INLINE Apply; +*$OPT Apply /** @@ -29,8 +29,7 @@ Map { t.Fn /* пусто */ = /* пусто */; } -$INLINE Map; -$SPEC Map t.FUNC e.items; +*$OPT Map /** @@ -47,16 +46,14 @@ Reduce { t.Fn t.Acc /* пусто */ = t.Acc; } -$INLINE Reduce; -$SPEC Reduce t.FUNC t.accum e.items; +*$OPT Reduce Fetch { e.Argument t.Function = ; } -$INLINE Fetch; -$SPEC Fetch e.arg t.FUNC; +*$OPT Fetch /** @@ -71,8 +68,7 @@ MapAccum { gen-e__ { e.arg = e.arg } -$SPEC MapAccum t.FUNC t.accum e.items; -$INLINE MapAccum; +*$OPT MapAccum DoMapAccum { t.Fn t.Acc (e.Scanned) t.Next e.Tail @@ -84,15 +80,14 @@ DoMapAccum { t.Fn t.Acc (e.Scanned) /* пусто */ = t.Acc e.Scanned; } -$INLINE DoMapAccum; -$SPEC DoMapAccum t.FUNC t.acc (e.scanned) e.items; +*$OPT DoMapAccum UnBracket { (e.Expr) = e.Expr; } -$DRIVE UnBracket; +*$DRIVE UnBracket /** @@ -102,7 +97,7 @@ DelAccumulator { t.Acc e.Tail = e.Tail; } -$DRIVE DelAccumulator; +*$DRIVE DelAccumulator /** @@ -119,7 +114,7 @@ Dec { e.Num = ; } -$INLINE Inc, Dec; +*$DRIVE Inc, Dec /** @@ -138,7 +133,7 @@ Pipe { /* пусто */ = { e.Arg = e.Arg; }; } -$INLINE Pipe; +*$DRIVE Pipe *$FROM LibraryEx diff --git a/src/lib/common/refal5-builtins.refi b/src/lib/common/refal5-builtins.refi index b548e77a..b66008d9 100644 --- a/src/lib/common/refal5-builtins.refi +++ b/src/lib/common/refal5-builtins.refi @@ -256,7 +256,7 @@ $ENUM Ev-met; $META Residue; __Meta_Residue { e.Arg = <__Step-Drop> <__Meta_Mu e.Arg> } -$INLINE __Meta_Residue; +*$DRIVE __Meta_Residue * 51. GetEnv From 59a44ac1a6d38c651d432e076393ed1a6ca1dddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 22:10:10 +0300 Subject: [PATCH 171/208] =?UTF-8?q?src/compiler:=20=D0=BF=D1=81=D0=B5?= =?UTF-8?q?=D0=B2=D0=B4=D0=BE=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B8=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE?= =?UTF-8?q?=20=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=B2=D1=8B=D1=85=20=D1=81?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=20(#195,=20#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/Escape.ref | 2 +- src/common/FindFile.ref | 2 +- src/compiler/Engine.ref | 15 ++------------- src/compiler/Generator-RASL.ref | 16 ++++++++-------- src/compiler/GenericMatch.ref | 2 +- src/compiler/Log-AST.ref | 2 +- src/compiler/OptTree-Drive-Expr.ref | 6 +++--- src/compiler/OptTree-StopRelation.ref | 2 +- src/compiler/OptTree.ref | 4 ++-- src/compiler/R5-Lexer.ref | 6 +++--- src/compiler/R5-Parser.ref | 4 ++-- src/compiler/main.ref | 6 +++--- 12 files changed, 28 insertions(+), 39 deletions(-) diff --git a/src/common/Escape.ref b/src/common/Escape.ref index 4bfafb26..c3bf4e7e 100644 --- a/src/common/Escape.ref +++ b/src/common/Escape.ref @@ -30,7 +30,7 @@ $ENTRY EscapeChar { }; } -$DRIVE EscapeChar; +*$DRIVE EscapeChar $ENTRY EscapeString { e.String = ; diff --git a/src/common/FindFile.ref b/src/common/FindFile.ref index 1ab55ba8..76fa8501 100644 --- a/src/common/FindFile.ref +++ b/src/common/FindFile.ref @@ -5,7 +5,7 @@ $EXTERN Map; $EXTERN DirectorySeparator, PathSeparator; -$INLINE DS; +*$DRIVE DS DS { = } diff --git a/src/compiler/Engine.ref b/src/compiler/Engine.ref index b5f5c2e6..d4e65045 100644 --- a/src/compiler/Engine.ref +++ b/src/compiler/Engine.ref @@ -406,14 +406,13 @@ PatchASTSrcPos { = ; } -$SPEC PatchAST s.FN-PATCH e.ast; +*$SPEC PatchAST, PatchAST-Item, PatchAST-Body, PatchAST-Sentence, +*$ PatchAST-Chain, PatchAST-Blocks, PatchAST-Expr PatchAST { s.FnPatch e.AST = ; } -$SPEC PatchAST-Item s.FN-PATCH t.item; - PatchAST-Item { s.FnPatch (Function t.SrcPos s.ScopeClass (e.Name) e.Body) = (Function @@ -450,8 +449,6 @@ PatchAST-Item { ); } -$SPEC PatchAST-Body s.FN-PATCH e.body; - PatchAST-Body { s.FnPatch Sentences e.Sentences = Sentences ; @@ -472,8 +469,6 @@ PatchAST-Body { >; } -$SPEC PatchAST-Sentence s.FN-PATCH t.sentence; - PatchAST-Sentence { s.FnPatch ((e.Pattern) e.ConditionsAndAssigns (e.Result) (e.Blocks)) = { e.Expr = ; } : s.FnPatchExpr @@ -485,8 +480,6 @@ PatchAST-Sentence { ); } -$SPEC PatchAST-Chain s.FN-PATCH s.FN-PATCH-EXPR e.chain; - PatchAST-Chain { s.FnPatch s.FnPatchExpr e.ConditionsAndAssigns = ; } -$SPEC PatchAST-Blocks s.FN-PATCH e.blocks; - PatchAST-Blocks { s.FnPatch e.Blocks = ; } -$SPEC PatchAST-Expr s.FN-PATCH e.expr; - PatchAST-Expr { s.FnPatch e.Expression = ; } -$INLINE BytesFromString; +*$DRIVE BytesFromString BytesFromString { e.String = ; } -$INLINE Asciiz; +*$DRIVE Asciiz Asciiz { e.String = 0; } -$INLINE PutBlock; +*$DRIVE PutBlock PutBlock { s.Type e.Bytes = @@ -126,7 +126,7 @@ PutWordLE { = ; } -$DRIVE NameWithSign-Bytes; +*$DRIVE NameWithSign-Bytes NameWithSign-Bytes { GN-Entry e.Name = >; @@ -389,7 +389,7 @@ GenCommand-RASL { ; } -$INLINE PutCommand; +*$DRIVE PutCommand PutCommand { s.Symbolic = ( 0 0 0); @@ -410,7 +410,7 @@ PutCommand { }; } -$DRIVE CreateCommandTag; +*$DRIVE CreateCommandTag CreateCommandTag { ElOpenBracket = ElBracket; @@ -423,7 +423,7 @@ CreateCommandTag { s.Other = s.Other; } -$DRIVE CreateCommandInfo; +*$DRIVE CreateCommandInfo CreateCommandInfo { ElChar s.Char = ; diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 8286dba9..d2bf24bd 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -2103,7 +2103,7 @@ AddContractions-Spec-Symm { == PRTC */ -$DRIVE AddContraction-Spec, AddContraction-Spec-Symm; +*$DRIVE AddContraction-Spec, AddContraction-Spec-Symm AddContraction-Spec { t.toAdd (s.OpenFlag e.Contrs) e.Clashes (e.Assigns) diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index 71482ccf..c2dc2eef 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -220,7 +220,7 @@ Tail-GEN { = ; } -$SPEC Expression (e.prefix) (e.indent) e.expression (e.suffix); +*$NOOPT Expression Expression { (e.Prefix) (e.Indent) /* пусто */ (e.Suffix) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index b2759288..269e5084 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -42,11 +42,11 @@ ColdAll { MaxCntNodes { = 100 } -$DRIVE MaxCntNodes; +*$DRIVE MaxCntNodes MaxTreeDepth { = 20 } -$DRIVE MaxTreeDepth; +*$DRIVE MaxTreeDepth IncWithMax { s.Cnt s.Max, : '+' = ; @@ -471,7 +471,7 @@ FindOptInfo-Aux { ((e.Name) Sentences ); } -$DRIVE CutSUF; +*$DRIVE CutSUF CutSUF { e.Prefix SUF = e.Prefix; diff --git a/src/compiler/OptTree-StopRelation.ref b/src/compiler/OptTree-StopRelation.ref index f4c6cf05..f337cbe9 100644 --- a/src/compiler/OptTree-StopRelation.ref +++ b/src/compiler/OptTree-StopRelation.ref @@ -37,7 +37,7 @@ $ENTRY OptTree-CheckExprStopRelation { (e.CurrentExpr) e.HistoryExpr = ; } -*$DRIVE Trace; +*$DRIVE Trace Trace { */* diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index 5cd66833..597d254e 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -244,7 +244,7 @@ Int-Cond { s.Opt = True; } -$INLINE Int-Cond; +*$DRIVE Int-Cond Int-Cond-Or { t.Cond e.Flags @@ -283,7 +283,7 @@ Int-LoopForWarmFunctions { (e.Defines) e.Code s.Cycles (e.AST) = s.Cycles e.AST; } -$INLINE Int-Lookup; +*$DRIVE Int-Lookup Int-Lookup { s.ProcName (define s.ProcName e.Body) e._ = e.Body; diff --git a/src/compiler/R5-Lexer.ref b/src/compiler/R5-Lexer.ref index 8ab7ec93..20995704 100644 --- a/src/compiler/R5-Lexer.ref +++ b/src/compiler/R5-Lexer.ref @@ -88,7 +88,7 @@ IncLine { (RowCol s.Line s.Col) = (RowCol 1); } -$DRIVE IncCol; +*$DRIVE IncCol IncCol { (RowCol s.Line s.Col) = (RowCol s.Line ); @@ -275,7 +275,7 @@ DoScan-BuildKeyword { (e.Line) e.Lines>; } -$INLINE EasterEgg; +*$DRIVE EasterEgg EasterEgg { t.Pos s.Char e.Text = (TkChar t.Pos s.Char) ; @@ -462,7 +462,7 @@ HexDigit { }; } -$INLINE DoHexDigit; +*$DRIVE DoHexDigit DoHexDigit { s.Digit e.Samples s.Val s.Digit = s.Val; diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index 18be12b5..a184b063 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -769,7 +769,7 @@ Expression { >; } -$INLINE TokenChain, Expression; +*$DRIVE TokenChain, Expression TokenChain { t.ErrorList s.Mode s.Kind e.Tokens @@ -1031,7 +1031,7 @@ Expression-CheckBrackets { = t.ErrorList t.Expression e.Tokens; } -$DRIVE ClassicError; +*$DRIVE ClassicError ClassicError { t.ErrorList Classic t.Pos e.Message diff --git a/src/compiler/main.ref b/src/compiler/main.ref index c8ffb1da..3d6fcd4d 100644 --- a/src/compiler/main.ref +++ b/src/compiler/main.ref @@ -72,7 +72,7 @@ Main-SwValidCommandLine { = ; } -$INLINE ReportErrors, ReportWarnings, ReportMessages; +*$DRIVE ReportErrors, ReportWarnings, ReportMessages ReportErrors { t.CommandLineSource t.Config e.Errors @@ -348,7 +348,7 @@ RenameLocations-Aux { = e.NewLocations; } -$INLINE AddNumSuffix; +*$DRIVE AddNumSuffix AddNumSuffix { 0 e.Output = e.Output; @@ -946,7 +946,7 @@ DoCopyPrefix { } } -$INLINE LinkError; +*$DRIVE LinkError LinkError { t.Config e.Message From 29e7c0329ddfe69b497d6bf603142447346ea450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 22:10:39 +0300 Subject: [PATCH 172/208] =?UTF-8?q?=D0=92=D1=8B=D0=B4=D0=B0=D1=87=D0=B0=20?= =?UTF-8?q?-Wdeprecated=20=D0=BD=D0=B0=C2=A0$DRIVE,=20$INLINE,=20$LABEL,?= =?UTF-8?q?=20$SPEC=20(#195,#314,#318)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/deprecated-drive.WARNING.ref | 9 +++++++++ autotests/deprecated-inline.WARNING.ref | 9 +++++++++ .../deprecated-refal5-keyword-label.WARNING.ref | 17 +++++++++++++++++ autotests/deprecated-spec.WARNING.ref | 9 +++++++++ src/compiler/R5-Lexer.ref | 16 ++++++++++------ 5 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 autotests/deprecated-drive.WARNING.ref create mode 100644 autotests/deprecated-inline.WARNING.ref create mode 100644 autotests/deprecated-refal5-keyword-label.WARNING.ref create mode 100644 autotests/deprecated-spec.WARNING.ref diff --git a/autotests/deprecated-drive.WARNING.ref b/autotests/deprecated-drive.WARNING.ref new file mode 100644 index 00000000..ff723a40 --- /dev/null +++ b/autotests/deprecated-drive.WARNING.ref @@ -0,0 +1,9 @@ +* WARNING deprecated + +$ENTRY Go { + = +} + +$DRIVE F; + +F { = } diff --git a/autotests/deprecated-inline.WARNING.ref b/autotests/deprecated-inline.WARNING.ref new file mode 100644 index 00000000..c7792a58 --- /dev/null +++ b/autotests/deprecated-inline.WARNING.ref @@ -0,0 +1,9 @@ +* WARNING deprecated + +$ENTRY Go { + = +} + +$INLINE F; + +F { = } diff --git a/autotests/deprecated-refal5-keyword-label.WARNING.ref b/autotests/deprecated-refal5-keyword-label.WARNING.ref new file mode 100644 index 00000000..cebbf23a --- /dev/null +++ b/autotests/deprecated-refal5-keyword-label.WARNING.ref @@ -0,0 +1,17 @@ +* WARNING deprecated + +$LABEL _-x; + +$ENTRY Go { +%% + (void) arg_begin; + (void) arg_end; + + refalrts::RefalIdentifier mingled = refalrts::ident_implode(vm, "_-x"); + if (mingled != identifiers[ident_u_m_x]) { + return refalrts::cRecognitionImpossible; + } + + return refalrts::cSuccess; +%% +} diff --git a/autotests/deprecated-spec.WARNING.ref b/autotests/deprecated-spec.WARNING.ref new file mode 100644 index 00000000..1bba37d2 --- /dev/null +++ b/autotests/deprecated-spec.WARNING.ref @@ -0,0 +1,9 @@ +* WARNING deprecated + +$ENTRY Go { + = +} + +$SPEC F e.X; + +F { e.X = e.X } diff --git a/src/compiler/R5-Lexer.ref b/src/compiler/R5-Lexer.ref index 20995704..8ff2dcd8 100644 --- a/src/compiler/R5-Lexer.ref +++ b/src/compiler/R5-Lexer.ref @@ -253,18 +253,22 @@ DoScan-BuildKeyword { , (TkExtern '$EXTERN') (TkExtern '$EXTRN') (TkExtern '$EXTERNAL') (TkEntry '$ENTRY') (TkEnum '$ENUM') (TkEEnum '$EENUM') (TkSwap '$SWAP') (TkESwap '$ESWAP') (TkInclude '$INCLUDE') - (TkLabel '$LABEL') + (TkLabel '$LABEL') (TkScopeId '$SCOPEID') (TkInline '$INLINE') (TkDrive '$DRIVE') (TkSpec '$SPEC') (TkMeta '$META') (TkIntrinsic '$INTRINSIC') : e.Keywords-B (s.Tag e.KeywordChars) e.Keywords-E = (s.Tag t.Pos) - (e.Line) e.Lines>; + (e.Line) e.Lines>; + e._ = /* нет предупреждения */ + } + > + (e.Line) e.Lines>; t.Pos ('$EASTEREGG') (e.Line) e.Lines = From 01d3135634b7f1c71feaa75ba60c40f7e431367f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 23 Aug 2021 22:27:17 +0300 Subject: [PATCH 173/208] =?UTF-8?q?FIXED:=20=D1=81=D0=BE=D0=B2=D0=BC=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D1=8C=20=D1=81=D0=BE?= =?UTF-8?q?=C2=A0=D1=81=D1=82=D0=B0=D0=B1=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B5=D0=B9=20(#195,=20?= =?UTF-8?q?#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Стабильная версия иначе интерпретировала псевдокомментарии и выдавала на них ошибки компиляции. Для обеспечения совместимости внедрён костыль в виде псевдокомментариев вида *$xDRIVE. После обновления стабильной версии данный костыль нужно будет удалить. Подробности в комментарии в коде. --- src/common/Escape.ref | 2 +- src/common/FindFile.ref | 2 +- src/compiler/Engine.ref | 2 +- src/compiler/Generator-RASL.ref | 16 ++++++++-------- src/compiler/GenericMatch.ref | 2 +- src/compiler/OptTree-Drive-Expr.ref | 6 +++--- src/compiler/OptTree-StopRelation.ref | 2 +- src/compiler/OptTree.ref | 4 ++-- src/compiler/R5-Lexer.ref | 6 +++--- src/compiler/R5-Parser.ref | 24 +++++++++++++++++++++--- src/compiler/main.ref | 6 +++--- 11 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/common/Escape.ref b/src/common/Escape.ref index c3bf4e7e..1949eb72 100644 --- a/src/common/Escape.ref +++ b/src/common/Escape.ref @@ -30,7 +30,7 @@ $ENTRY EscapeChar { }; } -*$DRIVE EscapeChar +*$xDRIVE EscapeChar $ENTRY EscapeString { e.String = ; diff --git a/src/common/FindFile.ref b/src/common/FindFile.ref index 76fa8501..01b640e5 100644 --- a/src/common/FindFile.ref +++ b/src/common/FindFile.ref @@ -5,7 +5,7 @@ $EXTERN Map; $EXTERN DirectorySeparator, PathSeparator; -*$DRIVE DS +*$xDRIVE DS DS { = } diff --git a/src/compiler/Engine.ref b/src/compiler/Engine.ref index d4e65045..3329990a 100644 --- a/src/compiler/Engine.ref +++ b/src/compiler/Engine.ref @@ -406,7 +406,7 @@ PatchASTSrcPos { = ; } -*$SPEC PatchAST, PatchAST-Item, PatchAST-Body, PatchAST-Sentence, +*$xSPEC PatchAST, PatchAST-Item, PatchAST-Body, PatchAST-Sentence, *$ PatchAST-Chain, PatchAST-Blocks, PatchAST-Expr PatchAST { diff --git a/src/compiler/Generator-RASL.ref b/src/compiler/Generator-RASL.ref index 051177be..a9c29d33 100644 --- a/src/compiler/Generator-RASL.ref +++ b/src/compiler/Generator-RASL.ref @@ -8,7 +8,7 @@ $EXTERN PrintErr; $INCLUDE "Opcodes"; -*$DRIVE NumberFromOpcode, NumberFromBracket, BlockTypeNumber +*$xDRIVE NumberFromOpcode, NumberFromBracket, BlockTypeNumber $ENTRY GenProgram-RASL { ( @@ -93,19 +93,19 @@ BytesFromStringList { >; } -*$DRIVE BytesFromString +*$xDRIVE BytesFromString BytesFromString { e.String = ; } -*$DRIVE Asciiz +*$xDRIVE Asciiz Asciiz { e.String = 0; } -*$DRIVE PutBlock +*$xDRIVE PutBlock PutBlock { s.Type e.Bytes = @@ -126,7 +126,7 @@ PutWordLE { = ; } -*$DRIVE NameWithSign-Bytes +*$xDRIVE NameWithSign-Bytes NameWithSign-Bytes { GN-Entry e.Name = >; @@ -389,7 +389,7 @@ GenCommand-RASL { ; } -*$DRIVE PutCommand +*$xDRIVE PutCommand PutCommand { s.Symbolic = ( 0 0 0); @@ -410,7 +410,7 @@ PutCommand { }; } -*$DRIVE CreateCommandTag +*$xDRIVE CreateCommandTag CreateCommandTag { ElOpenBracket = ElBracket; @@ -423,7 +423,7 @@ CreateCommandTag { s.Other = s.Other; } -*$DRIVE CreateCommandInfo +*$xDRIVE CreateCommandInfo CreateCommandInfo { ElChar s.Char = ; diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index d2bf24bd..752a8042 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -2103,7 +2103,7 @@ AddContractions-Spec-Symm { == PRTC */ -*$DRIVE AddContraction-Spec, AddContraction-Spec-Symm +*$xDRIVE AddContraction-Spec, AddContraction-Spec-Symm AddContraction-Spec { t.toAdd (s.OpenFlag e.Contrs) e.Clashes (e.Assigns) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 269e5084..3fdf009f 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -42,11 +42,11 @@ ColdAll { MaxCntNodes { = 100 } -*$DRIVE MaxCntNodes +*$xDRIVE MaxCntNodes MaxTreeDepth { = 20 } -*$DRIVE MaxTreeDepth +*$xDRIVE MaxTreeDepth IncWithMax { s.Cnt s.Max, : '+' = ; @@ -471,7 +471,7 @@ FindOptInfo-Aux { ((e.Name) Sentences ); } -*$DRIVE CutSUF +*$xDRIVE CutSUF CutSUF { e.Prefix SUF = e.Prefix; diff --git a/src/compiler/OptTree-StopRelation.ref b/src/compiler/OptTree-StopRelation.ref index f337cbe9..76a04d5c 100644 --- a/src/compiler/OptTree-StopRelation.ref +++ b/src/compiler/OptTree-StopRelation.ref @@ -37,7 +37,7 @@ $ENTRY OptTree-CheckExprStopRelation { (e.CurrentExpr) e.HistoryExpr = ; } -*$DRIVE Trace +*$xDRIVE Trace Trace { */* diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index 597d254e..51589a2e 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -244,7 +244,7 @@ Int-Cond { s.Opt = True; } -*$DRIVE Int-Cond +*$xDRIVE Int-Cond Int-Cond-Or { t.Cond e.Flags @@ -283,7 +283,7 @@ Int-LoopForWarmFunctions { (e.Defines) e.Code s.Cycles (e.AST) = s.Cycles e.AST; } -*$DRIVE Int-Lookup +*$xDRIVE Int-Lookup Int-Lookup { s.ProcName (define s.ProcName e.Body) e._ = e.Body; diff --git a/src/compiler/R5-Lexer.ref b/src/compiler/R5-Lexer.ref index 8ff2dcd8..89077ac6 100644 --- a/src/compiler/R5-Lexer.ref +++ b/src/compiler/R5-Lexer.ref @@ -88,7 +88,7 @@ IncLine { (RowCol s.Line s.Col) = (RowCol 1); } -*$DRIVE IncCol +*$xDRIVE IncCol IncCol { (RowCol s.Line s.Col) = (RowCol s.Line ); @@ -279,7 +279,7 @@ DoScan-BuildKeyword { (e.Line) e.Lines>; } -*$DRIVE EasterEgg +*$xDRIVE EasterEgg EasterEgg { t.Pos s.Char e.Text = (TkChar t.Pos s.Char) ; @@ -466,7 +466,7 @@ HexDigit { }; } -*$DRIVE DoHexDigit +*$xDRIVE DoHexDigit DoHexDigit { s.Digit e.Samples s.Val s.Digit = s.Val; diff --git a/src/compiler/R5-Parser.ref b/src/compiler/R5-Parser.ref index a184b063..98aef5e7 100644 --- a/src/compiler/R5-Parser.ref +++ b/src/compiler/R5-Parser.ref @@ -91,6 +91,24 @@ ParsePseudocomment { t.Pos s.Node (/* scanned */) t.ErrorList e.Tokens >; +/* + TODO: Стабильная версия 3.3 по-другому парсит ключевые слова и сообщает + об ошибках в них (не предупреждениях). Поэтому, чтобы можно было собрать + текущую версию и стабильной, и самой собой, для каждого ключевого слова + создаём синоним вида *$xDRIVE или *$xSPEC. Он игнорируется стабильной + версией 3.3 и работает в рабочей. + + TODO: после обновления стабильной версии нужно будет удалить поддержку + псевдокомментариев *$x..., а также почистить исходники. Для этой цели + добавлена заготовка предупреждения. +*/ + t.ErrorList t.Pos (TkName t.NamePos 'x' e.Name) e.Tokens +* = +* : t.ErrorList^ + = ; + t.ErrorList t.Pos e._unrecognized = t.ErrorList /* пропускаем неопознанный псевдокомментарий */; } @@ -769,14 +787,14 @@ Expression { >; } -*$DRIVE TokenChain, Expression +*$xDRIVE TokenChain, Expression TokenChain { t.ErrorList s.Mode s.Kind e.Tokens = } -*$NOOPT DoTokenChain +*$xNOOPT DoTokenChain DoTokenChain { s.Mode s.Kind t.ErrorList (e.Collected) t.NextToken e.Tokens @@ -1031,7 +1049,7 @@ Expression-CheckBrackets { = t.ErrorList t.Expression e.Tokens; } -*$DRIVE ClassicError +*$xDRIVE ClassicError ClassicError { t.ErrorList Classic t.Pos e.Message diff --git a/src/compiler/main.ref b/src/compiler/main.ref index 3d6fcd4d..ef658080 100644 --- a/src/compiler/main.ref +++ b/src/compiler/main.ref @@ -72,7 +72,7 @@ Main-SwValidCommandLine { = ; } -*$DRIVE ReportErrors, ReportWarnings, ReportMessages +*$xDRIVE ReportErrors, ReportWarnings, ReportMessages ReportErrors { t.CommandLineSource t.Config e.Errors @@ -348,7 +348,7 @@ RenameLocations-Aux { = e.NewLocations; } -*$DRIVE AddNumSuffix +*$xDRIVE AddNumSuffix AddNumSuffix { 0 e.Output = e.Output; @@ -946,7 +946,7 @@ DoCopyPrefix { } } -*$DRIVE LinkError +*$xDRIVE LinkError LinkError { t.Config e.Message From 4b3bae055709384402add2bd1399b46a693390f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 24 Aug 2021 23:09:25 +0300 Subject: [PATCH 174/208] =?UTF-8?q?Revert=20"=D0=98=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B5=D0=BA=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20TODO"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2b6be6371315a9e92be5d1a70b0c260f54ca1509. Одно TODO было «исправлено» без понимания проблемы, его откатил. --- src/compiler/OptTree-Spec.ref | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 3299473e..ed940660 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -509,10 +509,12 @@ ReplaceToGuards { (ADT-Brackets (e.Name) e.Nested) = (ADT-Brackets (e.Name) ); - /* вызов экземпляра, заменяем его суффикс пустую функцию */ + /* Уже пустая функция, ничего не делаем с ней */ + (Symbol Name e.Name '@' 0) = (Symbol Name e.Name '@' 0); + +* TODO: это костыль. Нужно понять, в чём проблема и удалить эту затычку. (Symbol Name e.Name '@' s._) = (Symbol Name e.Name '@' 0); - /* любой другой функции добавляем суффикс @0 */ (Symbol Name e.Name) = (Symbol Name ); t.Other = t.Other; From 15214980a87e2ad104f5896042d24e206f1e2e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 25 Aug 2021 16:59:14 +0300 Subject: [PATCH 175/208] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=B5=D0=BD=D0=B0=20?= =?UTF-8?q?gen=5Fe=5F=5F=20=D0=BD=D0=B0=C2=A0*$NODRIVE=20=D0=B2=C2=A0OptTr?= =?UTF-8?q?ee-Spec.ref=20(#332,=20#359)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index ed940660..3c1f2dce 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -590,14 +590,12 @@ SpecCall { : (e.UsedVars^) (e.NewArgument^) (e.Sg^) (e.Solutions) = ) s.NextNumber e.Signatures (e.UsedVars) - () (e.NewArgument) (e.Sg) (e.Solutions) (e.History) + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.Argument) (e.NewArgument) (e.Sg) (e.Solutions) (e.History) True >; } -gen_e__ { e.arg = e.arg } - /* Функция обобщает участки между двумя e-параметрами: … e.1 … e.2 … → … e.New …, e.1 … e.2 ← e.New @@ -656,6 +654,8 @@ DynGenArg { >; } +*$NODRIVE DoDynGenArg + DoDynGenArg { (e.UsedVars) (e.Arg) (e.Sg) (e.Sol) (e.Begin) ((e.Pat) e.Tail) e.Sentences @@ -827,8 +827,8 @@ SpecCall-NewSignature-Generalize { : (e.UsedVars^) (e.NewArg^) (e.Sg^) (e.Solutions^) = ) s.NextNumber e.Signatures (e.UsedVars) - () (e.NewArg) (e.Sg) (e.Solutions) (e.History) + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) s.NeedRelationCheck >; } From 9facfb47bcd209ea072a5907cab3ea5819ff8065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Thu, 26 Aug 2021 14:35:43 +0300 Subject: [PATCH 176/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D0=B3=D0=B8=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Устранение дублирования кода. • Прояснение имён переменных. --- src/compiler/OptTree-Spec.ref | 42 +++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 3c1f2dce..28beb8b4 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -585,13 +585,9 @@ SpecCall { = e.Sg e.ExtractedCalls : e.Sg^ - /* ищем динамическое обобщение для аргумента и образцов */ - = - : (e.UsedVars^) (e.NewArgument^) (e.Sg^) (e.Solutions) - - = ; } @@ -646,6 +642,22 @@ GenEE { = e.Expr (Var s.Mode e.Index) (e.UsedVars) (e.Sg); } +SpeCall-BuildSignature { + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.Argument) (e.NewArgument) (e.Sg) (e.History) + s.NeedRelationCheck + + /* ищем динамическое обобщение для аргумента и образцов */ + = + : (e.UsedVars^) (e.NewArgument^) (e.Sg^) (e.Solutions) + + = ; +} + DynGenArg { (e.UsedVars) (e.Arg) (e.Sg) e.Sentences = ; } -SpecCall-Aux { +SpecCall-CheckSignature { /* тривиальная сигнатура */ (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) @@ -741,7 +753,7 @@ SpecCall-Aux { s.NeedRelationCheck = : t._ e.Signature - = + = : { Found e.InstanceName (e.Signatures^) = ((e.Body) s.NextNumber e.Signatures) @@ -805,9 +817,8 @@ SpecCall-NewSignature-Generalize { = : { /* - Если подстановка e.NewSg является тривиальной, - проверку отношения Хигмана-Крускала - в рекурсивном вызове не выполняем + Если подстановка e.NewSg является тривиальной, проверку + отношения Хигмана-Крускала в рекурсивном вызове не выполняем */ True = False; @@ -823,12 +834,9 @@ SpecCall-NewSignature-Generalize { > : e.NewSg^ - = - : (e.UsedVars^) (e.NewArg^) (e.Sg^) (e.Solutions^) - - = ; } @@ -916,7 +924,7 @@ ApplySequentalAssigns { = } -Spec-FindInSignatures { +FindInSignatures { (e.Signature) e.Signatures-B ((e.InstanceName) e.Signature) e.Signatures-E = Found e.InstanceName From 1e9205dff77d06845eadc2f27baca53b20e8e66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Thu, 26 Aug 2021 16:34:23 +0300 Subject: [PATCH 177/208] =?UTF-8?q?=D0=9E=D1=82=D0=B4=D0=B5=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=81=D1=82=D0=BE=D0=B3=D0=BE=20=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=BA=D0=BB=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Рефакторингом в чистом виде он, скорее всего, не является, т.к. может изменить имена переменных в экземплярах, наблюдаемые в логе. --- src/compiler/OptTree-Spec.ref | 44 +++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 28beb8b4..40f90ba7 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -787,11 +787,11 @@ SpecCall-NewSignature { False = False; } : { - True e.HistorySignature + True (e.HistoryName) e.HistorySignature = ; False @@ -803,9 +803,43 @@ SpecCall-NewSignature { } SpecCall-NewSignature-Generalize { + /* + Зацикливание с тривиальной сигнатурой на дне. + Обобщение двух сигнатур дало бы тривиальную сигнатуру, + вызов которой соответствует вызову исходной функции. + */ (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - (e.Signature) (e.HistorySignature) + (e.Signature) (e.HistoryName '@' 0) (e.HistorySignature) + = ((e.Body) s.NextNumber e.Signatures) + (CallBrackets (Symbol Name e.Name) e.OldArg) + /* пусто */ (/* пусто */); + + /* Простое зацикливание: текущая сигнатура есть частный случай старой. */ + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) + (e.Signature) (e.HistoryName) (e.HistorySignature) + + , : Clear e.NewSg + + = + : e.NewSg^ + + = ((e.Body) s.NextNumber e.Signatures) + (CallBrackets + (Symbol Name e.HistoryName) + (e.NewSg e.Sg)> + ) + /* пусто */ (/* пусто */); + + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) + (e.Signature) (e.HistoryName) (e.HistorySignature) /* Получает обобщённую сигнатуру для двух сигнатур */ = : e.GenSignature @@ -1066,7 +1100,7 @@ OrderUniqueVars { /** - == True e.HistorySignature + == True (e.HistoryName) e.HistorySignature == False */ @@ -1077,7 +1111,7 @@ HasStopRelation { (e.Signature) > : True - = True e.HistorySignature; + = True (e.InstanceName) e.HistorySignature; (e.Name) (e.Signature) e.History ((e.InstanceName) e.HistorySignature) = ; From 7db5bdc1269f3b4f4d3ccb3e2d98d053d174c210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 28 Aug 2021 19:50:05 +0300 Subject: [PATCH 178/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=B4=D0=BB=D1=8F=20=D1=81?= =?UTF-8?q?=D0=BB=D0=B5=D0=B4=D1=83=D1=8E=D1=89=D0=B5=D0=B3=D0=BE=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=BC=D0=B8=D1=82=D0=B0=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 41 +++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 40f90ba7..7a824eb3 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -787,11 +787,11 @@ SpecCall-NewSignature { False = False; } : { - True (e.HistoryName) e.HistorySignature + True (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) = ; False @@ -809,16 +809,16 @@ SpecCall-NewSignature-Generalize { вызов которой соответствует вызову исходной функции. */ (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - (e.Signature) (e.HistoryName '@' 0) (e.HistorySignature) + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.Signature) + (e.History-B) ((e.HistoryName '@' 0) e.HistorySignature) (e.History-E) = ((e.Body) s.NextNumber e.Signatures) (CallBrackets (Symbol Name e.Name) e.OldArg) /* пусто */ (/* пусто */); /* Простое зацикливание: текущая сигнатура есть частный случай старой. */ (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - (e.Signature) (e.HistoryName) (e.HistorySignature) + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.Signature) + (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) , : Clear e.NewSg @@ -838,8 +838,8 @@ SpecCall-NewSignature-Generalize { /* пусто */ (/* пусто */); (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - (e.Signature) (e.HistoryName) (e.HistorySignature) + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.Signature) + (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) /* Получает обобщённую сигнатуру для двух сигнатур */ = : e.GenSignature @@ -870,7 +870,8 @@ SpecCall-NewSignature-Generalize { = ; } @@ -1100,23 +1101,31 @@ OrderUniqueVars { /** - == True (e.HistoryName) e.HistorySignature + == True (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) == False */ HasStopRelation { - (e.Name) (e.Signature) e.History ((e.InstanceName) e.HistorySignature) + (e.Name) (e.Signature) e.History + = +} + +DoHasStopRelation { + (e.Name) (e.Signature) e.History-B ((e.InstanceName) e.HistorySignature) + (e.History-E) , : e.Name , > : True - = True (e.InstanceName) e.HistorySignature; + = True (e.History-B) ((e.InstanceName) e.HistorySignature) (e.History-E); - (e.Name) (e.Signature) e.History ((e.InstanceName) e.HistorySignature) - = ; + (e.Name) (e.Signature) e.History-B t.HistoryItem (e.History-E) + = ; - (e.Name) (e.Signature) /* пустая история */ = False; + (e.Name) (e.Signature) /* пустая история */ (e.History-E) = False; } SourceNameOfInstance { From 2c10ff865f16f34aa244b6709e90d7f3b625bc55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 29 Aug 2021 11:53:36 +0300 Subject: [PATCH 179/208] =?UTF-8?q?=D0=98=D1=81=D1=82=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=81=D1=82=D1=80=D0=BE=D0=B8=D1=82=D1=81=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=B0=D0=BA=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B5=20=D1=81=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D1=85=D1=83=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Содержимое лога для теста bloat-basic.ref (приложенного к заявке) не изменилось за исключением вывода самой истории. Т.е. на данный тест замена никак не повлияла. На других примерах работу не испытывал. --- src/compiler/OptTree-Spec.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 7a824eb3..ddfbe67a 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -871,7 +871,7 @@ SpecCall-NewSignature-Generalize { = ; } From 82adda34762596bc9cfc4b80801967e1044c5537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 31 Aug 2021 18:36:16 +0300 Subject: [PATCH 180/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=80=D1=83=D1=87=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=81=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D0=BE=C2=A0s.NeedRelati?= =?UTF-8?q?onCheck=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Фактически, развёрнут последний виток цикла. --- src/compiler/OptTree-Spec.ref | 109 ++++++++++++++++++++++++++++------ 1 file changed, 90 insertions(+), 19 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index ddfbe67a..3422775b 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -585,10 +585,9 @@ SpecCall { = e.Sg e.ExtractedCalls : e.Sg^ - = ; } @@ -642,19 +641,17 @@ GenEE { = e.Expr (Var s.Mode e.Index) (e.UsedVars) (e.Sg); } -SpeCall-BuildSignature { +SpecCall-BuildSignature-True { (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.Argument) (e.NewArgument) (e.Sg) (e.History) - s.NeedRelationCheck /* ищем динамическое обобщение для аргумента и образцов */ = : (e.UsedVars^) (e.NewArgument^) (e.Sg^) (e.Solutions) - = ; } @@ -737,11 +734,10 @@ RemoveAssignByLeftPart { >; } -SpecCall-CheckSignature { +SpecCall-CheckSignature-True { /* тривиальная сигнатура */ (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - s.NeedRelationCheck , : True = ((e.Body) s.NextNumber e.Signatures) (CallBrackets (Symbol Name e.Name) e.OldArg) @@ -750,7 +746,6 @@ SpecCall-CheckSignature { /* проверяем, известна ли сигнатура */ (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - s.NeedRelationCheck = : t._ e.Signature = @@ -765,19 +760,19 @@ SpecCall-CheckSignature { /* проверяем на зацикливание */ NotFound e.Signatures^ - = ; }; } -SpecCall-NewSignature { +SpecCall-NewSignature-True { (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - s.NeedRelationCheck (e.Signature) - = s.NeedRelationCheck + (e.Signature) + = True : { True = : e.NewSg^ - = ; } @@ -896,6 +890,83 @@ SpecCall-NewSignature-MakeFunction { ); } +SpecCall-BuildSignature-False { + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.Argument) (e.NewArgument) (e.Sg) (e.History) + + /* ищем динамическое обобщение для аргумента и образцов */ + = + : (e.UsedVars^) (e.NewArgument^) (e.Sg^) (e.Solutions) + + = ; +} + +SpecCall-CheckSignature-False { + /* тривиальная сигнатура */ + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) + , : True + = ((e.Body) s.NextNumber e.Signatures) + (CallBrackets (Symbol Name e.Name) e.OldArg) + /* пусто */ (/* пусто */); + + /* проверяем, известна ли сигнатура */ + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) + = + : t._ e.Signature + = + : { + Found e.InstanceName (e.Signatures^) + = ((e.Body) s.NextNumber e.Signatures) + (CallBrackets + (Symbol Name e.InstanceName) + (e.Sg)> + ) + /* пусто */ (/* пусто */); + + /* проверяем на зацикливание */ + NotFound e.Signatures^ + = ; + }; +} + +SpecCall-NewSignature-False { + (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) + (e.Signature) + = False + : { + True + = ) e.History + >; + + False = False; + } + : { + True (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) + = ; + + False + = ; + } +} + ExtractCalls-Expr { (e.Calls (e.UsedVars)) e.Expr = ; From 427c49eff595a4626ab6c1c207a7318ee4597d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 31 Aug 2021 18:53:02 +0300 Subject: [PATCH 181/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D0=BE=D1=87=D0=B5=D0=B2?= =?UTF-8?q?=D0=B8=D0=B4=D0=BD=D1=8B=D0=B5=20=D1=83=D0=BF=D1=80=D0=BE=D1=89?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=B4=D0=B0=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 48 +++++------------------------------ 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 3422775b..244c33b1 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -772,15 +772,9 @@ SpecCall-NewSignature-True { (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) - = True - : { - True - = ) e.History - >; - - False = False; - } + = ) e.History + > : { True (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) = ; } SpecCall-CheckSignature-False { /* тривиальная сигнатура */ - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.Name) (e.Body) s.NextNumber e.Signatures (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) , : True = ((e.Body) s.NextNumber e.Signatures) @@ -914,7 +908,7 @@ SpecCall-CheckSignature-False { /* пусто */ (/* пусто */); /* проверяем, известна ли сигнатура */ - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) + (e.Name) (e.Body) s.NextNumber e.Signatures (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) = : t._ e.Signature @@ -930,36 +924,6 @@ SpecCall-CheckSignature-False { /* проверяем на зацикливание */ NotFound e.Signatures^ - = ; - }; -} - -SpecCall-NewSignature-False { - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - (e.Signature) - = False - : { - True - = ) e.History - >; - - False = False; - } - : { - True (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) - = ; - - False = Date: Tue, 31 Aug 2021 20:11:17 +0300 Subject: [PATCH 182/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D1=86=D0=B5=D0=BF=D0=BE=D1=87?= =?UTF-8?q?=D0=B5=D0=BA=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=BE=D0=B2=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Удалено промежуточное звено SpecCall-BuildSignature-***, • функция SpecCall-CheckSignature выпала из цепочки и стала нерекурсивной (избыточные параметры удалены). --- src/compiler/OptTree-Spec.ref | 110 ++++++++++++++++------------------ 1 file changed, 53 insertions(+), 57 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 244c33b1..f0fba0ae 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -641,20 +641,6 @@ GenEE { = e.Expr (Var s.Mode e.Index) (e.UsedVars) (e.Sg); } -SpecCall-BuildSignature-True { - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.Argument) (e.NewArgument) (e.Sg) (e.History) - - /* ищем динамическое обобщение для аргумента и образцов */ - = - : (e.UsedVars^) (e.NewArgument^) (e.Sg^) (e.Solutions) - - = ; -} - DynGenArg { (e.UsedVars) (e.Arg) (e.Sg) e.Sentences = ; } -SpecCall-CheckSignature-True { - /* тривиальная сигнатура */ +SpecCall-BuildSignature-True { (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - , : True - = ((e.Body) s.NextNumber e.Signatures) - (CallBrackets (Symbol Name e.Name) e.OldArg) - /* пусто */ (/* пусто */); + (e.OldArg) (e.NewArg) (e.Sg) (e.History) - /* проверяем, известна ли сигнатура */ - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - = - : t._ e.Signature - = + /* ищем динамическое обобщение для аргумента и образцов */ + = + : (e.UsedVars^) (e.NewArg^) (e.Sg^) (e.Solutions) + + = : { - Found e.InstanceName (e.Signatures^) - = ((e.Body) s.NextNumber e.Signatures) + (e.SpecInfo) Trivial + = (e.SpecInfo) + (CallBrackets (Symbol Name e.Name) e.OldArg) + /* пусто */ (/* пусто */); + + (e.SpecInfo) Known e.InstanceName + = (e.SpecInfo) (CallBrackets (Symbol Name e.InstanceName) (e.Sg)> ) /* пусто */ (/* пусто */); - /* проверяем на зацикливание */ - NotFound e.Signatures^ + (e.SpecInfo) NewSignature e.Signature + = e.SpecInfo : (e.Body^) s.NextNumber^ e.Signatures^ = ; + } +} + +SpecCall-CheckSignature { + /* тривиальная сигнатура */ + (e.Body) s.NextNumber e.Signatures (e.NewArg) + , : True + = ((e.Body) s.NextNumber e.Signatures) + Trivial; + + /* проверяем, известна ли сигнатура */ + (e.Body) s.NextNumber e.Signatures (e.NewArg) + = + : t._ e.Signature + = + : { + Found e.InstanceName (e.Signatures^) + = ((e.Body) s.NextNumber e.Signatures) + Known e.InstanceName; + + /* проверяем на зацикливание */ + NotFound e.Signatures^ + = ((e.Body) s.NextNumber e.Signatures) + NewSignature e.Signature; }; } @@ -890,40 +899,27 @@ SpecCall-BuildSignature-False { /* ищем динамическое обобщение для аргумента и образцов */ = - : (e.UsedVars^) (e.NewArgument^) (e.Sg^) (e.Solutions) + : (e.UsedVars^) (e.NewArg) (e.Sg^) (e.Solutions) - = ; -} - -SpecCall-CheckSignature-False { - /* тривиальная сигнатура */ - (e.Name) (e.Body) s.NextNumber e.Signatures - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - , : True - = ((e.Body) s.NextNumber e.Signatures) - (CallBrackets (Symbol Name e.Name) e.OldArg) - /* пусто */ (/* пусто */); - - /* проверяем, известна ли сигнатура */ - (e.Name) (e.Body) s.NextNumber e.Signatures - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - = - : t._ e.Signature - = + = : { - Found e.InstanceName (e.Signatures^) - = ((e.Body) s.NextNumber e.Signatures) + (e.SpecInfo) Trivial + = (e.SpecInfo) + (CallBrackets (Symbol Name e.Name) e.Argument) + /* пусто */ (/* пусто */); + + (e.SpecInfo) Known e.InstanceName + = (e.SpecInfo) (CallBrackets (Symbol Name e.InstanceName) (e.Sg)> ) /* пусто */ (/* пусто */); - /* проверяем на зацикливание */ - NotFound e.Signatures^ + (e.SpecInfo) NewSignature e.Signature + = e.SpecInfo : (e.Body^) s.NextNumber^ e.Signatures^ = Date: Tue, 31 Aug 2021 21:41:42 +0300 Subject: [PATCH 183/208] =?UTF-8?q?=D0=A8=D0=B0=D0=B3=20=D0=BA=C2=A0=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B5=20?= =?UTF-8?q?=D1=81=D0=B2=D0=B5=D1=80=D1=85=D1=83=C2=A0=E2=80=94=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8-=D0=BF=D0=B0=D1=82=D1=87?= =?UTF-8?q?=D0=B8=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Log-AST.ref | 5 +++ src/compiler/OptTree-Spec.ref | 72 ++++++++++++++++++----------------- src/compiler/OptTree.ref | 1 + 3 files changed, 43 insertions(+), 35 deletions(-) diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index c2dc2eef..7ea3c024 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -27,6 +27,7 @@ Element { (Entries e.Names) = ; (Function (e.Name) e.Body) = ; + (PatchFunc (e.Name) e.Body) = ; (ColdFunction s.ColdBy (e.Name) e.Body) = ; @@ -109,6 +110,10 @@ Function { (e.Name) e.Body = ) e.Body>; } +PatchFunc { + (e.Name) e.Body = ) e.Body>; +} + ColdFunction { s.ColdBy (e.Name) e.Body = diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index f0fba0ae..2b5bc387 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -844,19 +844,16 @@ SpecCall-NewSignature-Generalize { = : (e.UsedVars^) e.GenSignature^ + = : Clear e.PatchSg = : Clear e.NewSg - = - : { - /* - Если подстановка e.NewSg является тривиальной, проверку - отношения Хигмана-Крускала в рекурсивном вызове не выполняем - */ - True = &SpecCall-BuildSignature-False; - - False = &SpecCall-BuildSignature-True; - } - : s.SpecCall-BuildSignature + = + : e.PatchSg^ = : e.NewSg^ - = ; + > + : { + (e.SpecInfo) t.NewCall /* нет новых функций */ (e.NewHistory) + = (e.SpecInfo) t.NewCall /* нет новых функций */ (e.NewHistory); + + (e.SpecInfo) t.NewCall + (Function (e.NewName) Sentences e.NewBody) + (e.NewHistory) + = (e.SpecInfo) t.NewCall + (Function (e.NewName) Sentences e.NewBody) + (PatchFunc + (e.HistoryName) + Sentences + ( + () + /* = */ + ( + (CallBrackets + (Symbol Name e.NewName) + (e.PatchSg) + > + ) + ) + ) + ) + (e.NewHistory) + } } SpecCall-NewSignature-MakeFunction { @@ -999,28 +1023,6 @@ FindInSignatures { (e.Signature) e.Signatures = NotFound e.Signatures; } -/** - -*/ -IsTrivialSubstitutions { - e.StaticMatches - = ; -} - CreateNewSentences { (e.Arg) (e.NewSentences) (e.Solutions) (e.Body) = : e.PatternTemplate diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index 51589a2e..cf7b290a 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -106,6 +106,7 @@ $ENTRY OptTree-CleanupMarkup { (Specs e.Names) = /* пропускаем */; (NoDrives e.Names) = /* пропускаем */; (NoSpecs e.Names) = /* пропускаем */; + (PatchFunc e._) = /* пропускаем */; (DriveInfo e.Info) = /* пропускаем */; (SpecInfo e.Info) = /* пропускаем */; From 0a6e260a6ef8c58548f1df86b6820dbc2f818b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 1 Sep 2021 15:19:48 +0300 Subject: [PATCH 184/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BA=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D1=81=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D1=81=C2=A0=D0=BE=D0=B1=D0=BE=D0=B1=D1=89?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=D0=BC=D0=B8=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 280 ++++++++++++++-------------------- 1 file changed, 114 insertions(+), 166 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 2b5bc387..2908df25 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -585,7 +585,7 @@ SpecCall { = e.Sg e.ExtractedCalls : e.Sg^ - = ; @@ -720,22 +720,45 @@ RemoveAssignByLeftPart { >; } -SpecCall-BuildSignature-True { - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.History) +SpecCall-BuildSignature { + (e.Name) e.SpecInfo (e.UsedVars) + (e.SourceArg) (e.NewArg) (e.Sg) (e.History) + + = e.SpecInfo : (e.Body) s.NextNumber e.Signatures /* ищем динамическое обобщение для аргумента и образцов */ = : (e.UsedVars^) (e.NewArg^) (e.Sg^) (e.Solutions) - = + = + : { + (e.SpecInfo^) Trivial = (e.SpecInfo) Trivial; + + (e.SpecInfo^) Known e.InstanceName + = (e.SpecInfo) Known e.InstanceName (e.NewArg) (e.Sg); + + (e.SpecInfo^) NewSignature e.Signature + , ) e.History + > + : True e.HistoryPrefix ((e.HistoryName) e.HistorySignature) + = ; + + (e.SpecInfo^) NewSignature e.Signature + = (e.SpecInfo) + MakeFunction + (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) NoPatch; + } : { - (e.SpecInfo) Trivial + (e.SpecInfo^) Trivial = (e.SpecInfo) - (CallBrackets (Symbol Name e.Name) e.OldArg) + (CallBrackets (Symbol Name e.Name) e.SourceArg) /* пусто */ (/* пусто */); - (e.SpecInfo) Known e.InstanceName + (e.SpecInfo^) Known e.InstanceName (e.NewArg^) (e.Sg^) = (e.SpecInfo) (CallBrackets (Symbol Name e.InstanceName) @@ -743,13 +766,14 @@ SpecCall-BuildSignature-True { ) /* пусто */ (/* пусто */); - (e.SpecInfo) NewSignature e.Signature - = e.SpecInfo : (e.Body^) s.NextNumber^ e.Signatures^ - = ; + (e.SpecInfo^) + MakeFunction + (e.NewArg^) (e.Sg^) (e.Solutions^) (e.History^) (e.Signature) e.Patch + = } } @@ -777,130 +801,76 @@ SpecCall-CheckSignature { }; } -SpecCall-NewSignature-True { - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.History) - (e.Signature) - = ) e.History - > - : { - True (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) - = ; - - False - = ; - } -} - -SpecCall-NewSignature-Generalize { +SpecCall-Generalize { /* Зацикливание с тривиальной сигнатурой на дне. Обобщение двух сигнатур дало бы тривиальную сигнатуру, вызов которой соответствует вызову исходной функции. */ - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.Signature) - (e.History-B) ((e.HistoryName '@' 0) e.HistorySignature) (e.History-E) - = ((e.Body) s.NextNumber e.Signatures) - (CallBrackets (Symbol Name e.Name) e.OldArg) - /* пусто */ (/* пусто */); + e.SpecInfo (e.UsedVars) (e.NewArg) (e.Sg) (e.Signature) + (e.HistoryPrefix) ((e.HistoryName '@' 0) e.HistorySignature) + = (e.SpecInfo) Trivial; /* Простое зацикливание: текущая сигнатура есть частный случай старой. */ - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.Signature) - (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) + e.SpecInfo (e.UsedVars) (e.NewArg) (e.Sg) (e.Signature) + (e.HistoryPrefix) ((e.HistoryName) e.HistorySignature) - , : Clear e.NewSg + , : Clear e.NewSg - = - : e.NewSg^ + = (e.SpecInfo) + Known e.HistoryName (e.HistorySignature) (e.NewSg e.Sg); - = ((e.Body) s.NextNumber e.Signatures) - (CallBrackets - (Symbol Name e.HistoryName) - (e.NewSg e.Sg)> - ) - /* пусто */ (/* пусто */); + e.SpecInfo (e.UsedVars) (e.NewArg) (e.Sg) (e.Signature) + (e.HistoryPrefix) ((e.HistoryName) e.HistorySignature) - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.OldArg) (e.NewArg) (e.Sg) (e.Solutions) (e.Signature) - (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) - /* Получает обобщённую сигнатуру для двух сигнатур */ - = : e.GenSignature + = e.SpecInfo : (e.Body) s.NextNumber e.Signatures - = - : (e.UsedVars^) e.GenSignature^ + /* Получает обобщённую сигнатуру для двух сигнатур */ + = : e.GenSignature - = : Clear e.PatchSg - = : Clear e.NewSg + = + : (e.UsedVars^) e.GenSignature^ - = - : e.PatchSg^ + = : Clear e.NewSg - = - : e.NewSg^ + = + : (e.UsedVars^) (e.NewArg^) (e.Sg^) (e.Solutions) - = - : { - (e.SpecInfo) t.NewCall /* нет новых функций */ (e.NewHistory) - = (e.SpecInfo) t.NewCall /* нет новых функций */ (e.NewHistory); - - (e.SpecInfo) t.NewCall - (Function (e.NewName) Sentences e.NewBody) - (e.NewHistory) - = (e.SpecInfo) t.NewCall - (Function (e.NewName) Sentences e.NewBody) - (PatchFunc - (e.HistoryName) - Sentences - ( - () - /* = */ - ( - (CallBrackets - (Symbol Name e.NewName) - (e.PatchSg) - > - ) - ) - ) - ) - (e.NewHistory) - } + = + : { + (e.SpecInfo^) Trivial = (e.SpecInfo) Trivial; + + (e.SpecInfo^) Known e.InstanceName + = (e.SpecInfo) Known e.InstanceName (e.GenSignature) (e.Sg); + + (e.SpecInfo^) NewSignature e.Signature^ + = (e.SpecInfo) + MakeFunction + (e.NewArg) (e.Sg) (e.Solutions) (e.HistoryPrefix) (e.Signature) + Patch (e.HistoryName) (e.HistorySignature) (e.GenSignature); + } } -SpecCall-NewSignature-MakeFunction { +GenericMatch-Spec { + (e.Expr) (e.Pattern) + , : Clear e.Subst + = Clear + ; + + (e.Expr) (e.Pattern) = Undefined +} + +SpecCall-MakeFunction { (e.Name) (e.Body) s.NextNumber e.Signatures (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) - = + (e.Patch) + = : e.NewSentences = : e.InstanceName = ( @@ -912,43 +882,29 @@ SpecCall-NewSignature-MakeFunction { (e.Sg)> ) (Function (e.InstanceName) Sentences e.NewSentences) + ( ((e.InstanceName) e.History ((e.InstanceName) e.Signature)) ); } -SpecCall-BuildSignature-False { - (e.Name) (e.Body) s.NextNumber e.Signatures (e.UsedVars) - (e.Argument) (e.NewArgument) (e.Sg) (e.History) - - /* ищем динамическое обобщение для аргумента и образцов */ - = - : (e.UsedVars^) (e.NewArg) (e.Sg^) (e.Solutions) - - = - : { - (e.SpecInfo) Trivial - = (e.SpecInfo) - (CallBrackets (Symbol Name e.Name) e.Argument) - /* пусто */ (/* пусто */); - - (e.SpecInfo) Known e.InstanceName - = (e.SpecInfo) - (CallBrackets - (Symbol Name e.InstanceName) - (e.Sg)> - ) - /* пусто */ (/* пусто */); +MakePatch { + (e.InstanceName) NoPatch = /* пусто */; - (e.SpecInfo) NewSignature e.Signature - = e.SpecInfo : (e.Body^) s.NextNumber^ e.Signatures^ - = ; - } + (e.InstanceName) Patch (e.HistoryName) (e.HistorySignature) (e.GenSignature) + = + : Clear e.PatchSg + = : e.PatchPattern + = (CallBrackets + (Symbol Name e.InstanceName) + (e.PatchSg)> + ) + : e.PatchResult + = (PatchFunc + (e.HistoryName) + Sentences + ((e.PatchPattern) /* = */ (e.PatchResult)) + ); } ExtractCalls-Expr { @@ -1024,10 +980,10 @@ FindInSignatures { } CreateNewSentences { - (e.Arg) (e.NewSentences) (e.Solutions) (e.Body) + (e.Arg) (e.Solutions) (e.Body) = : e.PatternTemplate = } @@ -1134,31 +1090,23 @@ OrderUniqueVars { /** - == True (e.History-B) ((e.HistoryName) e.HistorySignature) (e.History-E) + == True e.HistoryPrefix ((e.HistoryName) e.HistorySignature) == False */ HasStopRelation { - (e.Name) (e.Signature) e.History - = -} - -DoHasStopRelation { - (e.Name) (e.Signature) e.History-B ((e.InstanceName) e.HistorySignature) - (e.History-E) + (e.Name) (e.Signature) e.History ((e.InstanceName) e.HistorySignature) , : e.Name , > : True - = True (e.History-B) ((e.InstanceName) e.HistorySignature) (e.History-E); + = True e.History ((e.InstanceName) e.HistorySignature); - (e.Name) (e.Signature) e.History-B t.HistoryItem (e.History-E) - = ; + (e.Name) (e.Signature) e.History t.HistoryItem + = ; - (e.Name) (e.Signature) /* пустая история */ (e.History-E) = False; + (e.Name) (e.Signature) /* пустая история */ = False; } SourceNameOfInstance { From f720b872567640857659c3aa00a3c914ade2b123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 3 Sep 2021 11:56:17 +0300 Subject: [PATCH 185/208] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20=C2=AB=D1=85=D0=B0=D0=BB=D1=82?= =?UTF-8?q?=D1=83=D1=80=D0=BD=D0=B0=D1=8F=C2=BB=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B0=20=D1=81=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=85=D1=83=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Экземпляры строятся как обычно, но при обнаружении зацикливания более ранний экземпляр в истории также подменяется вызовом обобщённого вроде Loop@3 { (e.0) t.1 t.2 e.3 = ; } --- src/compiler/Log-AST.ref | 5 ----- src/compiler/OptTree-Spec.ref | 27 ++++++++++++++++++++++++++- src/compiler/OptTree.ref | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index 7ea3c024..c2dc2eef 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -27,7 +27,6 @@ Element { (Entries e.Names) = ; (Function (e.Name) e.Body) = ; - (PatchFunc (e.Name) e.Body) = ; (ColdFunction s.ColdBy (e.Name) e.Body) = ; @@ -110,10 +109,6 @@ Function { (e.Name) e.Body = ) e.Body>; } -PatchFunc { - (e.Name) e.Body = ) e.Body>; -} - ColdFunction { s.ColdBy (e.Name) e.Body = diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 2908df25..cd89c9dd 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -241,7 +241,32 @@ $ENTRY OptTree-Spec { e.AST-B e.AST-E > : (e.SpecInfo^ (e.Histories^) (e.NewFunctions)) e.AST - = (SpecInfo (e.Names) e.SpecInfo (e.Histories)) e.AST e.NewFunctions; + = : e.AST^ + = (SpecInfo (e.Names) e.SpecInfo (e.Histories)) e.AST +} + +ApplyPatches { + e.AST (e.NewFunctionsAndPatches) + = + : (e.Patches) e.NewFunctions + = + e.NewFunctions } ColdAll { diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index cf7b290a..a9523472 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -68,6 +68,7 @@ $ENTRY OptTree { (pass (trace 'before Spec') (call &OptTree-Spec s.OptSpec))) + (call &WarmColdFunctions SPEC-PATCHED) (call &WarmColdFunctions SPEC)) (begin (call &OptTree-Drive-Prepare t.OptDrive) @@ -106,7 +107,6 @@ $ENTRY OptTree-CleanupMarkup { (Specs e.Names) = /* пропускаем */; (NoDrives e.Names) = /* пропускаем */; (NoSpecs e.Names) = /* пропускаем */; - (PatchFunc e._) = /* пропускаем */; (DriveInfo e.Info) = /* пропускаем */; (SpecInfo e.Info) = /* пропускаем */; From a61be47660ba8a4841548ae258ab5825e6a25f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 3 Sep 2021 14:26:16 +0300 Subject: [PATCH 186/208] =?UTF-8?q?=D0=9D=D1=83=D0=BC=D0=B5=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=BE?= =?UTF-8?q?=D0=B1=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=87=D0=B8=D0=BD=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D1=81=C2=A0?= =?UTF-8?q?0=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Перемена нумерации позволяет тривиальным сигнатурам на дне истории (сигнатурам псевдоэкземпляров Func@0) выглядеть в логеконсистентно с последующими сигнатурамии Func@n, где нумерация начинается с 0. --- src/compiler/GlobalGen.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/GlobalGen.ref b/src/compiler/GlobalGen.ref index a5c21eea..f91c5c35 100644 --- a/src/compiler/GlobalGen.ref +++ b/src/compiler/GlobalGen.ref @@ -291,7 +291,7 @@ CalcTermComplexity { */ $ENTRY GlobalGen-NameVariables { e.Pattern - = : s._ e.Pattern^ + = : s._ e.Pattern^ = e.Pattern } From 81667ba83a11a2802c29808970c5abdd3fa3b755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 3 Sep 2021 15:06:49 +0300 Subject: [PATCH 187/208] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D1=82=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D1=8B=20=D0=B4=D0=BB=D1=8F=20#362=20(=D0=9D=D0=95?= =?UTF-8?q?=20=D0=9F=D0=A0=D0=9E=D0=A5=D0=9E=D0=94=D0=AF=D0=A2!!!)=20(#362?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Два автотеста недописаны (нет функции Go) и поэтому выключены (переименованы в *._ref). Случайно сгенерированный автотест, заваливший CI, сохранён и на нём компилятор по-прежнему падает. Смысл коммита — не потерять эти тесты. Когда проблема #362 будет исправлена, тесты opt-tree-bloat-*._ref будут дописаны и включены. --- autotests/opt-tree-bloat-basic._ref | 10 + autotests/opt-tree-bloat-condition._ref | 8 + ...d-test-10_Mon-Aug-23-21-51-16-UTC-2021.ref | 334 ++++++++++++++++++ 3 files changed, 352 insertions(+) create mode 100644 autotests/opt-tree-bloat-basic._ref create mode 100644 autotests/opt-tree-bloat-condition._ref create mode 100644 autotests/positive-random-test/saved-test-10_Mon-Aug-23-21-51-16-UTC-2021.ref diff --git a/autotests/opt-tree-bloat-basic._ref b/autotests/opt-tree-bloat-basic._ref new file mode 100644 index 00000000..76617e18 --- /dev/null +++ b/autotests/opt-tree-bloat-basic._ref @@ -0,0 +1,10 @@ +$ENTRY START { + (e.A) t.B (e.C) = ; +} + +Loop { + (e.Acc) e.Begin t.U t.V W e.End + = ; + + (e.Acc) e.Rest = e.Acc e.Rest; +} diff --git a/autotests/opt-tree-bloat-condition._ref b/autotests/opt-tree-bloat-condition._ref new file mode 100644 index 00000000..c27d0922 --- /dev/null +++ b/autotests/opt-tree-bloat-condition._ref @@ -0,0 +1,8 @@ +$ENTRY Block { + e.A t.B t.C X e.D + , : e.X A e.Y e.D + , : + = ; + + e.X = e.X; +} diff --git a/autotests/positive-random-test/saved-test-10_Mon-Aug-23-21-51-16-UTC-2021.ref b/autotests/positive-random-test/saved-test-10_Mon-Aug-23-21-51-16-UTC-2021.ref new file mode 100644 index 00000000..bf418145 --- /dev/null +++ b/autotests/positive-random-test/saved-test-10_Mon-Aug-23-21-51-16-UTC-2021.ref @@ -0,0 +1,334 @@ +$EXTERN ExtBBAB ; + + + +DDCAC { + e.4 'c' DBCD e.9 + ,1 e.4 2 CD ABBD ('d' > e.4 e.4 (4 D +D 'd' ) ) : + { + + ,: s.13 () ('c' 10 ) + ,: + { + s.3 + ,: ('b' ) + ,: + ,: 8 (e.8 ) + ,: s.10 = + ; + }; + e.7 t.12 'd' = + ; + e.7 t.12 t.4 ((AC DCBA (e.8 'd' AA 'cb' 2 ) 'a' ) (C 4 () ) ) 0 'd' e.2 B ACCA 'd' + + ,: CCA (e.10 8 e.1 e.2 'b' ) 'b' 2 (e.3 AADB 'aa' CCCB ) + ,: + = + ; + }; + e.4 e.6 (('b' () ) CAC t.7 ((CC ) 6 ) s.3 ) e.6 s.9 + , (('b' 7 3 ) AA ) () +ACD > > 10 'c' : + { + 10 t.2 + ,C s.3 : e.7 (5 ) + ,( (() 'd' () +) ) (e.7 () t.7 ) : e.8 e.10 + ,: DCA 'dd' + ,: e.12 'd' + = + () ; + 10 t.2 1 s.8 + ,A : = + 'd' ; + }; + e.4 e.6 (('b' () ) CAC t.7 ((CC ) 6 ) s.3 ) e.6 e.4 BBD (DACC 'b' ) t.2 CD = + 3 BDB () CBAC 10 'a' 5 t.2 10 ; +} + +$ENTRY CCD { + 6 e.3 1 8 'a' 9 'c' + ,('a' ) 3 e.3 D (2 1 'dc' ) 'c' e.3 : + + { + 'd' DCBC (DAAA ) (7 3 ) 'c' + ,: = + 'c' e.3 e.3 e.3 'd' ; + }; +} + +$ENTRY BCDC { + () s.11 10 ('c' ) 5 + ,s.11 A +ADD 2 ) > D CD > AB 'c' 0 : + { + 2 s.6 DBDC 8 6 5 AAA 6 s.13 + ,: CBAB + ,: D + ,DC : e.11 t.12 BADC + +,: = + 1 ; + }; + () s.11 (s.13 (BBD 2 ) 'd' ) e.11 2 e.4 (9 'b' ) + ,() : + { + e.13 () 7 7 'c' + ,'b' e.11 : 'd' BA 5 (e.6 D (1 ) ) + ,1 s.11 0 : + + { + 'c' B + ,: t.13 + ,7 'a' 5 : + ,() e.11 : + ,'d' +: e.13 s.9 DDC e.1 = + (9 ) ; + s.13 'd' B 1 2 B + ,: 9 + ,: 'd' + ,4 : AB BC + ,3 : +s.7 = + B ; + s.13 'd' B 1 e.4 e.12 8 (DD (3 'c' t.6 B ) 'd' s.7 ('d' 10 e.12 ) ) ((BDD 'a' +) ) 2 B + ,10 s.11 : = + ; + }; + 7 () 'c' + ,: (e.11 ) BA e.5 DDB BDD () + ,: 5 6 + ,AC : e.13 = + 'a' ; + }; + () s.11 (s.13 (BBD 2 ) 'd' ) ('a' 3 (e.2 CC s.3 ) ) 2 DDCD 6 e.11 e.7 = + CC 5 e.2 (A ) ; + () s.11 (s.13 (BBD 2 ) 'd' ) ('a' 3 (e.2 CC s.3 ) ) A s.8 B e.2 'b' e.2 (3 CAA s.8 BBDB 9 () +CAA ) 'b' 9 A t.2 (t.1 BAD ) s.11 = + ; + () s.11 (s.13 (BBD 2 ) 'd' ) ('a' 3 (e.2 CC s.3 ) ) A 'aa' B A t.2 (t.1 BAD ) +s.11 + ,DA 'a' s.11 s.11 : + { + 'c' 9 5 (6 'b' e.8 ) s.1 8 'c' + ,: + , : + ,: + + ,5 BDA 6 : 8 2 e.10 e.1 ('d' ) + ,: + { + 5 s.9 ('b' ((s.10 s.10 ) t.11 () ) ('b' ) ) s.4 + ,CB 2 t.2 : + = + s.1 ; + 5 s.9 ('b' ((s.10 s.10 ) t.11 () ) ('b' ) ) s.4 DDB e.8 e.6 DAB (e.12 ('b' +) 8 e.10 ) 10 + ,: DBB = + DBA BDCA ; + }; + 'c' (10 e.1 ) t.11 8 DC s.13 e.2 0 10 s.1 8 'c' = + e.2 ; + 'c' (10 e.1 ) t.11 8 t.2 () (e.12 ) ((9 ) (e.4 10 e.5 ) (e.7 (2 BB e.7 ) +'d' ) ) 'd' s.3 'cd' 4 10 s.1 8 'c' + ,BADA : 'b' e.11 'a' ACB + + ,10 s.11 : + ,: + ,('ad' ) : C (e.10 ) + ,: A 'd' +() () CD () 'c' + ,: + { + C 'a' e.9 () + , : = + s.3 ; + e.7 'ca' e.9 () + ,: ADDB + ,: + ,'c' CC : + ,: +(3 0 ) s.8 + ,: = + AC e.10 ; + e.7 BAA 4 10 ('a' 0 A ) (0 ) 'a' e.9 () + ,3 : 3 AAA + ,2 (9 ) e.2 ADA : + + , : = + 'd' 1 ; + }; + }; + () s.11 (s.13 (BBD 2 ) 'd' ) ('a' 3 (e.2 CC s.3 ) ) A 'aa' D 'b' e.12 (B 3 9 ) +DD (9 DB ) 0 (BA t.11 'd' ) A t.2 (t.1 BAD ) s.11 + ,10 DDAD DDBA (C ) ('b' ) t.2 ) 10 'd' 6 ('b' 3 5 C ) +'d' > > : + { + s.7 e.3 'bd' 0 + ,BAB : e.11 'b' CC + , : + ,: +e.7 e.2 e.6 3 AA + ,: A = + ; + s.7 DA () 'b' (8 6 ) BBB 0 + ,t.1 DCD > : AB 'a' (D ) e.5 = + ; + s.7 'd' C s.12 'c' 7 'b' (8 6 ) BBB 0 = + s.13 ; + }; +} + +DA { + (0 'a' ) 'a' + ,DB 2 (10 ) 'a' > : + { + s.7 0 + ,CDB 0 > : 'd' e.10 'aa' (DCA 'c' e.7 ) + + ,: 'a' + ,e.10 BABA : 2 2 + ,10 : 'a' CDA 7 = + e.10 ; + }; + (0 'a' ) BC DCBD 'a' (CDDD 7 e.10 s.2 1 ADDC CA ) D 'a' 3 (6 2 ) + ,'a' : + { + 3 e.10 BCBC 8 e.8 + ,: + ,9 'b' AA () (CABD ) s.2 : + + { + 0 'c' (e.4 2 'b' ) 'd' + ,1 8 : 0 BDA + ,: + ,(s.2 +) : CDC = + ; + }; + 8 t.9 e.12 5 'a' e.8 + ,t.9 : = + 10 'b' ; + }; + (0 'a' ) 'b' s.3 t.6 ('c' t.10 ) 4 e.13 (t.1 'a' D 'd' s.4 ) 7 + + ,C : + { + 'b' 2 CABB DB 2 9 + ,: + ,4 t.1 t.6 : + ,e.13 +: = + ('da' ) 5 > > > ; + 'b' 2 (ADBA ) t.6 A ('a' ) 3 D (t.5 CBDA AAD 1 ) + ,s.4 s.3 t.6 () : 'd' + + ,: + ,ADA 9 'c' : + , > : 10 = + ; + }; + (0 'a' ) 'b' s.3 t.6 ('c' t.10 ) 4 (BA ) (DA 'b' ) CDB 'dd' (t.1 'a' +D 'd' s.4 ) 7 + ,(t.1 () ) : + { + 'b' e.6 'c' 10 0 8 BDBC 3 + , 9 5 : + ,: 8 (BAA CDA ) + ,: +5 (e.3 5 'a' ) t.4 (DA DB 4 ) + ,: = + AAC > ; + }; + (0 'a' ) 'b' s.3 t.6 ('c' t.10 ) 4 (BA ) () 0 t.10 DC 1 ('db' 4 e.9 10 5 'd' +e.9 'c' ) (A ) e.6 () ('d' A ADBC D e.12 e.2 ('dc' ) BB ) 3 8 'ba' e.11 ('b' +0 BA 'b' e.12 'd' A e.8 DC e.13 ) 'dd' (t.1 'a' D 'd' s.4 ) 7 = + > e.11 (e.9 ) ; +} + +BCCDB { + BBC e.13 e.4 CDAA + , 6 A 5 (1 D ) 'b' : + { + e.9 5 () D BBB + ,: + ,'d' : + { + s.2 e.12 s.12 + ,: 9 'c' (e.7 ) BDC + , > : 2 = + s.12 ; + }; + 0 2 t.5 'd' 1 ('d' ADC ) e.5 'a' () D BBB + ,'a' +A > e.4 e.13 > : + ,: (e.4 e.3 BDCB ) 3 + , +5 8 t.5 > A (e.3 ) : + ,: DB DC 8 + ,: + { + t.10 t.10 + ,(5 e.3 'c' ) 'a' C e.4 : 'c' (DCB ) + ,: s.6 BDAB 4 = + ; + t.10 s.10 'a' ACB 5 t.10 + ,9 9 : (B ) = + ; + t.10 s.10 'a' CDBB t.9 ACB 5 t.10 + ,e.4 : + ,B : 8 + ,'a' : +e.3 + , AC t.9 : AB = + ; + }; + 0 2 t.5 6 (B e.7 ) 1 DDD 'a' () D BBB + ,: = + 1 8 1 ; + }; + 'd' s.2 'c' CDAA = + 'd' s.2 > 3 s.2 CAC 2 > 3 s.2 s.2 +'d' BA 'b' ) (s.2 'a' s.2 ) s.2 'b' 8 s.2 DCC C 5 > > ; + 2 D s.2 'c' CDAA + ,s.2 s.2 s.2 > : + { + 2 CB DC (7 ) 'c' = + ; + }; +} + +$ENTRY DADD { + 'c' s.5 e.5 t.12 3 + , : + { + (e.2 ((t.10 0 6 ) ) DB 4 t.5 ) e.2 6 (e.3 6 0 e.10 ) 'dc' s.4 e.8 (A 9 e.12 'd' +9 'b' ) 'a' + ,'c' : + ,9 'c' : (8 CD 2 'ab' ) ((B 2 ) +) ('c' e.1 e.7 DDBC 9 ) 'c' e.3 = + e.7 e.1 ( ('dcc' ) +) (t.5 'a' ) ; + (e.2 ((t.10 0 6 ) ) DB 4 t.5 ) e.2 6 C 7 'b' 4 (CBCD ) + ,: ('b' e.7 'c' +9 ) (1 3 'a' ) AA BCCD + ,: e.10 () + ,'c' e.2 0 e.5 : s.12 () +4 e.3 + ,: e.6 8 BAAD + ,: = + ; + }; + 'c' s.5 e.10 e.7 'd' 7 (s.1 s.6 DD ) = + ; + 'c' s.5 e.10 s.6 (e.2 e.9 ) (9 'cbc' ) 8 'd' 7 'b' (s.1 s.6 DD ) + = + DDCC 2 s.6 BCBA 2 ; +} From ba7e57cfd54d477e8b6aea5579e68250cbcfa72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 10 Sep 2021 16:59:44 +0300 Subject: [PATCH 188/208] =?UTF-8?q?=D0=A4=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20OptTree-***-Prepare=20=D0=B7=D0=B0=D0=B1=D1=8B=D0=B2?= =?UTF-8?q?=D0=B0=D1=8E=D1=82=20=D0=BF=D1=80=D0=B5=D0=B4=D1=8B=D0=B4=D1=83?= =?UTF-8?q?=D1=89=D1=83=D1=8E=20=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=82=D0=BA?= =?UTF-8?q?=D1=83=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Для специализации это очевидный рефакторинг, т.к. разметка выполняется не более чем один раз в любом режиме компиляции. (Вообще, этот код давно надо было упростить.) Для прогонки это не рефакторинг, т.к. при прогонке экземпляров содержимое лога будет немного другим. Помимо непосредственного удаления кода «обновления» структур данных, были сделаны некоторые простые рефакторинги в окружающем коде. --- src/compiler/OptTree-Drive.ref | 83 ++++++++++++++-------------------- src/compiler/OptTree-Spec.ref | 27 +++++------ 2 files changed, 46 insertions(+), 64 deletions(-) diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index a50c8a66..a6728be7 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -39,20 +39,10 @@ $EXTERN OptTree-Drive-Expr; $ENTRY OptTree-Drive-Prepare { (NoOpt NoOpt) e.AST = e.AST; - (s.OptDrive s.OptIntrinsic) - e.AST-B (DriveInfo e.DriveInfo) e.AST-E - = ; - (s.OptDrive s.OptIntrinsic) e.AST - = ( ) - Contractions-Enabled () - - : e.EmptyInfo - = ; + = ; } -gen_e__ { e.arg = e.arg } - /* Функция генерирует имена остаточных прогоняемых функций */ GenRemainderFuncNames { @@ -76,10 +66,19 @@ BaseName { } UpdateDriveInfo { - s.OptDrive s.OptIntrinsic ((e.KnownNames) e.KnownFunctions) e.AST - = e.KnownFunctions : s._ (e._) e.KnownFunctions^ - = : (e.Drives) e.AST^ - = : (e.Intrinsics) e.AST^ + s.OptDrive s.OptIntrinsic e.AST + +* Игнорируем старую разметку + = e.AST + : { + e.AST-B (DriveInfo e._) e.AST-E = e.AST-B e.AST-E; + e.AST^ = e.AST; + } + : e.AST^ + + = : (e.Drives) e.AST^ + = : (e.Intrinsics) e.AST^ + = e.AST : { e.AST-B (NoDrives e.Names) e.AST-E @@ -88,35 +87,35 @@ UpdateDriveInfo { e.AST^ = (/* пусто */) e.AST; } : (e.NoDrives) e.AST^ - = : e.NoDrives^ - - = : e.KnownNames^ = : e.Drives^ - = : e.Drives^ - = : e.Intrinsics^ = > : e.Label - = >; + ((e.Label) e.Set) + = : e.Name^ + = + } + e.Set + > } - e.Drives e.Intrinsics + (('DRIVE') e.Drives) (('INTRINSIC') e.Intrinsics) > : /* пусто */ = s.OptDrive : { NoOpt = /* пусто */; - OptInline = ; - OptDrive = e.Drives; + OptInline = ; + OptDrive = ; } : e.Drives^ = : e.DrivesBaseNames - = - : (e.DriveFuncs) e.AST^ + = : (e.DriveFuncs) e.AST^ = : (e.Metatables) e.AST^ @@ -132,13 +131,13 @@ UpdateDriveInfo { = : e.OptIntrinsicFuncs - = : e.HashSetNames + = : e.HashSetNames = s.OptDrive : { @@ -151,23 +150,15 @@ UpdateDriveInfo { = (DriveInfo (e.HashSetNames) s.ContractionsMode (e.Metatables) - e.KnownFunctions e.DriveFuncs e.OptIntrinsicFuncs + e.DriveFuncs e.OptIntrinsicFuncs ) e.AST; } ExtractLabels { - s.Label s.Node e.AST-B (s.Node e.Names) e.AST-E - = - : e.Names^ - = (e.Names) e.AST-B e.AST-E; + s.Node e.AST-B (s.Node e.Names) e.AST-E = (e.Names) e.AST-B e.AST-E; - s.Label s.Node e.AST = (/* пусто */) e.AST; + s.Node e.AST = (/* пусто */) e.AST; } ExtractMetatableNames { @@ -185,9 +176,9 @@ ExtractMetatableNames { } SetNames-Reject { - (e.Minuent-B (s._M e.Name) e.Minuent-E) (e.Subtr-B (s.Label e.Name) e.Subtr-E) + (e.Minuent-B (e.Name) e.Minuent-E) (e.Subtr-B (e.Name) e.Subtr-E) = e.Minuent-B - ; + ; (e.Minuent) (e.Subtrahend) = e.Minuent; } @@ -206,7 +197,7 @@ ExtractBaseNames { = ; } -ExtractExtractableFunctions { +ExtractDriveFunctions { (e.Names) e.AST = -} - /** == e.AST^ diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index cd89c9dd..a047a244 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -39,16 +39,16 @@ $EXTERN GlobalGen-NameVariables, GlobalGen; $ENTRY OptTree-Spec-Prepare { NoOpt e.AST = e.AST; - OptSpec e.AST-B (SpecInfo e.SpecInfo) e.AST-E - = ; - OptSpec e.AST - = (/* no names */) /* no info */ (/* no histories */) : e.EmptyInfo - = ; -} -Prepare-Aux { - ((e.KnownNames) e.KnownInfo (e.KnownHistories)) e.AST +* Игнорируем старую разметку + = e.AST + : { + e.AST-B (SpecInfo e._) e.AST-E = e.AST-B e.AST-E; + e.AST^ = e.AST + } + : e.AST^ + = e.AST : { e.AST-B (Specs e.Names) e.AST-E = (e.Names) e.AST-B e.AST-E; @@ -60,14 +60,14 @@ Prepare-Aux { : { e.AST-B (NoSpecs e.Names) e.AST-E = (e.Names) e.AST-B (NoSpecs e.Names) e.AST-E; + e.AST^ = (/* пусто */) e.AST; } : (e.NoSpecs) e.AST^ = : e.NewInfo^ - = (SpecInfo - (e.KnownNames e.NewNames) - e.KnownInfo e.NewInfo - (e.KnownHistories e.NewHistories) - ) - e.AST + = (SpecInfo (e.NewNames) e.NewInfo (e.NewHistories)) e.AST } BottomSignature { From f0d7f38403089d5ae67a52b717cf509054962ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 17 Sep 2021 21:46:24 +0300 Subject: [PATCH 189/208] =?UTF-8?q?=D0=9F=D0=BE=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20let-=D1=8D=D0=BA=D0=B7=D0=B5=D0=BC?= =?UTF-8?q?=D0=BF=D0=BB=D1=8F=D1=80=D0=BE=D0=B2=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 217 +++++++++++++++++++--------------- 1 file changed, 120 insertions(+), 97 deletions(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index a047a244..5ae7f5f9 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -244,7 +244,14 @@ ApplyPatches { e.AST (e.NewFunctionsAndPatches) = - : { - (e.SpecInfo^) Trivial = (e.SpecInfo) Trivial; - - (e.SpecInfo^) Known e.InstanceName - = (e.SpecInfo) Known e.InstanceName (e.NewArg) (e.Sg); - - (e.SpecInfo^) NewSignature e.Signature - , ) e.History - > - : True e.HistoryPrefix ((e.HistoryName) e.HistorySignature) - = ; - - (e.SpecInfo^) NewSignature e.Signature - = (e.SpecInfo) - MakeFunction - (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) NoPatch; - } : { (e.SpecInfo^) Trivial = (e.SpecInfo) (CallBrackets (Symbol Name e.Name) e.SourceArg) /* пусто */ (/* пусто */); - (e.SpecInfo^) Known e.InstanceName (e.NewArg^) (e.Sg^) + (e.SpecInfo^) Known e.InstanceName = (e.SpecInfo) (CallBrackets (Symbol Name e.InstanceName) @@ -786,14 +772,26 @@ SpecCall-BuildSignature { ) /* пусто */ (/* пусто */); - (e.SpecInfo^) - MakeFunction - (e.NewArg^) (e.Sg^) (e.Solutions^) (e.History^) (e.Signature) e.Patch - = : e.InstanceName + = (e.Body) + e.Signatures ((e.InstanceName) e.Signature) + : e.SpecInfo^ + + = + : (e.SpecInfo^) e.NewFunctions (e.NewHistory) + + = (e.SpecInfo) + (CallBrackets + (Symbol Name e.InstanceName) + (e.Sg)> + ) + e.NewFunctions + (e.NewHistory); } } @@ -821,54 +819,120 @@ SpecCall-CheckSignature { }; } -SpecCall-Generalize { +MakeNewFunction { + (e.SpecInfo) (e.Name) e.History (e.InstanceName) + (e.Signature) (e.NewArg) (e.Solutions) + , ) e.History + > + : True e.HistoryPrefix ((e.HistoryName) e.HistorySignature) + = ; + + (e.SpecInfo) (e.Name) e.History (e.InstanceName) + (e.Signature) (e.NewArg) (e.Solutions) + = e.SpecInfo : (e.Body) s.NextNumber e.Signatures + = : e.NewSentences + = (e.SpecInfo) + (Function (e.InstanceName) Sentences e.NewSentences) + ( + ((e.InstanceName) e.History ((e.InstanceName) e.Signature)) + ); +} + +MakeNewFunction-Generalize { /* Зацикливание с тривиальной сигнатурой на дне. Обобщение двух сигнатур дало бы тривиальную сигнатуру, вызов которой соответствует вызову исходной функции. */ - e.SpecInfo (e.UsedVars) (e.NewArg) (e.Sg) (e.Signature) + e.SpecInfo (e.Name) (e.InstanceName) (e.Signature) (e.NewArg) (e.HistoryPrefix) ((e.HistoryName '@' 0) e.HistorySignature) - = (e.SpecInfo) Trivial; + = (e.SpecInfo) + (ColdFunction SPEC + (e.InstanceName) + Sentences + ( + () + /* = */ + ((CallBrackets (Symbol Name e.Name) e.NewArg)) + ) + ) + ( + ((e.InstanceName) e.HistoryPrefix ((e.InstanceName) e.Signature)) + ); /* Простое зацикливание: текущая сигнатура есть частный случай старой. */ - e.SpecInfo (e.UsedVars) (e.NewArg) (e.Sg) (e.Signature) + e.SpecInfo (e.Name) (e.InstanceName) (e.Signature) (e.NewArg) (e.HistoryPrefix) ((e.HistoryName) e.HistorySignature) - , : Clear e.NewSg + , : Clear e.NewSubst = (e.SpecInfo) - Known e.HistoryName (e.HistorySignature) (e.NewSg e.Sg); + (ColdFunction SPEC + (e.InstanceName) + Sentences + ( + () + /* = */ + ( + (CallBrackets + (Symbol Name e.HistoryName) + (e.NewSubst)> + ) + ) + ) + ) + ( + ((e.InstanceName) e.HistoryPrefix ((e.InstanceName) e.Signature)) + ); - e.SpecInfo (e.UsedVars) (e.NewArg) (e.Sg) (e.Signature) + /* Зацикливание с обобщением */ + e.SpecInfo (e.Name) (e.InstanceName) (e.Signature) (e.NewArg) (e.HistoryPrefix) ((e.HistoryName) e.HistorySignature) - = e.SpecInfo : (e.Body) s.NextNumber e.Signatures - /* Получает обобщённую сигнатуру для двух сигнатур */ = : e.GenSignature - = - : (e.UsedVars^) e.GenSignature^ - - = : Clear e.NewSg - - = - : (e.UsedVars^) (e.NewArg^) (e.Sg^) (e.Solutions) + = + : (e.UsedVars) e.GenSignature^ - = - : { - (e.SpecInfo^) Trivial = (e.SpecInfo) Trivial; + = : Clear e.NewSubst + = + : Clear e.PatchSubst - (e.SpecInfo^) Known e.InstanceName - = (e.SpecInfo) Known e.InstanceName (e.GenSignature) (e.Sg); + = + : (e.SpecInfo^) t.GenSignatureCall e.NewFunctions (e.NewHistories) - (e.SpecInfo^) NewSignature e.Signature^ - = (e.SpecInfo) - MakeFunction - (e.NewArg) (e.Sg) (e.Solutions) (e.HistoryPrefix) (e.Signature) - Patch (e.HistoryName) (e.HistorySignature) (e.GenSignature); - } + = (e.SpecInfo) + (PatchFunc + (e.HistoryName) + Sentences + ( + () + /* = */ + () + ) + ) + (ColdFunction SPEC + (e.InstanceName) + Sentences + ( + () + /* = */ + () + ) + ) + e.NewFunctions + ( + ((e.InstanceName) e.HistoryPrefix ((e.InstanceName) e.Signature)) + e.NewHistories + ); } GenericMatch-Spec { @@ -886,47 +950,6 @@ GenericMatch-Spec { (e.Expr) (e.Pattern) = Undefined } -SpecCall-MakeFunction { - (e.Name) (e.Body) s.NextNumber e.Signatures - (e.NewArg) (e.Sg) (e.Solutions) (e.History) (e.Signature) - (e.Patch) - = - : e.NewSentences - = : e.InstanceName - = ( - (e.Body) - e.Signatures ((e.InstanceName) e.Signature) - ) - (CallBrackets - (Symbol Name e.InstanceName) - (e.Sg)> - ) - (Function (e.InstanceName) Sentences e.NewSentences) - - ( - ((e.InstanceName) e.History ((e.InstanceName) e.Signature)) - ); -} - -MakePatch { - (e.InstanceName) NoPatch = /* пусто */; - - (e.InstanceName) Patch (e.HistoryName) (e.HistorySignature) (e.GenSignature) - = - : Clear e.PatchSg - = : e.PatchPattern - = (CallBrackets - (Symbol Name e.InstanceName) - (e.PatchSg)> - ) - : e.PatchResult - = (PatchFunc - (e.HistoryName) - Sentences - ((e.PatchPattern) /* = */ (e.PatchResult)) - ); -} - ExtractCalls-Expr { (e.Calls (e.UsedVars)) e.Expr = ; From 1b5f9031917bab163c7a1bde0c5a8bf1d4a8a691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 18 Sep 2021 00:20:34 +0300 Subject: [PATCH 190/208] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=BF=D0=B0=D1=82?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=B8=C2=A0let-=D1=8D?= =?UTF-8?q?=D0=BA=D0=B7=D0=B5=D0=BC=D0=BF=D0=BB=D1=8F=D1=80=D1=8B=20=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=B2=D1=81=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D0=B8=D0=B2=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D0=B8=C2=A0=D1=87?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D1=8F=D1=82=D1=81=D1=8F=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive.ref | 23 +++++++------------- src/compiler/OptTree-Spec.ref | 39 +++++++++++++++++++++++++++------- src/compiler/OptTree.ref | 31 +++++++++++++++++---------- 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index a6728be7..d674a783 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -30,19 +30,6 @@ $EXTERN OptTree-Drive-Expr; */ -/** - == e.AST - - s.OptDrive ::= OptDrive | OptInline | NoOpt - s.OptIntrinsic ::= OptIntrinsic | NoOpt -*/ -$ENTRY OptTree-Drive-Prepare { - (NoOpt NoOpt) e.AST = e.AST; - - (s.OptDrive s.OptIntrinsic) e.AST - = ; -} - /* Функция генерирует имена остаточных прогоняемых функций */ GenRemainderFuncNames { @@ -65,8 +52,14 @@ BaseName { e.Name /* нет суффикса */ = e.Name 0; } -UpdateDriveInfo { - s.OptDrive s.OptIntrinsic e.AST +/** + == e.AST + + s.OptDrive ::= OptDrive | OptInline | NoOpt + s.OptIntrinsic ::= OptIntrinsic | NoOpt +*/ +$ENTRY OptTree-Drive-Prepare { + (s.OptDrive s.OptIntrinsic) e.AST * Игнорируем старую разметку = e.AST diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 5ae7f5f9..b8679b1a 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -37,9 +37,7 @@ $EXTERN GlobalGen-NameVariables, GlobalGen; e.History ::= ((e.FuncName) e.Expression)* */ $ENTRY OptTree-Spec-Prepare { - NoOpt e.AST = e.AST; - - OptSpec e.AST + s.OptSpec e.AST * Игнорируем старую разметку = e.AST @@ -56,6 +54,13 @@ $ENTRY OptTree-Spec-Prepare { } : (e.NewNames) e.AST^ + = s.OptSpec + : { + OptSpec = e.NewNames; + NoOpt = /* пусто */; + } + : e.NewNames^ + = e.AST : { e.AST-B (NoSpecs e.Names) e.AST-E @@ -248,8 +253,8 @@ ApplyPatches { (e.Patches) (Function e.Function) = (e.Patches) (Function e.Function); /* let-экземпляры */ - (e.Patches) (ColdFunction SPEC e.Function) - = (e.Patches) (ColdFunction SPEC e.Function); + (e.Patches) (ColdFunction LET e.Function) + = (e.Patches) (ColdFunction LET e.Function); /* патчи */ (e.Patches) (PatchFunc e.Patch) = (e.Patches (e.Patch)); @@ -851,7 +856,7 @@ MakeNewFunction-Generalize { e.SpecInfo (e.Name) (e.InstanceName) (e.Signature) (e.NewArg) (e.HistoryPrefix) ((e.HistoryName '@' 0) e.HistorySignature) = (e.SpecInfo) - (ColdFunction SPEC + (ColdFunction LET (e.InstanceName) Sentences ( @@ -871,7 +876,7 @@ MakeNewFunction-Generalize { , : Clear e.NewSubst = (e.SpecInfo) - (ColdFunction SPEC + (ColdFunction LET (e.InstanceName) Sentences ( @@ -919,7 +924,7 @@ MakeNewFunction-Generalize { () ) ) - (ColdFunction SPEC + (ColdFunction LET (e.InstanceName) Sentences ( @@ -1183,3 +1188,21 @@ NameSignatureVars-Term { t.State t.OtherTerm = t.State t.OtherTerm; } + + +/** + == e.AST^ +*/ +$ENTRY OptTree-Spec-MarkLetsForDrive { + e.AST + = +} diff --git a/src/compiler/OptTree.ref b/src/compiler/OptTree.ref index a9523472..9a595fc7 100644 --- a/src/compiler/OptTree.ref +++ b/src/compiler/OptTree.ref @@ -12,7 +12,7 @@ $EXTERN OptTree-AutoMarkup-Spec, OptTree-AutoMarkup-Drive, $EXTERN OptTree-Drive-Prepare, OptTree-Drive, OptTree-Drive-CleanupColdCalls; *$FROM OptTree-Spec -$EXTERN OptTree-Spec-Prepare, OptTree-Spec; +$EXTERN OptTree-Spec-Prepare, OptTree-Spec, OptTree-Spec-MarkLetsForDrive; *$FROM TreeUtils $EXTERN ExpandClosures-Result; @@ -54,7 +54,7 @@ $ENTRY OptTree { (DriveLoop)) (begin (DriveSpecLoop))) - (trace 'before Cleanup unused functions') + (trace 'before Cleanup unused functions (common)') (call &OptTree-AutoMarkup-CleanupUnusedFunctions) (call &OptTree-CleanupMarkup)) @@ -68,22 +68,31 @@ $ENTRY OptTree { (pass (trace 'before Spec') (call &OptTree-Spec s.OptSpec))) - (call &WarmColdFunctions SPEC-PATCHED) - (call &WarmColdFunctions SPEC)) + (call &OptTree-Spec-MarkLetsForDrive) + (call &WarmColdFunctions SPEC) + (pass + (trace 'before Driving let instances') + (call &OptTree-Drive-Prepare (OptInline NoOpt)) + (DriveLoop-core)) + (trace 'before Cleanup unused functions (let instances)') + (call &OptTree-AutoMarkup-CleanupUnusedFunctions)) (begin (call &OptTree-Drive-Prepare t.OptDrive) (DriveLoop)))) (define DriveLoop (if (or s.OptDrive s.OptIntrinsic) - (begin - (loop-for-warm-functions - (pass - (trace 'before Drive') - (call &OptTree-Drive))) - (call &WarmColdFunctions DRIVE) - (call &OptTree-Drive-CleanupColdCalls)) + (DriveLoop-core) (call &ExpandClosures))) + + (define DriveLoop-core + (loop-for-warm-functions + (pass + (trace 'before Drive') + (call &OptTree-Drive))) + (call &WarmColdFunctions DRIVE) + (call &OptTree-Drive-CleanupColdCalls)) + s.Cycles (e.AST) From b47714c05cbf10f7be3969b5b0d61f220c1a56e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 18 Sep 2021 00:23:12 +0300 Subject: [PATCH 191/208] =?UTF-8?q?=D0=9B=D0=B8=D0=BC=D0=B8=D1=82=20=D0=BD?= =?UTF-8?q?=D0=B0=C2=A0=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D0=B5=20=D1=87=D0=B8=D1=81=D0=BB=D0=BE=20=D1=8D=D0=BA?= =?UTF-8?q?=D0=B7=D0=B5=D0=BC=D0=BF=D0=BB=D1=8F=D1=80=D0=BE=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=B2=D1=8B=D1=88=D0=B5=D0=BD=20=D1=81=C2=A0100=20=D0=B4?= =?UTF-8?q?=D0=BE=C2=A0150=20(#332,=20#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ранее было обнаружено, что с новым алгоритмом специализации компилятор в некоторых тестах увязает, и был добавлен грязный хак, ограничивающий максимальное число экземпляров (54c28cad, #332). Предыдущие два коммита стали строить дополнительные let-экземпляры, из-за чего порог стал достигаться раньше и глубина оптимизации снизилась. Поэтому потребовалось поднять порог. Порог был поднят до 150 по двум причинам: • В тесте saved-test-10_Mon-Aug-23-21-51-16-UTC-2021.ref (81667ba) на пороге в 100 экземпляров условие остановки не срабатывает (до let-экземпляров срабатывало). Опытным путём было выяснено, что условие установки срабатывает на пороге между 140 и 145, было выбрано круглое значение. Заметим, что этот тест в текущем коммите проходит. • Тест saved-test-77_14.08.2021_20-00-01,67-big.ref (41ce59e8, #314), напротив, проходит только благодаря наличию этого лимита (на момент написания коммита 41ce59e8 не анализировалась проблема с непрохождением теста, просто был повышен порог). С лимитом 200 тест не проходит, с лимитом 150 проходит. --- src/compiler/OptTree-Spec.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index b8679b1a..c36b4d0a 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -599,7 +599,7 @@ SpecCall { /* TODO: убрать этот хак в рамках задачи #332 */ (e.Name) (e.Body) s.NextNumber e.Signatures (e.Argument) (e.History) - , s.NextNumber : 100 + , s.NextNumber : 150 = ((e.Body) s.NextNumber e.Signatures) (CallBrackets (Symbol Name e.Name) e.Argument) /* пусто */ (/* пусто */); From 07b6bd75db07b70de840d1dde7ed7a4ae42f31d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sat, 18 Sep 2021 08:52:55 +0300 Subject: [PATCH 192/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=84=D1=83=D0=BD=D0=BA?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=B1=D0=BB=D0=B8=D0=B6=D0=B5=20=D0=BA?= =?UTF-8?q?=C2=A0=D1=82=D0=BE=D1=87=D0=BA=D0=B0=D0=BC=20=D0=B2=D1=8B=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=BE=D0=B2=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive.ref | 44 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index d674a783..5f24cbfc 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -30,28 +30,6 @@ $EXTERN OptTree-Drive-Expr; */ -/* Функция генерирует имена остаточных прогоняемых функций */ - -GenRemainderFuncNames { - s.Label e.Name s.End s.End = /* пусто — пустую функцию прогнать нельзя */; - - s.Label e.Name s.Cur s.End - = (s.Label ) - s.End>; -} - -AddStarSuffix { - e.Name 0 = e.Name; - e.Name SUF e.Suffix s.Count = e.Name SUF e.Suffix '*' s.Count; - e.Name s.Count = e.Name SUF '*' s.Count; -} - -BaseName { - e.Name SUF '*' s.Count = e.Name s.Count; - e.Name '*' s.Count = e.Name s.Count; - e.Name /* нет суффикса */ = e.Name 0; -} - /** == e.AST @@ -243,6 +221,28 @@ MultiplyRemainderNames { = e.RemainderNames; } +/* Функция генерирует имена остаточных прогоняемых функций */ + +GenRemainderFuncNames { + s.Label e.Name s.End s.End = /* пусто — пустую функцию прогнать нельзя */; + + s.Label e.Name s.Cur s.End + = (s.Label ) + s.End>; +} + +AddStarSuffix { + e.Name 0 = e.Name; + e.Name SUF e.Suffix s.Count = e.Name SUF e.Suffix '*' s.Count; + e.Name s.Count = e.Name SUF '*' s.Count; +} + +BaseName { + e.Name SUF '*' s.Count = e.Name s.Count; + e.Name '*' s.Count = e.Name s.Count; + e.Name /* нет суффикса */ = e.Name 0; +} + HashSet { e.Names = From 52f5792ed662807e73256b39b54ead505d6bcbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 20 Sep 2021 21:55:46 +0300 Subject: [PATCH 193/208] =?UTF-8?q?FIXED:=20=D0=BF=D1=80=D0=BE=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=BA=D0=B8=20?= =?UTF-8?q?=D1=8D=D0=BA=D0=B7=D0=B5=D0=BC=D0=BF=D0=BB=D1=8F=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D1=8F=D0=B5=D1=82?= =?UTF-8?q?=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D1=8D=D0=BA=D0=B7?= =?UTF-8?q?=D0=B5=D0=BC=D0=BF=D0=BB=D1=8F=D1=80=D1=8B=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Конкретная проблема предыдущего коммита была в том, что на вход финальной прогонки экземпляров подавалось дерево с функцией Func*n, но при этом функция Func в дереве могла отсутствовать. Для прогонщика это было нарушением инварианта. Исправление свелось к тому, что Func*n уже больше не подлежат финальной прогонке, т.к. подлежат только экземпляры — функции с другим суффиксом @n. Была и другая проблема (не проявлялась). Она была в том, что ранее на финальном этапе выполнялась разметка всех функций для прогонки, а функции с именами вида Func*n прогонялись уже не адекватно, т.к. предложения в них уже могли быть размножены, и прогонка одного предложения приводила бы к неправильной функции Func*‹n+1›. --- src/compiler/OptTree-AutoMarkup.ref | 23 +++++++++++++++++++++++ src/compiler/OptTree.ref | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/compiler/OptTree-AutoMarkup.ref b/src/compiler/OptTree-AutoMarkup.ref index 1b2da8cc..1c44482b 100644 --- a/src/compiler/OptTree-AutoMarkup.ref +++ b/src/compiler/OptTree-AutoMarkup.ref @@ -37,6 +37,29 @@ $ENTRY OptTree-AutoMarkup-Drive { > } + +/** + == e.AST +*/ +$ENTRY OptTree-AutoMarkup-DriveInstances { + e.AST + = +} + + MakeGraphNode { (Function (e.MetatableName) Metatable e.Metatable) = Date: Tue, 21 Sep 2021 08:29:00 +0300 Subject: [PATCH 194/208] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D0=B3=D0=B8=20=D0=B8=C2=A0=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 12 ++++++------ src/compiler/OptTree-Spec.ref | 7 +++---- src/compiler/TreeUtils.ref | 3 +-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 3fdf009f..0bab7b07 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -211,7 +211,7 @@ OptOneCall { /* Поиск информации для прогонки */ = : e.OptFuncs^ t.FunctionForDrive - = @@ -302,7 +302,7 @@ eDRIVEN { } /* - @@ -312,7 +312,7 @@ eDRIVEN { e.Contractions включают в себя сужение e.DRIVEN для подстановки правой части. */ -OptExpr-MakeSubstitutions { +OptOneCall-MakeSubstitutions { s.Contractions-Mode (e.UsedVars) (e.Expr) (e.Args) t.IntrinsicFunction t.Metatables , t.IntrinsicFunction : ((e._) Intrinsic e.BehaviorName) @@ -345,7 +345,7 @@ OptExpr-MakeSubstitutions { : e.Args^ = t.Metatables - ; @@ -372,7 +372,7 @@ MakeColdSolution { ); } -DoOptExpr-MakeSubstitutions { +DoOptOneCall-MakeSubstitutions { (e.SentenceVars) (e.Args) (e.Substitutions) ((e.Name) Sentences ((e.LS) (e.RS)) e.Rest) = : e.RS^ @@ -405,7 +405,7 @@ DoOptExpr-MakeSubstitutions { > : e.NewSubstitutions = e.Substitutions e.NewSubstitutions : e.Substitutions^ - = ) Sentences e.Rest) >; diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index c36b4d0a..5cf0bf83 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -946,13 +946,12 @@ GenericMatch-Spec { = Clear ; - (e.Expr) (e.Pattern) = Undefined + (e.Expr) (e.Pattern) = Undefined; } ExtractCalls-Expr { @@ -1094,7 +1093,7 @@ WrapVars { WrapVar { 'e' e.Expr = (GhostBrackets e.Expr); - s.Mode e.Expr = e.Expr + s.Mode e.Expr = e.Expr; } RemoveLastGhostBracket { diff --git a/src/compiler/TreeUtils.ref b/src/compiler/TreeUtils.ref index 438cfcdc..ba931707 100644 --- a/src/compiler/TreeUtils.ref +++ b/src/compiler/TreeUtils.ref @@ -276,8 +276,7 @@ ApplyContractions-Expr { ApplyContractions-Term { (e.Contrs) ('{'s.Coord'}') = (e.Contrs) ('{'s.Coord'}'); - (e.Contrs) (Symbol e.Symbol) - = (e.Contrs) (Symbol e.Symbol); + (e.Contrs) (Symbol e.Symbol) = (e.Contrs) (Symbol e.Symbol); (e.Contrs) (Brackets e.Expr) = : (e.Contrs^) e.Expr^ From a31d9fee3be8e23a2e6ffc8c370b40c8b8640d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 21 Sep 2021 09:30:59 +0300 Subject: [PATCH 195/208] =?UTF-8?q?=D0=9D=D0=B5=D0=BA=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D1=8B=D0=B9=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B2=D1=8B=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9=20(#230,=20#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Drive-Expr.ref | 85 +++++++++++++---------------- 1 file changed, 37 insertions(+), 48 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 0bab7b07..86e5e80a 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -215,32 +215,19 @@ OptOneCall { s.Contractions-Mode (e.UsedVars) (e.Expr) (e.Args) t.FunctionForDrive t.Metatables > - : t.Metatables^ e.SubstitutionPacks - - = > : e.Domain - = : e.PseudoPattern - - = : e.DrivenRight - = : e.DrivenRight^ - = (e.NewFunctions e.NewFunction) - ((e.UsedVars) e.Contractions (e.DrivenRight)); - } - (/* new functions */) - e.SubstitutionPacks - > - : (e.NewFunctions) e.Branches + : t.Metatables^ (e.NewFunctions) e.Branches - = : e.Branches^ + = : e.Branches^ = (s.Contractions-Mode t.Metatables e.OptFuncs) (e.NewFunctions) e.Branches } FilterScreenedBranches { - (e.PatTemplate) e.Branches + (e.Args) e.Branches + = > : e.Domain + = : e.PatTemplate + = - == t.Metatables (e.Substitutions)* - e.Substitutions ::= e.Contractions (e.NewFunctions) + == t.Metatables (e.NewFunctions) (e.Branches)* + e.Branches ::= (e.UsedVars) e.Contractions (e.Expr^) e.Contractions включают в себя сужение e.DRIVEN для подстановки правой части. */ OptOneCall-MakeSubstitutions { - s.Contractions-Mode - (e.UsedVars) (e.Expr) (e.Args) t.IntrinsicFunction t.Metatables + s.Contractions-Mode (e.UsedVars) (e.Expr) (e.Args) t.Function t.Metatables + + = + : t.Metatables^ e.SubstitutionPacks + + = : e.DrivenRight + = : e.DrivenRight^ + = (e.NewFunctions e.NewFunction) + ((e.UsedVars) e.Contractions (e.DrivenRight)); + } + (/* new functions */) + e.SubstitutionPacks + > + : (e.NewFunctions) e.Branches + + = t.Metatables (e.NewFunctions) e.Branches +} + +OptOneCall-MakeSubstitutions-Aux { + s.Contractions-Mode (e.UsedVars) (e.Args) t.IntrinsicFunction t.Metatables , t.IntrinsicFunction : ((e._) Intrinsic e.BehaviorName) = : { @@ -327,15 +337,14 @@ OptOneCall-MakeSubstitutions { ; }; - s.Contractions-Mode (e.UsedVars) (e.Expr) (e.Args) - t.Function t.Metatables + s.Contractions-Mode (e.UsedVars) (e.Args) t.Function t.Metatables /* Активные вызовы игнорируем */ , : False = t.Metatables ; - s.Contractions-Mode (e.UsedVars) (e.Expr) (e.Args) - ((e.Name) Sentences e.Body) t.Metatables + s.Contractions-Mode + (e.UsedVars) (e.Args) ((e.Name) Sentences e.Body) t.Metatables = s.Contractions-Mode : { @@ -346,13 +355,8 @@ OptOneCall-MakeSubstitutions { = t.Metatables ; - - t.Contractions-Mode (e.UsedVars) (e.Expr) (e.Args) - t.Function t.Metatables - = t.Metatables ; } MakeColdSolution { @@ -378,21 +382,6 @@ DoOptOneCall-MakeSubstitutions { = : e.RS^ = : { - /* - В случае решения без сужений просто применяем замены. - */ - Success (e.UsedVars () (e.Assigns)) - = : e.CallReplacer - = e.Substitutions - ( - (e.UsedVars) - ( ':' e.CallReplacer) - (/* нет новых функций */) - ); - - /* - «Грязное» решение допускаем только в случае прогонки. - */ Success e.Solutions = Date: Tue, 21 Sep 2021 11:37:56 +0300 Subject: [PATCH 196/208] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B4=D0=B5=D1=80?= =?UTF-8?q?=D0=B6=D0=BA=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=BE=D0=B2=20=D1=81?= =?UTF-8?q?=C2=A0=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=BD=D1=8B=D0=BC=D0=B8=20?= =?UTF-8?q?=D0=B0=D1=80=D0=B3=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D0=BC?= =?UTF-8?q?=D0=B8=20(#230,=20#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Обнаружилась проблема, связанная с исчерпанием числа шагов на тесте varcopy-fail.ref. Я предположил, что проблема в лишних let-экземплярах, которые съедают один шаг. Поэтому всё-таки реализовал #230 в рамках исправления #362. Как оказалось, реализовать поддержку активных вызовов оказалось проще, чем я думал ранее. --- src/compiler/OptTree-Drive-Expr.ref | 141 +++++++++++++++++++++++----- src/compiler/OptTree-Drive.ref | 1 + src/compiler/OptTree-Spec.ref | 5 + 3 files changed, 126 insertions(+), 21 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 86e5e80a..9e2641ca 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -12,7 +12,7 @@ $EXTERN GenericMatch, Solve-Drive; *$FROM TreeUtils $EXTERN ExpandClosures-Result, ApplyContractions, ExtractVariables-Expr, - CreateContext, IsPassiveExpr, MarkAllVarsAsWhole, ApplyAssigns, HashName; + CreateContext, MarkAllVarsAsWhole, ApplyAssigns, HashName; /** @@ -337,15 +337,11 @@ OptOneCall-MakeSubstitutions-Aux { ; }; - s.Contractions-Mode (e.UsedVars) (e.Args) t.Function t.Metatables - /* Активные вызовы игнорируем */ - , : False - - = t.Metatables ; - s.Contractions-Mode (e.UsedVars) (e.Args) ((e.Name) Sentences e.Body) t.Metatables + = : (e.Calls) (e.CallOrder) e.Args^ + = s.Contractions-Mode : { Contractions-Enabled = e.Args; @@ -355,10 +351,56 @@ OptOneCall-MakeSubstitutions-Aux { = t.Metatables ; } +ExtractCalls { + e.Arg + = + : (s.NextId (e.Calls) (e.CallOrder)) e.Arg^ + = (e.Calls) (e.CallOrder) e.Arg +} + +ExtractCallsRec { + t.State e.Expr + = + (e.Calls (t.Call ':' t.Var)) + (e.CallOrder t.Var) + ) + t.Var; + }; + + t.State^ (s.Brackets e.Content) + , Brackets ClosureBrackets : e._ s.Brackets e._ + = : t.State^ e.Content^ + = t.State (s.Brackets e.Content); + + t.State^ (ADT-Brackets (e.Name) e.Content) + = : t.State^ e.Content^ + = t.State (ADT-Brackets (e.Name) e.Content); + + t.State^ t.Other = t.State t.Other; + } + t.State e.Expr + > +} + MakeColdSolution { (e.UsedVars) ((e.Name) Sentences e.Body) e.Args , e.Name : e.Prefix '*' s.Num @@ -377,7 +419,7 @@ MakeColdSolution { } DoOptOneCall-MakeSubstitutions { - (e.SentenceVars) (e.Args) (e.Substitutions) + (e.SentenceVars) (e.Args) (e.Substitutions) (e.Calls) (e.CallOrder) ((e.Name) Sentences ((e.LS) (e.RS)) e.Rest) = : e.RS^ = @@ -386,18 +428,36 @@ DoOptOneCall-MakeSubstitutions { = : e.CallReplacer - = e.Contrs ( ':' e.CallReplacer) : e.Contrs^ - = ((e.UsedVars) e.Contrs (/* нет новых функций */)); + = : e.RS^ + = + : { + Valid + = : e.CallReplacer + = e.Contrs ( ':' e.CallReplacer) : e.Contrs^ + = ((e.UsedVars) e.Contrs (/* нет новых функций */)); + + Invalid = Invalid; + }; } e.Solutions > - : e.NewSubstitutions - = e.Substitutions e.NewSubstitutions : e.Substitutions^ - = ) Sentences e.Rest) - >; + : { + e._ Invalid e._ + = e.Substitutions + + >; + + e.NewSubstitutions + = e.Substitutions e.NewSubstitutions : e.Substitutions^ + = ) Sentences e.Rest) + >; + }; /* Здесь либо Undefined, либо грязное решение в режиме встраивания, @@ -408,12 +468,51 @@ DoOptOneCall-MakeSubstitutions { >; }; - (e.SentenceVars) (e.Args) (e.Substitutions) t.RestFunction - = e.Substitutions ; + (e.SentenceVars) (e.Args) (e.Substitutions) (e.Calls) (e.CallOrder) + t.RestFunction + = e.Substitutions + + >; +} + +CheckCallOrder { + (e.CallOrder) e.Expr + = + : { + e.CallOrder e.ClosedCalls + , '>' e.ClosedCalls : e.ClosedCalls '>' + = Valid; + + e._ = Invalid; + } +} + +ExtractCallVars { + e.Expr + = ; + + (s.CallBrackets e.Content) + , CallBrackets ColdCallBrackets : e._ s.CallBrackets e._ + = '>'; + + (ADT-Brackets (e.Name) e.Content) = ; + + t.Other = /* пропускаем */; + } + e.Expr + > } Cleanup-Step-Drop { diff --git a/src/compiler/OptTree-Drive.ref b/src/compiler/OptTree-Drive.ref index 5f24cbfc..b63c7b79 100644 --- a/src/compiler/OptTree-Drive.ref +++ b/src/compiler/OptTree-Drive.ref @@ -473,6 +473,7 @@ CleanupCold-Result { CleanupCold-Term { (Brackets e.Expr) = (Brackets ); + (ClosureBrackets e.Expr) = (ClosureBrackets ); (ADT-Brackets (e.Name) e.Expr) = (ADT-Brackets (e.Name) ); diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 5cf0bf83..ac28addf 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -975,6 +975,11 @@ ExtractCalls-Term { : (e.Calls^ (e.UsedVars^)) e.Expr^ = (e.Calls (e.UsedVars)) (ADT-Brackets (e.Name) e.Expr); + (e.Calls (e.UsedVars)) (ClosureBrackets e.Expr) + = + : (e.Calls^ (e.UsedVars^)) e.Expr^ + = (e.Calls (e.UsedVars)) (ClosureBrackets e.Expr); + (e.Calls (e.UsedVars)) t.OtherTerm = (e.Calls (e.UsedVars)) t.OtherTerm; } From 9694ceb67e44457c0da6b323ed713d9985e60188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Tue, 21 Sep 2021 19:11:39 +0300 Subject: [PATCH 197/208] =?UTF-8?q?FIXED:=20=D1=87=D0=B0=D1=81=D1=82=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9=20=D0=BE?= =?UTF-8?q?=D0=B1=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D0=B8=D0=BC=D0=B8=D1=82=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=81=D0=B2=D0=B5=D1=80=D1=85=D1=83=20(#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Проблему прекрасно описывает обширный комментарий в коде. Тест varcopy-fail.ref переименован, т.к. он выявлял проблему, решённую в коде. --- ...opy-fail.ref => opt-tree-varcopy-fail.ref} | 0 src/compiler/OptTree-Spec.ref | 50 +++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) rename autotests/{varcopy-fail.ref => opt-tree-varcopy-fail.ref} (100%) diff --git a/autotests/varcopy-fail.ref b/autotests/opt-tree-varcopy-fail.ref similarity index 100% rename from autotests/varcopy-fail.ref rename to autotests/opt-tree-varcopy-fail.ref diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index ac28addf..03480f39 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -833,7 +833,7 @@ MakeNewFunction { : True e.HistoryPrefix ((e.HistoryName) e.HistorySignature) = ; (e.SpecInfo) (e.Name) e.History (e.InstanceName) @@ -854,7 +854,7 @@ MakeNewFunction-Generalize { вызов которой соответствует вызову исходной функции. */ e.SpecInfo (e.Name) (e.InstanceName) (e.Signature) (e.NewArg) - (e.HistoryPrefix) ((e.HistoryName '@' 0) e.HistorySignature) + (e.HistoryPrefix) ((e.HistoryName '@' 0) e.HistorySignature) (e.Solutions) = (e.SpecInfo) (ColdFunction LET (e.InstanceName) @@ -871,7 +871,7 @@ MakeNewFunction-Generalize { /* Простое зацикливание: текущая сигнатура есть частный случай старой. */ e.SpecInfo (e.Name) (e.InstanceName) (e.Signature) (e.NewArg) - (e.HistoryPrefix) ((e.HistoryName) e.HistorySignature) + (e.HistoryPrefix) ((e.HistoryName) e.HistorySignature) (e.Solutions) , : Clear e.NewSubst @@ -894,9 +894,51 @@ MakeNewFunction-Generalize { ((e.InstanceName) e.HistoryPrefix ((e.InstanceName) e.Signature)) ); + /* + Хитрое зацикливание: старая сигнатура есть частный случай текущей. + Такое возможно, если e-переменной текущей сигнатуры соответствует + пустота в старой. + + Формально тут должно строиться обобщение, которое должны оба экземпляра + вызывать (см. общий случай в последнем предложении), история обобщения + будет совпадать с историей верхнего экземпляра. + + Но обобщение будет совпадать с текущей сигнатурой, что в последнем + предложении привело бы к созданию let-экземпляра, который вызывает + себя. Поэтому тут надо разобрать частный случай — построить явным образом + экземпляр для текущей сигнатуры и патч для верхней. + */ + e.SpecInfo (e.Name) (e.InstanceName) (e.Signature) (e.NewArg) + (e.HistoryPrefix) ((e.HistoryName) e.HistorySignature) (e.Solutions) + + , : Clear e.PatchSubst + + = e.SpecInfo : (e.Body) s.NextNumber e.Signatures + = : e.NewSentences + + = (e.SpecInfo) + (PatchFunc + (e.HistoryName) + Sentences + ( + () + /* = */ + ( + (CallBrackets + (Symbol Name e.InstanceName) + (e.PatchSubst)> + ) + ) + ) + ) + (Function (e.InstanceName) Sentences e.NewSentences) + ( + ((e.InstanceName) e.HistoryPrefix ((e.InstanceName) e.Signature)) + ); + /* Зацикливание с обобщением */ e.SpecInfo (e.Name) (e.InstanceName) (e.Signature) (e.NewArg) - (e.HistoryPrefix) ((e.HistoryName) e.HistorySignature) + (e.HistoryPrefix) ((e.HistoryName) e.HistorySignature) (e.Solutions) /* Получает обобщённую сигнатуру для двух сигнатур */ = : e.GenSignature From d5847ba94f1440794b45ef6d6046cd3c11254c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 22 Sep 2021 09:42:55 +0300 Subject: [PATCH 198/208] =?UTF-8?q?FIXED:=20=D0=BF=D0=BE=D0=B4=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=BA=D0=B5=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=BE=D0=B2=20=D1=81=C2=A0=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D0=B2=D0=BD=D1=8B=D0=BC=D0=B8=20=D0=B0=D1=80=D0=B3=D1=83?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D0=BC=D0=B8=20(#230)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/opt-tree-drive5-active-call.ref | 23 ++ ...d-test-10_Tue-Sep-21-22-36-44-UTC-2021.ref | 366 ++++++++++++++++++ src/compiler/OptTree-Drive-Expr.ref | 4 +- 3 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 autotests/opt-tree-drive5-active-call.ref create mode 100644 autotests/positive-random-test/saved-test-10_Tue-Sep-21-22-36-44-UTC-2021.ref diff --git a/autotests/opt-tree-drive5-active-call.ref b/autotests/opt-tree-drive5-active-call.ref new file mode 100644 index 00000000..15a8655c --- /dev/null +++ b/autotests/opt-tree-drive5-active-call.ref @@ -0,0 +1,23 @@ +* TREE + +$ENTRY Go { + /* empty */ + = : Z Z + = : DD + = /* empty */ +} + +F { + s.7 = s.7> +} + +*$DRIVE D + +D { + e.6 DD = e.6; + e.Z = e.Z; +} + +*$NOOPT N + +N { e.X = e.X } \ No newline at end of file diff --git a/autotests/positive-random-test/saved-test-10_Tue-Sep-21-22-36-44-UTC-2021.ref b/autotests/positive-random-test/saved-test-10_Tue-Sep-21-22-36-44-UTC-2021.ref new file mode 100644 index 00000000..201ce422 --- /dev/null +++ b/autotests/positive-random-test/saved-test-10_Tue-Sep-21-22-36-44-UTC-2021.ref @@ -0,0 +1,366 @@ +$EXTERN ExtBAD ; + + + +$ENTRY DDB { + DAC 'c' BB (e.9 (DDDD BBDB 'a' 2 e.7 (8 e.6 'b' ) () e.13 6 ) ) e.11 (e.5 ) +e.5 ACBA 'c' 1 'c' e.6 'b' 9 7 e.12 + ,: + { + 2 e.11 'cd' + ,'ba' e.11 : 7 () CCAC 'a' + ,1 : 'c' CDCD = + 0 ; + 'a' ADC 'b' = + AAA AB CCAC ; + 'a' + ,'c' ( BCC e.6 ) : 4 = + e.11 e.13 A ; + }; + DAC 'c' BB 8 BAAD e.10 s.7 BD e.12 + ,BDBA 'c' + (s.7 'a' ) 'a' > DD 'c' DDBB 'd' ( +AAB 'b' e.10 ) > : + { + + ,: DCD (1 'a' ) + ,: = + ; + }; + DAC 'c' BB 4 CCAC s.13 s.7 BD e.12 + ,e.12 s.13 (D (AC CADB 7 ) ( > 9 ) s.13 'a' +e.12 s.7 CB ) 1 (DB s.13 'a' 6 1 7 > ) 3 s.7 : + { + e.6 DD + ,: 7 + ,: 4 + ,: + ,D 2 : (4 2 5 CCD 'c' ) 9 + + ,: = + ; + }; + DAC 'c' BB () (CDD s.4 BC (() 'a' ADAA ) 'b' ) DB 6 'ab' e.3 s.4 'a' e.13 s.13 s.7 BD e.12 = + 7 ; + DAC 'c' BB () (CDD s.4 BC (() 'a' ADAA ) 'b' ) DB 6 'ab' (ACAB ) 4 2 s.13 s.7 BD e.12 + + ,s.4 'a' : + { + 'a' e.8 CAA 5 2 + ,(AAA ) : CBBC A e.1 BCCA s.5 + ,e.12 : = + 3 ; + 'a' () B s.9 6 (0 s.9 () ) ACDA 'd' CB 1 e.12 4 CC AC 7 1 5 2 + ,: + +,: C (CCDB e.6 DC ) e.1 (e.6 ) 'c' BD + ,: + ,1 : 'c' = + ('b' A ) 3 BBBC 10 ; + }; +} + +$ENTRY DAC { + e.9 () + ,CC : + { + ('d' C ) + ,'a' : + ,'d' : + , (e.9 0 e.9 ) + 6 : + ,3 5 B 'd' : + ,: = + ; + 0 'b' 9 ('d' C ) + ,BA : 3 9 CC 'c' D 'ab' + ,: 4 'b' + + ,(DAA () C e.9 ) 'c' : + ,: + { + 'b' (t.2 ) 'a' BDB 3 e.6 2 DB + ,t.2 : + ,e.9 e.9 : 'b' e.6 2 + + ,: e.13 CCC e.13 + ,: + ,: 3 = + D ; + 'b' (t.2 ) 'a' A e.2 (s.11 ) 4 2 DB BA A 'b' + ,: 8 = + s.11 ; + }; + BAD s.7 4 s.12 9 ('d' C ) + ,() 'd' : 'daa' (e.10 ('b' e.13 0 ) +BC ) + ,: D e.5 BAD 4 = + 'c' e.9 DA ; + }; + 'a' () = + 'c' ; + (s.8 t.11 DDD 1 ) 0 () = + ; + (s.8 t.11 DDD 1 ) e.12 7 'da' 8 'a' 0 () + ,t.11 : + { + 0 (e.4 'c' ) 8 0 9 s.7 BA 8 + ,: + , B C > +'c' : () DBCC = + 9 ; + 0 (4 ) CAA ('c' ) AAD 'b' 9 s.7 BA 8 + , : 0 + ,CB : e.4 2 e.7 (e.6 CDA t.3 ) + + ,: (CD 7 e.12 'd' e.5 (2 DDCC 'd' (8 4 B ) ) ((e.9 'cdc' e.13 ) +2 'c' 3 A ) ) ADDA ('d' ) e.4 'dd' = + t.11 t.11 1 ; + }; +} + +$ENTRY DCBDC { + DAA e.5 t.11 BA 1 'b' CD + , : + { + A + ,CAAB DB (CACB 'a' (() ) ) : + , : + ,B 7 e.5 (() +) : e.3 'b' + ,(BBDA 'bb' ) (BAD ) 'd' : (AAB ) + = + ; + }; + DAA e.5 t.11 BA e.1 'a' AD ABAD e.6 s.3 (AD ) s.12 DBAC = + 2 s.3 'c' ; + DAA e.5 t.11 BA e.1 'a' 9 1 s.3 (AD ) s.12 DBAC + ,( e.1 > ) (4 (6 8 e.1 'd' C 'ac' ) s.12 4 (BCDB e.5 e.5 AAAC A ) > e.1 ) 2 : + { + DADD e.6 e.10 + ,: + ,: + { + + ,: CDAC (e.1 'b' ) + ,: 'b' DB + ,: 'c' () + +,: e.5 'a' + ,: = + ; + }; + e.11 e.10 D CBA (s.11 s.10 ('c' s.10 CD ('d' ) ) 1 ) 'c' + ,: (e.11 ) +s.6 BC = + ; + }; + DAA e.5 t.11 BA e.1 'ab' 5 'b' 1 s.3 (AD ) s.12 DBAC + ,: + { + AA e.7 CA DC BD = + ; + AA s.2 BC DC BD + ,6 : ('d' e.2 4 e.13 ) + ,: e.7 + ,e.2 s.12 e.1 : + = + e.2 5 ; + }; + DAA e.5 t.11 BA e.1 'ab' 5 10 1 s.3 (AD ) s.12 DBAC + ,: + { + (D DBC ) AB s.1 ADA 'c' + ,'cd' : = + ; + }; +} + +$ENTRY CBCC { + 'c' 10 0 s.4 + ,'c' : + { + 2 e.11 + ,: + ,: + ,: ABA BBAD 'c' + ,'a' (3 'b' ) +: e.11 + ,C : + { + 8 (6 ) 0 ADD 'd' = + ; + 8 (6 ) 0 ADD 8 3 'ad' + ,: 'b' ((t.4 e.6 D 10 ) (2 ) ) e.9 e.2 2 + + ,10 1 e.6 7 : + ,DCA e.2 DDDB : + ,t.4 2 C : 'c' 10 () + ,: +3 = + ; + }; + 2 (s.2 'dc' ) B 'a' s.6 + ,5 : + { + DDAD 'b' 3 e.8 2 8 + ,(DDDC e.8 ) : + ,(BCC ) 'c' +e.8 : () + ,: CDA e.7 e.5 (e.4 (5 e.7 ) (e.8 D DA DDD ) e.5 ) = + 'd' 1 ; + DDAD 'b' 3 BB 'b' A e.8 2 8 + ,: 1 3 e.3 + ,: A + ,s.6 8 : 9 (BAAD 'c' +e.10 ) + ,: e.7 'c' + ,: = + 'ad' ; + DDAD 'b' 3 BB 'b' A e.8 2 8 + ,'a' : B + ,: e.10 9 + ,'ac' +: + ,8 : = + (1 ) > ; + }; + 2 (s.2 'dc' ) DBC 0 'da' e.6 10 t.12 s.6 + ,10 DA : + ,(C (9 BC ('d' 6 'd' ) 9 ) ) 0 CD s.6 'b' : + ,: + ,C 'db' 'a' > : + { + t.2 t.5 e.6 AD AC e.12 A CA (() 2 BDB () 0 ) 9 + ,(e.6 ) : + ,: + + ,: t.4 (s.7 (e.3 e.11 'd' ) ) + ,: = + ; + t.2 t.5 t.1 DBDC s.8 t.1 t.10 ACBC AACA A CA (() 2 BDB () 0 ) 9 + , : +s.12 + ,: = + ; + t.2 t.5 t.1 DBDC s.8 10 t.11 (0 8 ) t.3 'd' 1 t.1 t.10 ACBC AACA A CA (() 2 BDB () 0 ) +9 + ,: 0 DBCA 9 + ,: AA 'c' + ,'c' t.2 2 'b' : 5 8 0 = + ; + }; + }; + 'c' 0 (e.7 BA e.8 e.1 ) B D 'a' BDC () t.6 'd' s.4 + ,'b' 10 : + { + 4 'd' DA + ,'bd' : BCD = + A 'd' ; + 4 'c' 9 (10 ) 'd' AC = + 2 A ; + 4 'c' (4 4 'd' ) t.1 'd' e.10 (e.2 BDD ) (t.1 7 ) 9 (10 ) 'd' AC = + ; + }; + 'cd' ('d' CABA ADA 8 e.1 ) e.12 'b' DDAA 'c' s.4 + ,() 'd' ADBB : + + { + (B t.2 ) s.7 'a' + , 'c' > DDA : CBB 1 = + 'ac' ; + (B t.2 ) s.7 (s.10 e.5 ) 10 t.4 'a' e.6 6 'bcba' + ,'b' 10 s.4 : +ACAB = + ; + (B t.2 ) s.7 (s.10 e.5 ) 10 t.4 'cba' + ,e.12 s.4 : + ,'c' +: + ,'b' 0 : e.13 7 'c' DCA CABB + ,: = + 7 s.7 > DA ; + }; + 'c' ('b' ) ('c' ) t.3 0 2 s.8 s.4 + ,8 'bad' 10 3 : + { + DAB 7 e.3 + ,: t.2 BDDB = + 'd' 4 s.4 'a' ; + }; + 'c' ('b' ) ('c' ) t.3 AAAB 'c' ABB B DABD 'cb' 0 2 s.8 s.4 + ,: + { + D t.1 'b' 6 'b' + ,'a' s.4 'c' : 7 0 + ,: AD 'a' DAC + + , > : 'a' + ,(ABAC 'd' () ) : (BAD e.8 ) 'd' + + ,10 5 : = + ; + 8 'b' + ,'cc' : () + ,: C ABD e.12 + ,7 : e.4 8 'cc' +0 e.4 5 + ,0 : DCC 3 0 + ,'d' : s.8 DDCD = + ; + }; +} + +AAA { + 'c' 2 = + ; + CAC 9 'd' e.5 10 'c' + ,: + { + 'b' 8 8 + ,BCCA 3 ( ) ABC DDBD 'b' : 4 'd' ACA + + ,: = + 'b' BDAB ; + 'b' s.9 'c' DDCD t.8 + ,: CCCD 'da' e.10 'a' + ,BB DCDC : DA e.7 = + ; + }; + t.10 (e.11 ) DC 'c' = + t.10 5 C 'aa' ; +} + +CC { + s.13 6 e.2 + , 'b' +8 'bc' : + { + 'a' 0 'b' s.12 9 (AACC ) C = + s.12 ; + }; + s.13 e.1 e.11 DCD = + 5 C ; + s.13 e.1 10 B () e.3 s.2 t.13 = + ; + s.13 e.1 10 B () 7 'd' () 'd' e.13 e.12 5 t.2 t.13 + ,DDB 'd' +BA : + { + + ,: 'd' CB e.2 + ,e.1 'd' : + ,: 'a' + ,: AB 4 (C e.3 e.10 ) +e.13 e.6 + , > B > (DD 4 ) BDD : DCBB 7 BA = + t.2 ; + }; + s.13 e.1 10 B () 7 'd' () 'd' 6 CAD e.6 AA e.13 e.12 5 t.2 t.13 = + 4 ; +} diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index 9e2641ca..bb020954 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -428,11 +428,11 @@ DoOptOneCall-MakeSubstitutions { = : e.RS^ = : { Valid - = : e.CallReplacer + = : e.RS^ + = : e.CallReplacer = e.Contrs ( ':' e.CallReplacer) : e.Contrs^ = ((e.UsedVars) e.Contrs (/* нет новых функций */)); From 2a8e5dfb77281dc70e275a4fcef3bb4eb3036f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Wed, 22 Sep 2021 11:26:40 +0300 Subject: [PATCH 199/208] =?UTF-8?q?FIXED:=20=D1=83=D1=82=D0=BE=D1=87=D0=BD?= =?UTF-8?q?=D1=91=D0=BD=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BE=D1=85=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=20=D1=80=D0=B0=D1=81=D0=BF?= =?UTF-8?q?=D1=83=D1=85=D0=B0=D0=BD=D0=B8=D1=8F=20(#332,=20#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь специализация одного вызова может порождать несколько экземпляров, а значит, сравнение на точное значение может «перескочить». --- src/compiler/OptTree-Spec.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index 03480f39..b9ecbaf4 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -599,7 +599,7 @@ SpecCall { /* TODO: убрать этот хак в рамках задачи #332 */ (e.Name) (e.Body) s.NextNumber e.Signatures (e.Argument) (e.History) - , s.NextNumber : 150 + , : '+' = ((e.Body) s.NextNumber e.Signatures) (CallBrackets (Symbol Name e.Name) e.Argument) /* пусто */ (/* пусто */); From d9f72cd15b5bcff35068cf175eca02ab37e076a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 4 Sep 2022 21:03:36 +0300 Subject: [PATCH 200/208] =?UTF-8?q?=D0=A1=D1=82=D0=B8=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0:=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4=D1=8B=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BA=20=D0=BD=D0=B0=C2=A0=D0=BA=D0=BE=D0=BD=D1=86=D0=B0?= =?UTF-8?q?=D1=85=20=D0=B8=D1=81=D1=85=D0=BE=D0=B4=D0=BD=D0=B8=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autotests/compatibility/escapes1.SYNTAX-ERROR.ref | 2 +- autotests/compatibility/escapes2.SYNTAX-ERROR.ref | 2 +- autotests/compatibility/tab.OK.ref | 2 +- autotests/compatibility/unnamed-adt.SYNTAX-ERROR.ref | 2 +- autotests/lexgen/strange-alternative.BAD-SYNTAX-LEXGEN.sref | 2 +- autotests/opt-tree-drive5-active-call.ref | 2 +- autotests/pseudocomments-warning-native-drive.WARNING.ref | 2 +- autotests/pseudocomments-warning-native-opt.WARNING.ref | 2 +- autotests/pseudocomments-warning-native-spec.WARNING.ref | 2 +- autotests/repeated.WARNING.ref | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/autotests/compatibility/escapes1.SYNTAX-ERROR.ref b/autotests/compatibility/escapes1.SYNTAX-ERROR.ref index 14582e70..e76d968f 100644 --- a/autotests/compatibility/escapes1.SYNTAX-ERROR.ref +++ b/autotests/compatibility/escapes1.SYNTAX-ERROR.ref @@ -1,3 +1,3 @@ $ENTRY Go { = 'abcd\ -} \ No newline at end of file +} diff --git a/autotests/compatibility/escapes2.SYNTAX-ERROR.ref b/autotests/compatibility/escapes2.SYNTAX-ERROR.ref index a6e5497a..752e682b 100644 --- a/autotests/compatibility/escapes2.SYNTAX-ERROR.ref +++ b/autotests/compatibility/escapes2.SYNTAX-ERROR.ref @@ -1,3 +1,3 @@ $ENTRY Go { = 'abcd\q'; -} \ No newline at end of file +} diff --git a/autotests/compatibility/tab.OK.ref b/autotests/compatibility/tab.OK.ref index 5eb0e940..7b52ed6a 100644 --- a/autotests/compatibility/tab.OK.ref +++ b/autotests/compatibility/tab.OK.ref @@ -1,4 +1,4 @@ $ENTRY Go { * tabs, don't change to spaces: = ; -} \ No newline at end of file +} diff --git a/autotests/compatibility/unnamed-adt.SYNTAX-ERROR.ref b/autotests/compatibility/unnamed-adt.SYNTAX-ERROR.ref index b351e076..d0805443 100644 --- a/autotests/compatibility/unnamed-adt.SYNTAX-ERROR.ref +++ b/autotests/compatibility/unnamed-adt.SYNTAX-ERROR.ref @@ -1,3 +1,3 @@ $ENTRY Go { = [1 2 3]; -} \ No newline at end of file +} diff --git a/autotests/lexgen/strange-alternative.BAD-SYNTAX-LEXGEN.sref b/autotests/lexgen/strange-alternative.BAD-SYNTAX-LEXGEN.sref index adf7f01d..df28a3bc 100644 --- a/autotests/lexgen/strange-alternative.BAD-SYNTAX-LEXGEN.sref +++ b/autotests/lexgen/strange-alternative.BAD-SYNTAX-LEXGEN.sref @@ -1,3 +1,3 @@ /*GEN:TOKENS Root = 'x' . -GEN:END*/ \ No newline at end of file +GEN:END*/ diff --git a/autotests/opt-tree-drive5-active-call.ref b/autotests/opt-tree-drive5-active-call.ref index 15a8655c..045655a8 100644 --- a/autotests/opt-tree-drive5-active-call.ref +++ b/autotests/opt-tree-drive5-active-call.ref @@ -20,4 +20,4 @@ D { *$NOOPT N -N { e.X = e.X } \ No newline at end of file +N { e.X = e.X } diff --git a/autotests/pseudocomments-warning-native-drive.WARNING.ref b/autotests/pseudocomments-warning-native-drive.WARNING.ref index 3e1ee854..7df47504 100644 --- a/autotests/pseudocomments-warning-native-drive.WARNING.ref +++ b/autotests/pseudocomments-warning-native-drive.WARNING.ref @@ -9,4 +9,4 @@ D { refalrts::splice_to_freelist(vm, arg_begin, arg_end); return refalrts::cSuccess; %% -} \ No newline at end of file +} diff --git a/autotests/pseudocomments-warning-native-opt.WARNING.ref b/autotests/pseudocomments-warning-native-opt.WARNING.ref index 5e133902..e3deead6 100644 --- a/autotests/pseudocomments-warning-native-opt.WARNING.ref +++ b/autotests/pseudocomments-warning-native-opt.WARNING.ref @@ -9,4 +9,4 @@ S { refalrts::splice_to_freelist(vm, arg_begin, arg_end); return refalrts::cSuccess; %% -} \ No newline at end of file +} diff --git a/autotests/pseudocomments-warning-native-spec.WARNING.ref b/autotests/pseudocomments-warning-native-spec.WARNING.ref index 811fd940..ad714451 100644 --- a/autotests/pseudocomments-warning-native-spec.WARNING.ref +++ b/autotests/pseudocomments-warning-native-spec.WARNING.ref @@ -9,4 +9,4 @@ S { refalrts::splice_to_freelist(vm, arg_begin, arg_end); return refalrts::cSuccess; %% -} \ No newline at end of file +} diff --git a/autotests/repeated.WARNING.ref b/autotests/repeated.WARNING.ref index 2a7ee50b..6413d034 100644 --- a/autotests/repeated.WARNING.ref +++ b/autotests/repeated.WARNING.ref @@ -35,4 +35,4 @@ TestLastSentence { SomeProcessing { e.Any = e.Any -} \ No newline at end of file +} From 3541850fb02f26699ae357ea5c12f0a1815c9392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 4 Sep 2022 21:04:07 +0300 Subject: [PATCH 201/208] =?UTF-8?q?FIXED2:=20=D0=BF=D0=BE=D0=B4=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=BA=D0=B5=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B7=D0=BE=D0=B2=D0=BE=D0=B2=20=D1=81=C2=A0=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=B8=D0=B2=D0=BD=D1=8B=D0=BC=D0=B8=20=D0=B0=D1=80=D0=B3?= =?UTF-8?q?=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D0=BC=D0=B8=20(#230)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Предыдущий коммит d5847ba94f устранял падение компилятора, скрывая ошибку: оптимизация просто переставала работать. --- src/compiler/OptTree-Drive-Expr.ref | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/OptTree-Drive-Expr.ref b/src/compiler/OptTree-Drive-Expr.ref index bb020954..724244ae 100644 --- a/src/compiler/OptTree-Drive-Expr.ref +++ b/src/compiler/OptTree-Drive-Expr.ref @@ -428,12 +428,12 @@ DoOptOneCall-MakeSubstitutions { = : e.RS^ = : { Valid - = : e.RS^ - = : e.CallReplacer - = e.Contrs ( ':' e.CallReplacer) : e.Contrs^ + = : e.CallReplacer + = ( ':' e.CallReplacer) e.Contrs : e.Contrs^ = ((e.UsedVars) e.Contrs (/* нет новых функций */)); Invalid = Invalid; From c50f7d803bea27f445ddf79874f30804dab73262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Sun, 5 Nov 2023 02:09:14 +0300 Subject: [PATCH 202/208] =?UTF-8?q?FIXED:=20=D0=BB=D0=B8=D0=BC=D0=B8=D1=82?= =?UTF-8?q?=20=D0=BF=D0=B0=D0=BC=D1=8F=D1=82=D0=B8=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20autotests/Library=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B2=D1=8B=D1=88=D0=B5=D0=BD=20(#341)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit После вливания правок по #341 в FindErrors в Checker.ref увеличилась потребность в памяти — дерево e.AST теперь копируется: ; Поэтому пришлось повысить лимит для компиляции Library.ref в соответствующей папке. --- autotests/Library/@refal-5-lambda-diagnostics.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autotests/Library/@refal-5-lambda-diagnostics.ini b/autotests/Library/@refal-5-lambda-diagnostics.ini index 9d875059..297f1fa7 100644 --- a/autotests/Library/@refal-5-lambda-diagnostics.ini +++ b/autotests/Library/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ -memory-limit = 500000 +memory-limit = 1000000 step-limit = 2000000 idents-limit = 5000 enable-debugger = false From 9bc302d4216a14d4548620c7699a8d2721509d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Fri, 16 May 2025 13:14:34 +0300 Subject: [PATCH 203/208] =?UTF-8?q?FIXED:=20=D0=B0=D0=BA=D1=82=D1=83=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8?= =?UTF-8?q?=D1=8F=20Far=20Colorer=20=D1=82=D1=80=D0=B5=D0=B1=D1=83=D0=B5?= =?UTF-8?q?=D1=82=20=D0=BA=D0=BE=D0=B4=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D1=83?= =?UTF-8?q?=20UTF-8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editors/far/refal-5-lambda.hrc | 2 +- editors/far/simple-refal.hrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/editors/far/refal-5-lambda.hrc b/editors/far/refal-5-lambda.hrc index 0143cc1c..88e7925f 100644 --- a/editors/far/refal-5-lambda.hrc +++ b/editors/far/refal-5-lambda.hrc @@ -1,4 +1,4 @@ - + + Date: Mon, 1 Dec 2025 09:28:46 +0300 Subject: [PATCH 204/208] =?UTF-8?q?=D0=9F=D0=BE=D0=B2=D1=8B=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D0=BE=D1=87=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=B8=D0=BD=D0=B0=D0=BC=D0=B8=D1=87=D0=B5=D1=81?= =?UTF-8?q?=D0=BA=D0=BE=D0=B3=D0=BE=20=D0=BE=D0=B1=D0=BE=D0=B1=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20(#251,=20#322,=20#362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 132 ++++++++++++---------------------- 1 file changed, 47 insertions(+), 85 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index 752a8042..ffa07f69 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -158,7 +158,7 @@ Solve-Spec-DoFindGeneralization { : { e._ (Generalize (e.Intervals)) e._ = + (e.UsedVars) (e.Intervals) (e.L) (e.GenAssigns) > : (e.UsedVars^) (e.L^) (e.GenAssigns^) @@ -174,52 +174,6 @@ Solve-Spec-DoFindGeneralization { } } -/* - Объединяет два интервала, если они пересекаются. - В остальных случаях возвращает исходный список интервалов. - - == (e.Intervals^) - - e.Intervals ::= t.Interval+ - t.Interval ::= ('{' s.BeginCoord s.EndCoord '}') -*/ - -UnionIfIntersect { - (t.Interval-1 t.Interval-2) - , : True - = t.Interval-1 : ('{' s.A s.B '}') - = t.Interval-2 : ('{' s.C s.D '}') - = : s.Min - = : s.Max - = (('{' s.Min s.Max '}')); - - t.Intervals = t.Intervals; -} - -HasIntersection { - (('{' s.A s.B '}') ('{' s.C s.D '}')) - , : '+' - = False; - - (('{' s.A s.B '}') ('{' s.C s.D '}')) - , : '+' - = False; - - t.Intervals = True; -} - -GetExtremum { - s.Extremum s.Sign (s.CurrentCoord e.Rest) - , : s.Sign - = ; - - s.Extremum s.Sign (s.CurrentCoord e.Rest) - = ; - - s.Extremum s.Sign (/* пусто */) - = s.Extremum; -} - /* Преобразует решения в нужный формат для Solve-Spec @@ -273,8 +227,8 @@ DoGeneralize { DoGeneralize-Rec { (e.UsedVars) ('{' s.A s.B '}') (e.Begin) (e.E1 ('{'s.A'}') e.Inner ('{'s.B'}') e.E2) (e.Assigns) - = : s.VarType = : e.VarVal + = : s.VarType = : (e.UsedVars^) s.VarType^ e.New = (e.UsedVars) (e.Begin e.E1 ('{'s.A'}') (Var s.VarType e.New) ('{'s.B'}') e.E2) @@ -314,7 +268,14 @@ DoGeneralize-Rec { /* Определяет тип переменной, до которой выполнится динамическое обобщение */ GetVarType { - (ClosureBrackets e._) = 's'; + (Var s.Mode e.Index) = s.Mode; + (ScrVar s.Mode e.Index) = s.Mode; + (WhVar s.Mode e.Index) = s.Mode; + + t.SVarSubset, : True = 's'; + + (Brackets e._) = 't'; + (ADT-Brackets e._) = 't'; e.Other = 'e'; } @@ -1471,7 +1432,44 @@ MinMode { *$NOOPT Solve-SymmClashes-Aux +* TODO: оптимизировать порядок правил Solve-SymmClashes-Aux { +* {a} T1 E1 = {b} T2 E2 ↦ {c} T1 {d} = {e} T2 {f} && {g} E1′ = {h} E2′ +* где {c} T1 {d}, {g} E1′ := TERM_LEFT({a} T1 E1) +* {e} T2 {f}, {h} E2′ := TERM_LEFT({b} T2 E2) + (e.UsedVars) (e.Contrs) e.ClashesStart + (E ('{'s.A'}') t.T1 e.E1 '=' ('{'s.B'}') t.T2 e.E2) + e.ClashesEnd (e.Assigns) + , : True + , : True + , : True + , : True + = : (e.Left1) (e.Left2) + = : (e.Right1) (e.Right2) + = ; + +* E1 T1 {a} = E2 T2 {b} ↦ E1′ {c} = E2′ {d} && {e} T1 {f} = {g} T2 {h} +* где E1′ {c}, {e} T1 {f} := TERM_RIGHT(E1 T1 {a}) +* E2′ {d}, {g} T2 {h} := TERM_RIGHT(E2 T2 {b}) + (e.UsedVars) (e.Contrs) e.ClashesStart + (E e.E1 t.T1 ('{'s.A'}') '=' e.E2 t.T2 ('{'s.B'}')) + e.ClashesEnd (e.Assigns) + , : True + , : True + , : True + , : True + = : (e.Left1) (e.Left2) + = : (e.Right1) (e.Right2) + = ; + /* {a} u.X {b} = {c} v.Y {d} ↦ u.X → w.NEW, v.Y → w.NEW, w = min(u,v) */ (e.UsedVars) (e.Contrs) e.ClashesStart (s._ ('{'s.A'}') t.uX ('{'s.B'}') '=' ('{'s.C'}') t.vY ('{'s.D'}')) @@ -1886,42 +1884,6 @@ Solve-SymmClashes-Aux { , : True = /* решений нет */; -* {a} T1 E1 = {b} T2 E2 ↦ {c} T1 {d} = {e} T2 {f} && {g} E1′ = {h} E2′ -* где {c} T1 {d}, {g} E1′ := TERM_LEFT({a} T1 E1) -* {e} T2 {f}, {h} E2′ := TERM_LEFT({b} T2 E2) - (e.UsedVars) (e.Contrs) e.ClashesStart - (E ('{'s.A'}') t.T1 e.E1 '=' ('{'s.B'}') t.T2 e.E2) - e.ClashesEnd (e.Assigns) - , : True - , : True - , : True - , : True - = : (e.Left1) (e.Left2) - = : (e.Right1) (e.Right2) - = ; - -* E1 T1 {a} = E2 T2 {b} ↦ E1′ {c} = E2′ {d} && {e} T1 {f} = {g} T2 {h} -* где E1′ {c}, {e} T1 {f} := TERM_RIGHT(E1 T1 {a}) -* E2′ {d}, {g} T2 {h} := TERM_RIGHT(E2 T2 {b}) - (e.UsedVars) (e.Contrs) e.ClashesStart - (E e.E1 t.T1 ('{'s.A'}') '=' e.E2 t.T2 ('{'s.B'}')) - e.ClashesEnd (e.Assigns) - , : True - , : True - , : True - , : True - = : (e.Left1) (e.Left2) - = : (e.Right1) (e.Right2) - = ; - /* {a} T {b} E1 = {c} e.X E2 ↦ e.X → t.NEW1 e.NEW2 || e.X → ε */ (e.UsedVars) (e.Contrs) e.ClashesStart (E ('{'s.A'}') t.T ('{'s.B'}') e.E1 '=' ('{'s.C'}') t.eX e.E2) From 7d38256640221ddc97bcde24bc8c1071f9770109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 1 Dec 2025 09:30:10 +0300 Subject: [PATCH 205/208] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3:=20=D1=80=D0=B5=D0=B6=D0=B8?= =?UTF-8?q?=D0=BC=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20mode,=20=D1=83=D1=82=D0=BE=D1=87=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0?= =?UTF-8?q?=D1=80=D0=B8=D0=B5=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GenericMatch.ref | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/GenericMatch.ref b/src/compiler/GenericMatch.ref index ffa07f69..1a039bf6 100644 --- a/src/compiler/GenericMatch.ref +++ b/src/compiler/GenericMatch.ref @@ -228,11 +228,11 @@ DoGeneralize-Rec { (e.UsedVars) ('{' s.A s.B '}') (e.Begin) (e.E1 ('{'s.A'}') e.Inner ('{'s.B'}') e.E2) (e.Assigns) = : e.VarVal - = : s.VarType - = : (e.UsedVars^) s.VarType^ e.New + = : s.Mode + = : (e.UsedVars^) s.Mode^ e.New = (e.UsedVars) - (e.Begin e.E1 ('{'s.A'}') (Var s.VarType e.New) ('{'s.B'}') e.E2) - ((e.VarVal ':' (Var s.VarType e.New)) e.Assigns); + (e.Begin e.E1 ('{'s.A'}') (Var s.Mode e.New) ('{'s.B'}') e.E2) + ((e.VarVal ':' (Var s.Mode e.New)) e.Assigns); (e.UsedVars) t.Interval (e.Begin) ((Brackets e.Nested) e.Rest) (e.Assigns) @@ -267,7 +267,7 @@ DoGeneralize-Rec { /* Определяет тип переменной, до которой выполнится динамическое обобщение */ -GetVarType { +GetVarMode { (Var s.Mode e.Index) = s.Mode; (ScrVar s.Mode e.Index) = s.Mode; (WhVar s.Mode e.Index) = s.Mode; @@ -1802,7 +1802,7 @@ Solve-SymmClashes-Aux { , t.tX : (Var 't' e._) = (Generalize (('{' s.E s.F '}') ('{' s.A s.D '}'))); - /* {a} [X {b} E {c}] {d} = {e} t.X {f} ↦ t.X → [e.NEW] */ + /* {a} [X {b} E {c}] {d} = {e} t.X {f} ↦ t.X → [X e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart (('{'s.A'}') t.Br ('{'s.D'}') '=' ('{'s.E'}') t.tX ('{'s.F'}')) e.ClashesEnd (e.Assigns) @@ -1827,7 +1827,7 @@ Solve-SymmClashes-Aux { , t.tX : (Var 't' e._) = (Generalize (('{' s.A s.D '}') ('{' s.E s.F '}'))); - /* {e} t.X {f} = {a} [X {b} E {c}] {d} ↦ t.X → [e.NEW] */ + /* {e} t.X {f} = {a} [X {b} E {c}] {d} ↦ t.X → [X e.NEW] */ (e.UsedVars) (e.Contrs) e.ClashesStart (T ('{'s.E'}') t.tX ('{'s.F'}') '=' ('{'s.A'}') t.Br ('{'s.D'}')) e.ClashesEnd (e.Assigns) From 887c64f6124158364963a9ac770a534a0ea0f7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 1 Dec 2025 09:30:37 +0300 Subject: [PATCH 206/208] =?UTF-8?q?Log-InlineExpr=20=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BB=D0=B0=D0=B4=D0=BA=D0=B5=20GenericMatch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/Log-AST.ref | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/Log-AST.ref b/src/compiler/Log-AST.ref index c2dc2eef..ba70bc30 100644 --- a/src/compiler/Log-AST.ref +++ b/src/compiler/Log-AST.ref @@ -280,6 +280,7 @@ InlineTerm { (CallBrackets e.Value) = ; (ColdCallBrackets e.Value) = ; (ClosureBrackets e.Value) = ; + ('{' s.Coordinate '}') = '{' '}'; } MultilineTerm { From 5c231e70d43a23dca3fbf96cad93fa4891fe68af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=B7=D0=B4=D0=B0=D0=B9=D1=89=D0=B8=D0=BA?= Date: Mon, 1 Dec 2025 09:31:18 +0300 Subject: [PATCH 207/208] =?UTF-8?q?=D0=9E=D1=82=D0=BB=D0=B0=D0=B4=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D0=B0=D1=8F=20=D0=BF=D0=B5=D1=87=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=20=D1=81=D0=B8=D0=B3=D0=BD=D0=B0=D1=82=D1=83=D1=80=20=D1=81?= =?UTF-8?q?=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B8=D1=80?= =?UTF-8?q?=D1=83=D0=B5=D0=BC=D1=8B=D1=85=20=D1=84=D1=83=D0=BD=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/OptTree-Spec.ref | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/OptTree-Spec.ref b/src/compiler/OptTree-Spec.ref index b9ecbaf4..2cfe515d 100644 --- a/src/compiler/OptTree-Spec.ref +++ b/src/compiler/OptTree-Spec.ref @@ -782,6 +782,10 @@ SpecCall-BuildSignature { = : e.InstanceName = (e.Body) e.Signatures ((e.InstanceName) e.Signature) + > + > + > + : e.SpecInfo^ = Date: Mon, 1 Dec 2025 11:39:16 +0300 Subject: [PATCH 208/208] =?UTF-8?q?=D0=9F=D0=BE=D0=B2=D1=8B=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BB=D0=B8=D0=BC=D0=B8=D1=82=20=D1=88=D0=B0=D0=B3?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0=D1=81=D0=BA?= =?UTF-8?q?=D1=80=D1=83=D1=82=D0=BA=D0=B8=20=D0=B2=C2=A0=D1=80=D0=B5=D0=B6?= =?UTF-8?q?=D0=B8=D0=BC=D0=B5=20-OiADPRS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lexgen/@refal-5-lambda-diagnostics.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lexgen/@refal-5-lambda-diagnostics.ini b/src/lexgen/@refal-5-lambda-diagnostics.ini index 400dfce4..881922d2 100644 --- a/src/lexgen/@refal-5-lambda-diagnostics.ini +++ b/src/lexgen/@refal-5-lambda-diagnostics.ini @@ -1,4 +1,4 @@ memory-limit = 10000000 -step-limit = 100000000 +step-limit = 200000000 idents-limit = 5000 enable-debugger = false