Commit Graph

172 Commits

Author SHA1 Message Date
Fedor Isakov c7eaa1dbf3 Clean up ProgramEvaluator API. Straighten up passing of session token. Drop RulesDiff usages. 2020-12-08 22:57:36 +01:00
Fedor Isakov 8918b0afd8 Refactor RulesPlanHandler, introduce RulesPlan. Drop unused class.
Refactor the rules producing line to run via newly introduced RulesPlan.

Correctly process new and dropped rules.
2020-12-08 12:52:13 +01:00
Fedor Isakov 59db13bf41 Simplify UpdatesRecorder implementation. Fix input processing by ProgramFactory.
Move invalidation logic inside UpdatesRecorder from elsewhere.
Drop type parameters.
Avoid recording dependencies for null input.

ProgramFactory: always process input, not only the first time
2020-12-08 12:50:36 +01:00
Fedor Isakov b31b5be38f Refactor ProgramBuilder to a helper inner class. 2020-12-04 12:13:30 +01:00
Grigorii Kirgizov 9d3b7e1fba Add program Preamble as SessionToken, use it in Queries strategy
Program Preamble consists of 2 parts: rules & Journal.
Preamble rules are no-input rules with rules for their required nodes.
Preamble journal is journal part with results of executing these rules.
Preamble is defined per-Query, because Journal differs for Queries.

Repository CacheHolder is used for storing them b/w sessions.
Rules are stored and  retrievied with Memoizer.
Journal is stored as SessionToken in PreambleSet (map Query->SessionToken).

Add option to IncrementalSpec -- incrementality level (Preamble or Full).
2020-11-10 10:40:06 +03:00
Fedor Isakov 930100a47b Several fixes that guarantee stable order of rules in the program.
Ensure the order of rules in the resulting plan follows the priorities
set forward by extends relationship b/w languages. So that even if
rule template tables are unrelated, they are still ordered according to
language extension graph.
Ensure the order of rule lists in the resulting plan is stable b/w invocations of
RulesPlanHandler.allPlans().
Ensure the order of aspects in AspectClique is stable b/w invocations
of buildClique().

Associate RuleTemplatesTable with Manifest, and Manifest with CoderulesAspect.
Tentatively rename RulesList (the runtime object) to RulesPlan,
RulesListTable to RulesPlanHandler.
2020-10-23 12:26:30 +02:00
Grigorii Kirgizov 1de365de9c Introduce trace tool for rule template application 2020-10-08 17:34:42 +03:00
Fedor Isakov 4cf9821bc2 Optimize RuleTemplateIndex: cache matching rules per concept. 2020-08-20 14:20:52 +02:00
Grigorii Kirgizov 3eebe8cd03 Refactor creation of IncrProgramSpec: allow later spec config (for MPSCR-66)
IncrProgramSpec influencing program eval is built from two sources:
internal analysis results & typechecking options.
Providing spec builder instead of spec allows to combine these
sources later at program pipeline creation in TypecheckingService.

Commit accomodates to addition of IncrementalSpec.Enabled.Unsafe
Commit also simplifies ProgramAnalysis -related classes.
Renames BasicProgramAnalysis to PrincipalsAnalysis.
2020-07-28 18:53:41 +03:00
Grigorii Kirgizov f6d7f5c4bd Refactor the way IncrPogramSpec is provided: explicitly pass as Step input 2020-07-28 18:53:41 +03:00
Grigorii Kirgizov c6a4e9ede3 Use opaque feedback keys (rule match ids) instead of rule unique tag
According to changes in prev commin in reactor
2020-07-22 15:27:46 +03:00
Fedor Isakov 96918d0e1d Support for processing input nodes recursively or not. Optimizing local typechecking.
The flag "recursive" is passed down to ProgramFactory to control whether
the input nodes are to be walked recursively.
This flag is set to false when calculating a node's type in isolation.
2020-07-21 17:02:17 +02:00
Fedor Isakov 29ffc46fa4 Introduce ProvideFeedbackOperation: enable providing feedback from templates.
Operations such as 'error' and 'warning' are available on input
node in templates and serve to report issues found during
template application, in contrast with those found during evaluation.
2020-07-13 18:14:12 +02:00
Fedor Isakov 936190bca9 Apply migrations. 2020-07-11 15:13:08 +02:00
Fedor Isakov 9c9acceb96 Refactor effects composition for better readability. A couple of minor fixes.
Drop recording of "suppressed exception" by CoderulesHelper.
Report failed program evaluation as info message.
Ensure traces are available for failed evaluations.
2020-07-07 18:42:16 +02:00
Fedor Isakov 598b7e596b Refactor TypecheckingService to do all error reporting. Fix isRelevant logic.
Use the same logic for TypecheckingProvider.isRelevant() as in AspectLookup
with additional test for directly imported languages.
2020-07-07 13:12:14 +02:00
Fedor Isakov 9c1d3aad92 Move Result class to commonly-used runtime solution. 2020-06-25 14:30:30 +02:00
Fedor Isakov 4350d43ddb Simplify Result class design, drop unnecessary MITM class. 2020-06-25 11:40:16 +02:00
Fedor Isakov 735a97a0e7 Drop obsolete feature "checkGarbage" 2020-06-25 11:40:16 +02:00
Fedor Isakov b6fd3ea464 Minor refactoring: remove message handler from MacroTemplateIndex. 2020-06-25 11:40:16 +02:00
Fedor Isakov 44a25ada3a Enable extracting term presentation via delegate.
Provide an instance of NodePresentable that ought
to serve as the delegate proxy for extracting node
presentation.
2020-06-21 23:17:33 +02:00
Fedor Isakov ab99a0245c Introduce runtime support module j.m.coderules.runtime. 2020-06-21 23:17:33 +02:00
Fedor Isakov 04c2dfb385 Implement DataProvider interface in DefaultSupervisor. 2020-06-04 11:44:07 +02:00
Fedor Isakov 14780b5561 Apply automatic migrations. 2020-05-09 15:04:25 +02:00
Fedor Isakov d1163fc883 Open and rebuild the project with MPS 2020.1. 2020-05-09 15:02:20 +02:00
Fedor Isakov 587711a3e8 Drop deprecated class and its usages. 2020-05-05 15:58:48 +02:00
Grigorii Kirgizov f3ed39c8a6 Refactor a bit program analyses merge code in RuleProcessingSession 2020-05-01 13:38:12 +03:00
Grigorii Kirgizov 0569a96b6a Fix ExpressionStatement causing testa failure 2020-04-30 18:59:42 +03:00
Grigorii Kirgizov 5894510797 Fix infinite loop on error of extended macro table not found 2020-04-30 15:38:33 +03:00
Fedor Isakov 33739d7303 Support query table in generator templates.
Runtime switched to use newly generated query table definitions.
2020-04-23 10:15:39 +02:00
Fedor Isakov 6e7d4c3ae0 Minor refactoring: prefer interfaces over abstract classes. 2020-04-23 10:15:39 +02:00
Fedor Isakov a36369f002 Consistently use unified name RuleTable across all runtime. 2020-04-22 16:00:41 +02:00
Fedor Isakov 78a753a872 Refactor coderules aspect runtime: consolidate manifests.
Have single manifest for all assets instead of separate ones.
QueryTable is declared but not implemented yet.
2020-04-22 16:00:41 +02:00
Fedor Isakov 3e65376561 Drop deprecated stuff from coderules lang and runtime. 2020-04-22 12:07:50 +02:00
Fedor Isakov 767a41ad24 Switch runtime and generator templates to use Query interface.
Previously used contract with QueryKind/Object[] parameters is
replaced with Query object.
2020-04-22 11:43:37 +02:00
Fedor Isakov 9037b17516 Fix FeedbackConsumer's only method definition.
The method would generate to 'protected void...' with MPS 2020.1.
No idea why.
2020-04-19 17:32:29 +02:00
Fedor Isakov 91dda1d85f Move ProgramAnalysis to template model, avoid creating dependency cycle. 2020-04-19 16:30:11 +02:00
Fedor Isakov 1bb158d50b Consolidate models in template runtime solution. 2020-04-19 16:30:11 +02:00
Fedor Isakov 9bbf86cb8d Optimize coderules templates runtime and generator.
Drop obsolete code from runtime.
Consolidate and reconcile different templates for consistency.
Simplify generated code.
2020-04-19 16:30:11 +02:00
Grigorii Kirgizov 152e6fcfa3 refactor: move another version of ReportingSupervisor from test model to the model it belongs 2020-04-19 13:43:01 +03:00
Grigorii Kirgizov 43297ce5c6 Separate logic of being able to report feedback from handling it (i.e. recovering from failure), fixes MPSCR-57
Also rename ruleTag param in feedback methods to 'feedbackKey', what it really is.
feedbackKey is used in TypesCache internal ReportItem map as a key.
2020-04-19 13:42:58 +03:00
Fedor Isakov 7b1764548c Fix runtime and generator for macro templates processing. MPSCR-53
Support matching expand macro template on subconcepts.
Respect topological order of macro tables.
Respect the order of macro templates in macro table.
2020-04-16 12:24:46 +02:00
Fedor Isakov a1c98b5bf0 Apply all outstanding migrations. 2020-04-13 17:58:33 +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 6672ab21e8 Runtime support for new expand and call macro constraints. 2020-03-31 11:27:09 +02:00
Fedor Isakov f2bb87e1b0 Apply migration to replace deprecated concept. 2020-02-26 15:03:31 +01:00
Fedor Isakov 7ba7c983cb Apply migration to use logical variable ref expression. 2020-02-24 22:57:05 +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 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
Fedor Isakov 796ad9ad2c Apply migration to drop ValueOfExpression. 2020-02-12 12:26:09 +01:00
Grigorii Kirgizov c6889be4e7 Consider possible errors at rule generation stage as non fatal and produce Program with some rules dropped (fixes MPSCR-38)
New Result.RECOVERED case-class is added which collects errors but doesn't fail.
Currently errors are collected but not reported.
2020-02-06 01:02:50 +03:00
Fedor Isakov 3f51c1e5c1 Apply migration that replaces empty logical type with term type. 2020-02-05 12:34:20 +01:00
Grigorii Kirgizov 3a15d40625 Update Supervisor and TypesIndex to incorporate changes in feedback reporting (MPSCR-32)
TypesIndex now invalidates report items from previous sessions not by node refs,
but by tags of rules which produced them. Set of invalidated tags is an addiitonal
output from incremental engine.
2020-02-05 12:29:33 +03:00
Grigorii Kirgizov 046f4969e1 Remove unnecessary calls to EvaluationResult.storeView() to save some time 2020-02-05 12:29:33 +03:00
Fedor Isakov 9403087c11 Drop RepositoryProvider interface (unused). 2020-02-04 11:43:20 +01:00
Fedor Isakov efd19aa45b Implement incremental generation of coderules program.
Introduce SessionData, allow to keep arbitrary data with the session.
Extend RulesListTable with support for invalidation based on rule unique tags.
Introduce UpdatesRecorder to keep track of invalidated nodes.
Extend ApplyTemplatesStep with invalidate logic for typechecking.
Simplify design, drop unnecessary fields, minor refactorings.
2020-01-02 17:20:13 +01:00
Fedor Isakov e926b86bcd Minor refactoring in program producing code.
Reorganize and cleanup code.
2019-12-10 11:58:26 +01:00
Fedor Isakov ecd2594fed Drop deprecated Reporting interface and all its usages.
Remove runtime solution that contained only Reporting.
2019-11-11 13:53:41 +01:00
Grigorii Kirgizov 53ddcb8492 Small cleanup of TraceTool for incremental processing 2019-11-07 17:15:56 +03:00
Grigorii Kirgizov ea309d05e7 MPSCR-14: Remove unnecessary & failing call to tracer.restored() for incrementally preserved occurrences 2019-11-07 15:43:02 +03:00
Grigorii Kirgizov f343ba0d3b Adjust to changes in SessionToken & RulesDiff interfaces 2019-11-06 19:10:29 +03:00
Fedor Isakov 76739d20d9 Minor refactoring and renaming in coderules runtime. Documentation.
Rename classes and methods to better reflect the intent.
Move test-related stuff to test util model.
2019-11-05 18:46:02 +01:00
Fedor Isakov 48375c4d14 Extend RuleBuilder with template app session: automatically require node ponters passed as args to constraints.
Every node pointer (SNodeReference) specified as an arg to a constraint causes the (resolved) target to be included
into template application session (required).
Reduce NodeAnchor to .pointer call.
Deprecate Reporting interface and context repository in rule definitions.
2019-11-04 16:20:57 +01:00
Fedor Isakov cc8cf72819 Minor code cleanup: get rid of MacroTemplate.ID, simplify templates. Systemize RuleBuilder usages. 2019-11-04 16:20:57 +01:00
Fedor Isakov 068ce227c3 Avoid propagating runtime exception from program evaluation. 2019-09-12 17:08:02 +02:00
Fedor Isakov 8b73b66e34 Introduce RepositoryProvider interface to provide access to context repository.
TemplateApplicationSession to provide repository to templates.
Supervisor subclasses to provide repository to predicates.
2019-09-12 17:08:02 +02:00
Grigorii Kirgizov cdfe1f2c0c Update language version after migrations from mps.logic lang 2019-09-11 13:24:02 +03:00
Grigorii Kirgizov e2e531f13c Add few utilities and extend logic of subtypePaths for LUB impl
subtypePaths constraint now has an extended version subtypePathsRaw that returns
extended 'classifierType' dataforms with type parameters (no only classifiers).
2019-09-11 13:24:01 +03:00
Fedor Isakov adc115b164 Avoid failure on exception thrown from a template.
Produce a program even in case some of applied rules failed.
Allow to recover from failure in apply templates.
2019-09-10 18:37:12 +02:00
Fedor Isakov b842fb6b9d Avoid unnecessarily throwing exception on failure.
EvaluationFailureException is meant to be only thrown from predicate solvers.
It is specially processed in the reactor engine.
2019-09-10 18:37:12 +02:00
Fedor Isakov 1636f18f73 Support navigating to rule from editor. Drop implementations of Reporting.report. 2019-09-04 16:53:03 +02:00
Fedor Isakov ab8ec75878 Rewrite feedback handling without Reporting interface.
Instead of using the (deprecated) Reporting interface when handling
feedback, use the more straightforward abstract method.
2019-09-02 17:55:46 +02:00
Fedor Isakov 41c4c7e0a3 Fix provide feedback predicate to use the updated API. 2019-09-02 17:55:46 +02:00
Fedor Isakov 5c239fb4b9 Fix Memoizer race condition. 2019-08-27 11:22:39 +02:00
Fedor Isakov 899d6b5208 Avoid producing NPE on missing template. 2019-08-26 17:14:39 +02:00
Fedor Isakov 17cb4654cf Introduce message handler parameter to rule application session.
In some situations it is unreasonable to fail on missing templates,
it's better to produce a working but perhaps incomplete program
than not to produce anything.
2019-08-26 16:53:04 +02:00
Grigorii Kirgizov cc20e9735b Extend TypesIndexCache & EvaluateRulesStep with storing and retrieving SessionToken 2019-08-22 15:19:58 +02:00
Grigorii Kirgizov 9843669f79 Remove old runtime coderules analyses 2019-08-22 15:16:18 +02:00
Grigorii Kirgizov 906f919e16 Run coderules program analyses at generation stage. Extend Rule with basetag(). Adjust how rule_tag is generated for reuse in generator.
basetag() returns name of ConstraintRule without node id.
Check on whether Rule is principal are now done through basetag(), it's sufficient.
Add part of future analysis: CallerTableBuilder.
2019-08-22 15:16:17 +02:00
Fedor Isakov 4c4c610531 Enable macro expansion on concept; null input produces empty builder. 2019-08-10 16:25:36 +02:00
Fedor Isakov 66c9222a95 Run migrations with MPS 2019.2 EAP3. 2019-07-26 17:27:18 +02:00
Grigorii Kirgizov 11712c7069 Restrict the notion of principal rule (as effect, match journal is shorter now). It also positively affected reporting, so switch reporting to the new way. 2019-07-26 17:00:31 +02:00
Grigorii Kirgizov 3d80841639 Switch ReportingSupervisor to handle RuleMatch. Add Supervisor using ProgramSpec instead of PrincipalOriginIndex. 2019-07-26 17:00:31 +02:00
Grigorii Kirgizov 78c0cc1559 Setup code for failing typechecking tests, add one. Extract Supervisor impl from ProgramEvaluator. 2019-07-26 17:00:31 +02:00
Grigorii Kirgizov b9309e6369 Add several tests of incr typecheck on BL. ProgramEvaluator now depends on ProgramProducer. 2019-07-26 17:00:31 +02:00
Grigorii Kirgizov 9a22149a5c Add some debugging info for incremental lang typecheck tests 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov ce9b91c4a5 Add basic tests for simple program analysis, add test helpers. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 6c4667e066 Add basic coderules program analysis for determining principal constraints 2019-07-26 17:00:30 +02:00
Fedor Isakov 79b08c6f83 Revert "Apply migrations from EAP3 and rebuild project."
This reverts commit 9c5bf858c3.
2019-07-26 15:30:30 +02:00
Fedor Isakov 9c5bf858c3 Apply migrations from EAP3 and rebuild project. 2019-07-19 12:28:27 +02:00
Fedor Isakov cd37daaa07 Apply migrations after switching to the latest EAP build of MPS. 2019-06-07 09:16:21 +02:00
Fedor Isakov 17ed4642ae Apply all available automatic migrations. 2019-06-05 16:16:00 +02:00
Fedor Isakov 3b638b2d08 Drop usages of Rule.tag(), replace with Rule.uniqueTag().
Switch to using long as a rule's unique tag.
Rename all entities using "handler" to "rulesList".
2019-05-17 18:01:34 +02:00
Fedor Isakov aaec11de9b Adapt to the changes in reactor API. 2019-05-05 14:29:08 +02:00
Fedor Isakov 4389b349d7 Adapt to the changes in reactor API. 2019-05-02 14:59:57 +02:00
Fedor Isakov b1f7ba4ecf Drop usages of deprecated symbols in reactor API. 2019-05-02 14:46:57 +02:00
Fedor Isakov 478b43ce16 Drop usages of deprecated interfaces. 2019-04-26 00:22:02 +02:00
Fedor Isakov adcfba5e9a Introduce two built-in predicates to be used instead of eval(false) etc.: fail and report message (debug/info/warning/error/fatal). 2019-02-18 11:49:11 +01:00
Fedor Isakov b102237bb8 Drop static collection of predicate symbols. Adapt to the latest reactor API. Drop DefaultSessionSolver 2019-02-17 11:39:56 +01:00
Fedor Isakov 5f068c1ac0 Extract stuff related to program producing to separate model. 2019-02-15 17:15:17 +01:00