Commit Graph

58 Commits

Author SHA1 Message Date
InversionSpaces
5c7f6a89c6
feat(compiler): Reimplement noXor compiler flag [LNG-347] (#1096)
* Fix imports

* Remove constants

* Return constants

* Refactor

* Add config

* Do not propagate errors

* Do not propagate errors through on

* Rename hop ephemeral streams

* Add comments

* Add tests
2024-03-05 10:45:21 +07:00
InversionSpaces
a6c8e75c27
fix(compiler): Import abilities with use [LNG-324] (#1077)
* Add IntoApply

* Savepoint

* Add backtrack

* Return ability name

* Add service resolution

* Return import ability

* Add test

* Rewrite toDottedName

* Rewrite ability resolution

* Fix offset

* Add tests

* Add test

* Add comments

* Add test

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2024-02-29 14:56:05 +01:00
Dima
245f6640f8
feat(language-server): Resolve paths for imports (#1079) 2024-02-20 12:52:54 +00:00
Dima
f7194f0a54
feat(language-server): Support declares and exports in LSP [LNG-304, LNG-319] (#1070)
Co-authored-by: InversionSpaces <inversionspaces@vivaldi.net>
2024-02-07 09:21:42 +00:00
InversionSpaces
7b6c7245ec
perf(compiler): Optimize Linker [LNG-321] (#1049)
* Refactor parser

* Refactor parser

* Refactor parser

* Refactor parser

* Savepoint

* Savepoint

* Refactor

* Fix unit test

* Remove file

* Filter exported modules

* Fix test

* Restore Test.scala

* Add comments
2024-01-22 16:01:54 +01:00
Dima
abcb63db3b
perf(compiler): Inliner optimization [LNG-322] (#1047) 2024-01-22 10:08:06 +00:00
InversionSpaces
d057a5e695
feat(compiler)!: Force aqua header [LNG-308] (#1028)
* Refactor

* deprecate `module`, force `aqua`, fix integration and unit tests

* fix ImportFromSpec

* Savepoint

* Fix

* Semantic error on module header

* Refactor

* Add begin token

* Fix tests

* Remove DHT examples

* Use git aqua-lib

* Fix headers

* Fix headers

* Fix headers

* Fix headers

* Fix headers

* Fix headers

* Fix headers

* Fix test

* Unignore tests

* Update aqua-lib

---------

Co-authored-by: DieMyst <dmitry.shakhtarin@fluence.ai>
2024-01-18 10:43:23 +01:00
InversionSpaces
a4d8ee7083
fix(compiler): Do not generate hop back with empty response by default [LNG-305] (#1019)
Change default flag, add test
2023-12-21 11:17:50 +00:00
InversionSpaces
2d4b2aece4
fix(compiler): Allow returning resolved service as ability [LNG-266] (#977)
* Refactor

* Refactor type system

* Remove println

* Fix renaming

* Add unit tests

* Do not convert to call arrow

* Check ability

* Refactor captured values resolution

* Remove println

* Fix fields gathering

* Remove println

* Remove println

* Fix renaming, export ability

* Rename only abilities

* Fix unit tests

* Fix captured arrows renaming

* Add comments

* Refactor

* Rename only arrows

* Add comments, refactor

* Add comments

* Rename method

* Add integration test

---------

Co-authored-by: Anatolios Laskaris <github_me@nahsi.dev>
Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-11-23 10:12:44 +00:00
InversionSpaces
cee444862a
feat(compiler): Generate empty calls to responseHandlerSrv [LNG-286] (#979)
* Add noEmptyResponse

* Fix tests
2023-11-17 10:43:13 +00:00
InversionSpaces
68425ed42a
feat(compiler)!: Prohibit mutating options [LNG-277] (#960)
* Parse any nested type

* Refactor type system

* Fix restriction

* Refactor type resolution

* Return stream definition

* Update examples

* Refactor

* Refactor

* Refactor integration tests

* Export service

* Add integration test

* Fix args provider

* Add parser unit tests

* Add type resolution unit tests

* Add more unit tests

* DataTypeToken -> CompositeTypeToken

* GeneralStreamType -> MutableStreamType

* Refactor

* Refactor TypeResolution

* colType -> collectionType

* Refactor

* Fix PushToStreamSem

* BasicTypeToken -> ScalarTypeToken

* CompositeTypeToken -> BasicTypeToken

* Fix for nil

* Make stream collectible

* Refactor collectible type

* Use internalError

* Add unit tests
2023-11-13 11:58:36 +03:00
InversionSpaces
78ee753c7b
feat(compiler): Always generate last argument of fold [LNG-265] (#947)
* Always generate last in fold

* Fix unit tests

* Add methods
2023-10-30 12:58:51 +03:00
InversionSpaces
5f6c47ffea
feat(compiler): Optimize math in compile time [LNG-245] (#922)
* Move service calls for math to inlining

* Fix: add predo

* Introduce CallServiceRaw

* Add comment

* Add optimization to inlining

* Add tests

* map -> mapValues

* Refactor type

* Add optimization

* Add optimization test

* Fix unit tests

* Fix PR comments

* Restrict optimization

* Add substraction to optimization

* Apply optimizations in gate

* Fix sign, move optimization to unfold

* Fix type and tests

* Fix unit tests

* Add unit test

* Fix after merge

* Add optimization, fix unit tests

* Fix comment
2023-10-09 13:02:26 +03:00
InversionSpaces
b298eebf5e
fix(compiler): Fix gate inlining [LNG-253] (#924)
* Fix gate inlining

* Remake stream gate inlining, fix unit tests

* Fix: add flat inline

* Refactor, add comments
2023-10-08 12:52:54 +02:00
InversionSpaces
f158074c4e
fix(compiler): Handle errors from result handling [fixes LNG-247] (#913)
Move args and return under try
2023-09-27 12:29:06 +03:00
InversionSpaces
a80033b81c
feat(compiler): Replace %last_error% with :error: [fixes LNG-239] (#883)
* %last_error% -> :error:

* Add integration test

* Fix integration tests

* Update integration test
2023-09-26 13:28:13 +03:00
InversionSpaces
27a781dd3f
feat(compiler): Add warnings subsystem [fixes LNG117] (#906)
* ErrorsAlgebra -> ReportAlgebra

* Refactor ReportAlgebra

* Refactor

* Refactor AquaError

* Fixes

* Add warnings, refactor

* Refactor parser

* Move semantics

* Savepoint

* Refactor semantics and compiler

* Refactor types

* Refactor compiler

* Refactor compiler

* Refactor types

* Refactor retunr types

* Return warnings

* Add simple warning

* Refactor to ValidatedNec

* Refactor

* Add comment

* Propagate warnings to LspContext

* Propagate warnings to LSP

* Add warnings to js api

* Update LSP js api

* Use export declare

* Add comment

* Refactor span rendering

* Remove variable name warning

* Add warning on unused call results

* Add unit tests

* Remove println
2023-09-25 13:00:43 +00:00
InversionSpaces
6be2a3d5da
feat(compiler): Services as abilities [fixes LNG-206] (#873)
* Refactor ServiceSem

* Refactor AbilityIdSem

* Remove tokens from state

* Refactor

* Add mangler

* Fix tests

* Refactor valueToRaw

* ServiceIdTag

* AbilityId -> ServiceId

* Add ServiceType

* Fix defineServiceType

* Refactor resolveArrowDef

* Refactor TypesHelper

* Add ServiceIdTag inlining

* Implement resolution

* Add service as ability passing

* Fix importing services

* Fix cli

* Implement default service

* Remove println

* Fix capture

* Add integration test

* Fix id

* Fix test

* Fix test

* Refactor test

* Do not resolve id

* Refactor FuncArrow creation

* Refactor FuncArrow wrapper creation

* Add named arguments

* Add comment

* ensureIsString -> valueToStringRaw, refactor OnSem

* Resolve services as abilities

* Add name to varNames

* Remove service hack

* Capture services, do not rename captured

* Rename arrows along with values

* Fix CallArrowRaw.map

* Fix unit tests

* Remove service case

* Refactor abilities state

* Propagate rootServiceIds

* Remove unused

* Add comments

* Refactor

* Refactor

* Add test

---------

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
2023-09-15 10:34:21 +02:00
InversionSpaces
443e65e3d8
fix(compiler): Fix closure stream capture [fixes LNG-58] (#857) 2023-09-01 16:05:32 +03:00
Dima
8060695dbb
feat: parseq implementation (fixes LNG-223) (#840)
* parsec implementation

* add test code

* parsec expression

* Refactor

* Refactor

* Add return strategy to on

* Add ExitStrategy

* Add TopologyPath

* Add ExitStrategy.ToRelay

* Handle ToRelay

* Refactor

* Refactor

* Refactor

* Handle OnModel with Relay strategy

* parsec -> parseq

* parsec -> parseq

* Add semantics test

* Add topology tests

* Add comments

---------

Co-authored-by: InversionSpaces <InversionSpaces@vivaldi.net>
2023-08-21 14:26:30 +04:00
InversionSpaces
a5e9354aeb
feat(compiler): Add equality ops [fixes LNG-217] (#820)
* Add eq ops

* Fixed if

* Fix return

* Fix tests

* Add parser tests

* Fix types, add semantics tests

* Add integration tests

* Add integration test

* Remove comment
2023-08-09 13:38:24 +00:00
Dima
fabf8d7d61
feat(compiler): Restrict exporting functions that return arrow types or ability types [fixes LNG-209] (#815) 2023-07-26 12:55:16 +03:00
InversionSpaces
50ba194b86
fix(compiler): Fix math ops for u64 [fixes LNG-204] (#811) 2023-07-25 12:53:50 +03:00
InversionSpaces
b8b0fafda0
feat(compiler): Make on propagate errors [fixes LNG-203] (#788)
* Add fail model

* Make `on` propagate error

* Fix unit tests

* Fix TryTag inlining

* Update XorModel.wrap

* Add comments

* Remove wrapWithXor parameter

* Add unit tests

* Add integration tests

* Add comments

* Fix XorBranch topology
2023-07-12 16:18:47 +03:00
InversionSpaces
c1fe24b04d
feat(compiler): Make topology hop with non-FFI snippet [fixes LNG-125] (#764)
* Remove MakeRes.canon

* Replace noop with hop

* Rewrite join

* Remove JoinModel, fix tests

* Share code between tests

* Pass type in RestrictionTag(Model)

* Fix MakeRes.hop

* Fix wrapping

* Rename vars, add comments

* Fix XorBranch topology

* Fix tests
2023-07-06 12:44:37 +03:00
InversionSpaces
667a8255d9
feat(compiler): Find and display link cycles (#787)
Find and display dependency cycles
2023-07-04 10:07:22 +00:00
Dima
5f5fc494b6
fix(aqua-api): Add default constants to Aqua API [LNG-194] (#738) 2023-06-09 10:59:41 +00:00
InversionSpaces
3d432e6421
refactor(compiler-api): Use syntax extensions, rewrite folds (#717) 2023-05-27 12:34:37 +03:00
InversionSpaces
fe8a3fa8cd
refactor(parser): Use syntax extensions for readability (#716)
Used syntax extensions
2023-05-18 11:08:11 +00:00
Dima
670e779ba0
refactor: fix: LNG-143 LNG-144 definitions and locations algebras (#705) 2023-05-03 16:24:19 +03:00
Dima
dac8fb5774
refactor: Move LSP logic to LSP package (#701) 2023-04-20 13:01:47 +03:00
Dima
00ee8b5312
fix: name uniqueness in stream gate (#676)
* fix name uniqueness in gate

* fix unit test
2023-02-25 12:12:40 +07:00
Dima
50f0723a32
feat: copy structures implementation [fixes LNG-102] (#646) 2023-01-20 12:02:05 +07:00
Dima
aa89b85b41
Api for fluence cli (#611) 2022-12-28 11:30:42 +03:00
Dima
85b8f31e74
Fix join behavior when using .length (#584) 2022-11-16 15:20:32 +03:00
Dima
176cad360c
LNG-87 add null and never modes to fold instruction (#563) 2022-10-09 20:11:27 +03:00
Dima
95d3dc2d9e
LNG-86 Stream canonicalization (#553) 2022-09-30 19:06:55 +03:00
Dima
db016288b0
LNG-40 AIR validation on compilation (#546) 2022-08-22 16:37:02 +03:00
Dima
5a3ef04c2a
Update scala and libs versions (#544) 2022-08-01 22:20:45 +03:00
Dima
5a7450bce1
Go-to definitions location between files (#516) 2022-06-02 13:31:31 +03:00
Dima
6064659610
DXJ-21 Save token definitions for LSP (#514) 2022-05-24 17:05:26 +03:00
Dima
a0805068f3
#499 rename vars in for (#500) 2022-04-26 08:49:28 +03:00
Dmitry Kurinskiy
c74eb06499
427 topology bug (#433)
* fix path

* topology bug 427 test

* test with join, it works

* improve topology test, still works. add compiler test

* broken compiler test

* CompilerSpec works fine without `wrapWithXor`

* add xor to topology test, it becomes broken

* XOR topology fixed

* ForceExecModel

* Debugging topology WIP

* Fixed

Co-authored-by: DieMyst <dmitry.shakhtarin@fluence.ai>
2022-02-15 19:20:56 +03:00
Dmitry Kurinskiy
012cba493c
Op model (#403)
* Separating raw FuncOp from OpModel WIP

* Model compiles, fighting with transform

* Refactoring WIP

* transform compiles

* Fixing AquaCompiler WIP

* Compiler compiles WIP

* AquaContext's allFuncs, allValues

* WIP trying to compile the CLI

* It compiles

* It runs and fails to compile

* Compiles wrong way

* fix TopologySpec

* Sugar bugfix

* fix TransformSpec compilation

* fix test compilation

* fix SemanticSpec

* Topology debugging

* TransformSpec fixed

* Do not import aqua.model

* Take parts in Semantics

* Fix for re-exports

* Maybe a fix for streams

* Maybe a fix for declarations

* streamArgs.aqua in test examples

* more aqua code with bugs

* FuncOp removed

* removed wrapNonEmpty

* fix TransformSpec

* fix SemanticSpec compilation, delete FuncOps

* Separated model/res, model/inline

* tiny fix

* Tests fixed

* TreeNode to wrap labels into cofree standard way

* TreeNodeCompanion with defauls show, equalsOrShowDiff for all Cofree trees we have

* Simple TagInlinerSpec

* Failing test in TagInlinerSpec

* test wip

* test fixed

* delete Node

* delete test-kit, move tests

* fix constants

* Failing TagInliner test

* More complex case for TagInlinerSpec

* TagInlinerSpec fix

* Split RawValueInliner, TagInliner

* Dumb case for ArrowInlinerSpec

* spec for stream renaming

* renaming stream test

* Exports fixed

* SeqModel.wrapWithEmpty for tests

* Deleted EmptyModel

* Bring back EmptyModel

* ArrowInlinerSpec wip

* ArrowInlinerSpec fixed

* Test fixed

* fix

* stream in callback test WIP

* Slightly better logging for TagInliner

* add example in aqua

* test update

* Removed occasional abilities override

* test

* AquaCompilerSpec WIP

* AquaCompilerSpec failing

* AquaCompilerSpec fixed

* fix test

* compiler test, add RestrictionTag

* break test

* fix stream passing to box arguments

* fix exports in context

* Do not reexport builtins

* init for topology bug

* test for topology

* Reproduced the import-reexport bug

* Hops are working...

* Issue #397 does not reproduce!

* foldJoin reproduces the bug

* Reexports inefficiently fixed

* Topology test fixed

* topology bug

* Cache compiled parts

* Cache compiled parts

* ignore the wip topology test

* delete test

* hanging

* add builtin

* Use linked-data-structure `equals` instead of recursive `hashCode`

* A bit more logs

* eq is faster than ==

* Try to join one by one

* op.identity for join

* reverting op.noop for join

* Fix for renaming when value has the same name as argument

* Bump the version to .6

* broken test for names

* second test for renaming

* this test works but i must break it

* add index in call

* JoinModel breaks test

* the test works fine with a fix, but we should check it closely. and `foldJoin.aqua` integration test become broken

* broken test with xor

* Fixed naming issue for lambda's variables substitution

* Topology bug wip

* Fixes #397

* Maybe fix

Co-authored-by: DieMyst <dmitry.shakhtarin@fluence.ai>
2022-01-31 14:48:13 +03:00
Dmitry Kurinskiy
061e896b63
Model/raw refactoring (#398)
* Introducing model/raw subproject

* ValueRaw WIP

* ValueRaw WIP

* ValueModel.fromRaw WIP

* Recursive variables renaming

* Tests

* recursiveRaw

* Arrow Inliner refactoring

* desugarize takes its place WIP

* Sugar.desugarize maybe works

* Some movings/renamings

* Compile bug fixed

* Updated scalafmt

* Fix for service defaultId

* Map values recursively
2022-01-13 10:32:59 +03:00
Dima
4eb272e953
Support new fluenceJS version in run command. Print results of a function (#358) 2021-11-17 10:56:42 +03:00
Dima
3844d8f2db
Run aqua code from CLI (#324) 2021-10-13 11:10:10 +03:00
Dima
93dec7846c
Check service definition fields in TS and JS, fix functions and services count in output (#305) 2021-09-17 11:21:04 +03:00
Dima
dae234dc5a
Performance improvement: single parser instance (#254) 2021-08-27 15:57:44 +03:00
Dmitry Kurinskiy
b9af20339b
Module and Use expressions (#245)
* Module and Use expressions

* UseFromExpr

* ImportFromExpr

* PubExpr

* Export, declares

* Collecting all the needed info WIP

* Got all the needed data

* Tests fixed

* HeaderSem

* HeaderSem wip

* Everything except `export`/`declares` should be working

* Compile bug fixed

* Fix readme: cli/assembly

* Handle declares, exports

* Compile only exports in AquaRes

* Call services imported from modules

* Import consts, types, services from modules

* Resolve arrows from modules

* Bugfix
2021-08-20 18:03:47 +03:00