Commit Graph

263 Commits

Author SHA1 Message Date
Fedor Isakov e8a19249e6 Migration to replace spliced LogicalItemExpression on a list node.
Usually one uses Splice with LogicalItemExpression wrapping a logical variable.
Using LogicalDataForm wrapping same variable makes Splice unnecessary.
In order to keep code readable these are wrapped again in a cons list.
In general, one should avoid using bare LogicalDataForm, as these are
indistiguishable from normal LogicalVariable.
2020-04-13 17:58:33 +02:00
Fedor Isakov 065aac819c Introduce construct to directly insert term constructor in data form.
Usually one uses Splice with LogicalItemExpression wrapping a constructor.
The new TermConstructorDataForm provides a shortcut.
2020-04-13 17:58:33 +02:00
Fedor Isakov 2af087428d Document j.m.logic language. Rearrange virtual packages. 2020-04-13 17:58:33 +02:00
Fedor Isakov 922fe7ef2e Prevent bad migrations from being re-applied.
Replacing of == with = is not always justified.
ListNodeCons is now deprecated and already replaced with
new concept.
2020-04-13 17:58:33 +02:00
Fedor Isakov 1109471f9a Replace usages of MultiMetaLogical with MetaLogicalArray.
The new class MetaLogicalArray does not inherit from MetaLogical,
which should help catch subtle bugs related to errors in
generator code.
2020-04-13 17:58:33 +02:00
Fedor Isakov 73beb56834 Introduce ConsListNode to replace a deprecated concept. Migration.
Prefer aggregation over inheritance: ListNodeCons extending ListNode
is not a good design.
Also drop LogicalUnrapContext, as it has no real use.
2020-04-13 17:58:33 +02:00
Fedor Isakov def1d9fbc6 Optimize generator, drop usages of ListRole. 2020-04-13 17:58:33 +02:00
Fedor Isakov b3d71ad13d Drop unused method from ListNode, simplify dataform-logical bridging. 2020-04-13 17:58:33 +02:00
Fedor Isakov 021853b996 Documenting LogicalUtil, minor refactorings.
MetaLogical are accessed through MetaLogicalFactory in generated code.
2020-04-13 17:58:33 +02:00
Fedor Isakov 749f60e665 Deprecate a bunch of obsolete concepts. 2020-04-13 17:58:33 +02:00
Fedor Isakov 4a60bc36f6 Migrate test lang to new macro system. 2020-04-13 17:58:33 +02:00
Fedor Isakov ace1303a96 Fix analysis to support new pseudo constraints. 2020-04-13 17:58:32 +02:00
Fedor Isakov 9a8b3585d7 Fix runtime and generator to support queries and call macros.
Expand macro supports dispatching by concept.
Logical variables declared on macro's body are init'ed in apply method.
Enable the hack to ensure dependencies on macro input are tracked.
2020-03-31 18:43:22 +02:00
Fedor Isakov f261002feb Introduce extends clause in macro table. Drop name from expand macro.
Macro table can extend another macro table. All prototype template
declarations are imported automatically.
The editor now substitutes default values when entering new
expand macro/constraint filling the slots provided by the prototype.
Expand macro does not require name.
Minor editor improvements.
2020-03-31 11:27:09 +02:00
Fedor Isakov a2b369b9c3 Specify logicals on every expand template. Minor editor improvements.
Expand macro template must have declaration of logicals matching
exactly the logical declarations in the prototype.
Can't refer to logicals declared directly in the prototype.
2020-03-31 11:27:09 +02:00
Fedor Isakov 28d21f5349 Cleanup in macro runtime, expand macro parameter access.
Parameters can be specified for call macro only.
Logicals can be specified for expand and call macro.
Expand macro params are treated exactly as "context"
parameters.
2020-03-31 11:27:09 +02:00
Fedor Isakov 4260346cb9 Introduce expand/call macro pseudo constraints.
The old expand/call constructs are to be replaced by these.
Expand macro constraint refers to a named prototype, which
is specified in a macro table for matching concept.
Call macro constraint refers directly to a macro template.
Contex parameters are to be retired and explicit
parameters to expand macro constraint are to be used instead.
2020-03-31 11:27:09 +02:00
Fedor Isakov 6672ab21e8 Runtime support for new expand and call macro constraints. 2020-03-31 11:27:09 +02:00
Fedor Isakov a72327630e Implement runtime support for call and expand macro templates. 2020-03-31 11:27:09 +02:00
Fedor Isakov ea670422f1 Introduce ExpandMacro template and prototype.
ExpandMacroTemplate to be used for dispatching macro invocations
based on the concept of the specified node.
Prototype is an abstraction to be implemented by
specific templates.
2020-03-31 11:27:09 +02:00
Fedor Isakov d5ea8e8006 Introduce CallMacroTemplate, necessary refactorings. MPSCR-25
Call macros are to be parameterized with logicals and other parameters.
To replace combined expand/call macros causing confusion.
Context parameters to be passed explicitly.
2020-03-31 11:27:09 +02:00
Grigorii Kirgizov b6aaec8870 Revert temporary workaround for MPSCR-51 from 16e39a93 2020-03-23 14:39:54 +03:00
Grigorii Kirgizov 91e4d2b582 Revive 'principal' rule feature for MPSCR-51. Mark those rules in BL typesystem.
Introduce 'auxiliary/essential' notions instead of 'principal/not principal'.
2020-03-23 14:28:14 +03:00
Grigorii Kirgizov 16e39a9345 Check applicable scope for certain checking rules in BL (workaround for BL for MPSCR-51). Fix SubclassingUtil.
Modified TYPECHECK query to include "checkingScope" query parameter:
it is a root node for which program is generated (for local typechecking it's local node).
Rules additionally match on a constraint `checkDecls(node<>)` bearing this node,
so while rules will be generated for all scopes, only those in applicable scopes will run.

Also split rule for EnumConstantDeclaration on declration checking and just typing rule.
2020-03-17 17:54:38 +03:00
Grigorii Kirgizov 831871a81b minor refactor: drop few usages of LogicalDataForm.logical() which were used for checking equality, use appropriate .symbol() instead 2020-03-06 14:04:18 +03:00
Grigorii Kirgizov 7f840e2899 Refactor: drop deprecated Path class and DataForm.attached() method operating on it 2020-03-06 14:04:18 +03:00
Grigorii Kirgizov 92f95674b3 Refactor: drop meaningless DataForm.asRoot (used symbolPath which is deprecated) 2020-03-06 14:04:18 +03:00
Fedor Isakov fec446f006 Drop wrapping substitutions in favour of regular actions.
The editor for evaluating late expression inserts $() construct
first, then allows to enter the expression.
A couple of minor fixes and a workaround.
2020-02-27 14:48:37 +01:00
Grigorii Kirgizov a619b017ec Fix NPE in UpdatesRecorder on roots move/remove
In such cases typechecking was failing on the point of computing changeSetClosure,
because changeSet got null nodes from SNodeChangeEvents
2020-02-26 18:58:05 +03:00
Grigorii Kirgizov 707982fbe9 Include changed nodes from different roots in invalidated set for incremental program update. (MPSCR-46)
The core chang in is InvalidateAndApplyTemplatesStep.
Also rename SNodeEventsFilter to RelevantNodesTracker.
2020-02-26 18:58:05 +03:00
Grigorii Kirgizov 025232969d Track change events from all referred models (MPSCR-46)
UnitTypecheckingCacheHolder now holds the data needed for ChangesTrackers.
This data is updated by UpdatesRecorder: different models and nodes from different roots are tracked.
2020-02-26 18:58:05 +03:00
Fedor Isakov 2e9a1e8dbf Support deleting pattern from logical variable in head. 2020-02-26 16:08:50 +01:00
Fedor Isakov f2bb87e1b0 Apply migration to replace deprecated concept. 2020-02-26 15:03:31 +01:00
Fedor Isakov c064972266 Deprecate obsolete concept, provide migration. Minor editor fixes.
ExpressionLogicalVariable is replaced with ExpressionItem wrapping
the same expression.
Fixes ensure correct application of transformations.
Late expression can't be used as "placeholder" logical item.
2020-02-26 15:01:29 +01:00
Fedor Isakov 2a5b3661b8 Use EvaluationSetting tag for constraint context.
Concepts supposed to contain constraints are
effectively implementing evaluation setting.
2020-02-24 22:57:05 +01:00
Fedor Isakov 7ba7c983cb Apply migration to use logical variable ref expression. 2020-02-24 22:57:05 +01:00
Fedor Isakov 630fd33629 Introduce logical var reference expression.
This expression is to be used in those rare cases
when a logical var is to be passed to an external method.
Not available within EvaluationSetting (new marker interface).
Normally logical variable (as an instance of LogicalItem)
is only to be used within a logical context.
Logical item value expr only to contain a logical variable.
2020-02-24 22:56:54 +01:00
Fedor Isakov 2c43762f93 Replace all instances of .pointer in constraints to node reference.
SNode is supported now directly as an argument to constraint/predicate.
Pointer operation is no longer necessary, as is node-ptr<> type for logical vars.
2020-02-20 11:59:28 +01:00
Fedor Isakov 8ec26b4e94 Support node<> argument in constraints. Prepare to get rid of node-ptr<>. Minor refactoring. 2020-02-20 11:59:28 +01:00
Fedor Isakov ee36d879b3 Make better editor for provide feedback and fail constraints. 2020-02-20 11:59:28 +01:00
Grigorii Kirgizov 6a67865554 Fix NPE in new ChangesTracker in UpdatesRecorder on broken references (relates to MPSCR-44) 2020-02-19 01:04:55 +03:00
Grigorii Kirgizov 725a438bca Use same information for incremental program update and types cache invalidation (fixes MPSCR-44)
Previously there were two independent ChangeTracker-s in UpdatesRecorder and UnitTypecheckingCacheHolder.
Now, given more elaborate logic for tracking changes to types (which includes changes in different roots)
this information must be propagated from UpdatesRecorder to cache holder,
so that if there're changes relevant for recomputing types then types cache is also invalidated.
2020-02-18 23:39:26 +03:00
Grigorii Kirgizov 5abbccf511 Collect changes in UpdatesRecorder in referred-to roots (MPSCR-44) 2020-02-18 23:35:23 +03:00
Fedor Isakov 417fc45933 Restore origin ref in RuleEx interface, fix terminology in templates API.
To avoid confusion, a rule defines "target ref", which is supposed
to indicate the source code location for possible errors.
The origin node is to be referred as "origin" as before.
Temporarily rename OriginSpec's alias to "target" to reflect change
in semantics.
2020-02-17 11:57:14 +01:00
Grigorii Kirgizov a8f3ed8d9a Store reversedRequirements in UpdateRecorder by SNodeId, not by SNodes themselves (fixes MPSCR-42)
Sometimes UpdatesRecorder can log changes of SNodes which have same SNodeId, but different identity.
Thus reversedRequirements map returned nothing on such nodes and these require-dependencies were not handled.
Such case is described in MPSCR-42 ticket.
2020-02-13 17:12:33 +03:00
Fedor Isakov 796ad9ad2c Apply migration to drop ValueOfExpression. 2020-02-12 12:26:09 +01:00
Fedor Isakov 0d7316adf4 Introduce LogicalItemValueExpr, deprecate ValueOfExpr, migration.
LogicalItemValueExpression is to play the same role as valueOf(logical)
within an instance of EvaluationSubject.
LogicalItemExpression is to represent the logical variable itself.
2020-02-12 12:18:30 +01:00
Fedor Isakov 25585f9166 Deprecate assert constraint: a simple $() should serve. 2020-02-12 10:53:40 +01:00
Fedor Isakov 115c368a2f Reconcile different syntaxes for ExpressionConstraint and LateExpression. Use $() for both.
This is an important change in coderules syntax: all expressions to be evaluated from
constraints/predicates are to be wrapped in parentheses and preceded by dollar sign.
So, instead of eval/backticks the new syntax is to be used: $(<expression>).
Also the expressions to be passed to "feedback reporting" predicates are to be wrapped similarly.
2020-02-12 10:53:40 +01:00
Grigorii Kirgizov 820edb8e5a Distinguish between origin and reportOrigin in generator to track changes for regenerating rules (fixes MPSCR-36) 2020-02-11 15:52:30 +03:00