Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Func backend: First iteration #559

Closed
wants to merge 163 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
3e7c7b4
feat: Initial draft of the new backend.
byakuren-hijiri Jul 12, 2024
60831d1
feat(codegen): Support all `ops`
byakuren-hijiri Jul 13, 2024
a221569
feat(codegen): Support unary expressions + refactor
byakuren-hijiri Jul 13, 2024
d7acbb2
feat(func): Support regular assigns
byakuren-hijiri Jul 13, 2024
29cf7b5
feat(codegen): Support assign statements
byakuren-hijiri Jul 13, 2024
11a1487
chore(codegen): Refactor statements
byakuren-hijiri Jul 13, 2024
c989cb8
feat(codegen): Support field access
byakuren-hijiri Jul 13, 2024
477eb2c
fix(syntax): Remove assignments from available binary operations
byakuren-hijiri Jul 13, 2024
2fd26e7
chore(syntax): Refactor
byakuren-hijiri Jul 13, 2024
b327bb9
feat(codegen): Support all the binary expressions
byakuren-hijiri Jul 13, 2024
811d659
chore(function): Reuse `resolveFuncType`
byakuren-hijiri Jul 13, 2024
5c0af8a
feat(codegen): Constructor functions + relevant changes in AST
byakuren-hijiri Jul 14, 2024
c7bfbc9
chore(codegen): Func example
byakuren-hijiri Jul 14, 2024
2f219f3
feat(codegen): Introduce `CodegenContext`
byakuren-hijiri Jul 14, 2024
7d5e5f3
feat(codegen): Calls to constructor functions + context-related logic
byakuren-hijiri Jul 14, 2024
b0f0dc4
feat(codegen): Support struct values/objects
byakuren-hijiri Jul 14, 2024
a7f85c5
fix(codegen): Minor errors
byakuren-hijiri Jul 14, 2024
e3e0715
feat(ast): Multiline comments
byakuren-hijiri Jul 14, 2024
ee6d514
fix(formatter): Function signatures
byakuren-hijiri Jul 14, 2024
271f3c8
feat(formatter): Indentation
byakuren-hijiri Jul 14, 2024
bd067c1
chore(formatter): Extra newlines
byakuren-hijiri Jul 14, 2024
03f7328
feat(codegen): Comments, pragmas, includes in the generated contract
byakuren-hijiri Jul 14, 2024
583bec2
fix(formatter): VarDef w/ local type inference
byakuren-hijiri Jul 14, 2024
ca0b094
fix(codegen): tuples=>tensors as return values of functions
byakuren-hijiri Jul 14, 2024
515e89e
feat(codegen): contract=>module; draft main contract generation logic
byakuren-hijiri Jul 14, 2024
063e2e3
feat(codegen): Support `init_of` and ternary expressions
byakuren-hijiri Jul 14, 2024
75bcb70
feat(syntax): Function definition/declaration
byakuren-hijiri Jul 15, 2024
cd22057
feat(codegen): Support multi-file generation
byakuren-hijiri Jul 15, 2024
77d7b64
feat(codegen): `lazy_deployment_completed` and `get_abi_ipfs`
byakuren-hijiri Jul 15, 2024
1e3e435
feat(syntax): Support string literal types
byakuren-hijiri Jul 15, 2024
da80237
feat(codegen): Generate `supported_interfaces`
byakuren-hijiri Jul 15, 2024
ad7d2ec
feat(syntax): Introduce `constructors`
byakuren-hijiri Jul 16, 2024
0b0383d
feat(syntax+fmt): Support hex int literals; refactor
byakuren-hijiri Jul 17, 2024
6c86d61
fix(fmt): Missing semicolons
byakuren-hijiri Jul 17, 2024
3f0ed5b
feat(codegen): Routers; handlers for receivers
byakuren-hijiri Jul 17, 2024
9ccdbff
feat(syntax+codegen): Support new AST constructors
byakuren-hijiri Jul 17, 2024
9611476
feat(syntax): Support different comment styles
byakuren-hijiri Jul 18, 2024
c8ce46a
chore(syntax): %s/varDef/vardef/g for consistency
byakuren-hijiri Jul 18, 2024
e9a0166
feat(syntax): Utilize `FuncAstIdExpr` for names instead of raw strings
byakuren-hijiri Jul 18, 2024
571b126
feat(tests): Differential tests based on jest' diff utility
byakuren-hijiri Jul 18, 2024
f557114
fix(fmt): Minor fixes
byakuren-hijiri Jul 18, 2024
29701e6
fix(fmt): Trailing whitespaces in comments
byakuren-hijiri Jul 18, 2024
93932d4
fix(codegen): Typo
byakuren-hijiri Jul 18, 2024
59c5202
feat(formatter): line length limit + multiline tensor expressions
byakuren-hijiri Jul 19, 2024
559b406
feat(syntax+formatter): Support function receivers
byakuren-hijiri Jul 19, 2024
8db5675
fix(codegen): Correct function receivers
byakuren-hijiri Jul 19, 2024
a2ee2b8
chore(compile): Optional debug prints for codegen output
byakuren-hijiri Jul 19, 2024
fad1dc6
fix(codegen): Get rid of extra function attributes
byakuren-hijiri Jul 19, 2024
97216d1
chore(codegen): Replace the rest of ad-hoc initializers w/ constructors
byakuren-hijiri Jul 19, 2024
f666ac0
feat(syntax): Extra check for implicit `Object`->`string` conversion
byakuren-hijiri Jul 19, 2024
e23bbd5
feat(syntax): `asm` functions
byakuren-hijiri Jul 19, 2024
fc69661
feat(codegen): Separate `Literal` generator; string literals support
byakuren-hijiri Jul 19, 2024
245e4c9
feat(codegen): Support `Address`
byakuren-hijiri Jul 19, 2024
7204e74
feat(codegen): Support `Cell` and `Comment` literals
byakuren-hijiri Jul 19, 2024
7b564f1
chore(syntax): More informative error message
byakuren-hijiri Jul 19, 2024
2debb1e
fix(codegen): `[object Object]` in output
byakuren-hijiri Jul 19, 2024
442dcad
fix(codegen): Comment position
byakuren-hijiri Jul 19, 2024
2b3f4f2
feat(syntax): Support extra CR
byakuren-hijiri Jul 20, 2024
5961ff2
feat(codegen): Support receivers
byakuren-hijiri Jul 20, 2024
9065452
feat(syntax): Support value in `method_id` attributes
byakuren-hijiri Jul 20, 2024
9baeac5
fix(codegen): Comment position
byakuren-hijiri Jul 20, 2024
49d246c
feat(codegen): Support getters
byakuren-hijiri Jul 20, 2024
aff835e
feat(codegen): CRs in routers code to look as the old backend
byakuren-hijiri Jul 20, 2024
6cf09e5
feat(codegen): Context management to replicate some `Writer` logic
byakuren-hijiri Jul 21, 2024
39d3127
feat(codegen): Support internal receivers
byakuren-hijiri Jul 22, 2024
1a655d8
fix(codgen): Bug in the old backend
byakuren-hijiri Jul 22, 2024
9cddfa1
feat(codegen): Support external receivers
byakuren-hijiri Jul 22, 2024
cc88488
fix(codegen): Arguments of `throw_unless`
byakuren-hijiri Jul 23, 2024
51defe8
feat(formatter): Set parens around non-trivial unary expressions
byakuren-hijiri Jul 23, 2024
265cf94
feat(codegen): More convinient context API for adding function
byakuren-hijiri Jul 23, 2024
2a058ec
feat(codegen): Support init and initChild functions
byakuren-hijiri Jul 23, 2024
d9a9e59
feat(codegen): Add primitives
byakuren-hijiri Jul 23, 2024
d27e246
chore(codegen): Revisit the structure of `writeProgram`
byakuren-hijiri Jul 23, 2024
6929720
feat(codegen): Support native Func code
byakuren-hijiri Jul 23, 2024
0ecdaba
feat(codegen): Generate the constants file
byakuren-hijiri Jul 23, 2024
34df3be
feat(codegen): Support storage
byakuren-hijiri Jul 24, 2024
089e87c
fix(formatter): Extra space in fun declarations w/o attrs
byakuren-hijiri Jul 24, 2024
8e97c7e
feat(syntax): Func syntax iterator
byakuren-hijiri Jul 24, 2024
a938e04
feat(codegen): Automatic depdendency detection
byakuren-hijiri Jul 24, 2024
e98e2f1
chore(codegen): Skip dependencies check
byakuren-hijiri Jul 24, 2024
e5578ce
feat(codegen): Introduce hacks in dependency management to overcome m…
byakuren-hijiri Jul 25, 2024
8d704c2
chore(codegen): Restructure, to make `writeAll` more explicit
byakuren-hijiri Jul 25, 2024
660bf84
feat(syntax): Support variables unpacking
byakuren-hijiri Jul 25, 2024
1a16faf
feat(codgen): WIP stdlib translation to showcase how it looks like
byakuren-hijiri Jul 25, 2024
75b6952
test: small subset of functions in stdlib for testing FunC grammar
novusnota Jul 25, 2024
33b6b65
WIP: FunC grammar & parser
novusnota Jul 25, 2024
8d32ff8
feat(func-parser): mostly finished the expressions and fixed types
novusnota Jul 26, 2024
8bc2486
feat: tested top-level things, added more tests for identifiers
novusnota Jul 28, 2024
bfab588
feat(func-parser): 1/3 of types and semantics
novusnota Jul 29, 2024
21e5253
test(func-parser): covered everything but expressions in tests
novusnota Jul 31, 2024
c6b4916
fix: statements, expressions and types in different contexts
novusnota Aug 1, 2024
8f781f6
test(func-parser): one more sample of an interesting asm function
novusnota Aug 1, 2024
3c5564c
fix(func-parser): multi-line and single-line strings can be placed af…
novusnota Aug 1, 2024
a8fb799
feat/chore(func-parser): types, loc and formatting
novusnota Aug 1, 2024
cec8c17
fix(func-parser): adjust expressions and identifiers
novusnota Aug 2, 2024
e185cfe
func(func-parser): grammar is finally completed, and most tests pass!
novusnota Aug 4, 2024
7286760
fix(func-parser): fixed most of the bugs, working on identifiers star…
novusnota Aug 5, 2024
f1519d2
refactor(func-parser): types, expressions, and whitespace padding
novusnota Aug 5, 2024
c60104a
feat(func-parser): grammar is finally complete and able to parse stdl…
novusnota Aug 7, 2024
6e86d5e
feat(func-parser): worked through most of the types, got to complete …
novusnota Aug 7, 2024
1482754
feat(func-parser): 2/3 of the AST
novusnota Aug 8, 2024
c64dc47
feat(func-parser): completed! :rocket:
novusnota Aug 10, 2024
93acaef
fix(func-parser): bug squashed and lots of tests added
novusnota Aug 11, 2024
f315834
chore(func-parser): change the note
novusnota Aug 11, 2024
9658c5b
chore(func-parser): simplify `upperId`' regex and reformat `grammar.ts`
novusnota Aug 11, 2024
43e1c4c
chore(func-parser): spelling
novusnota Aug 11, 2024
e69cd14
fix(generator): Fix compilation errors
jubnzv Aug 12, 2024
dd7cf6c
feat(grammar): Add dummy definitions
jubnzv Aug 12, 2024
804ab80
chore(grammar): Extract type
jubnzv Aug 12, 2024
a3eee3a
chore(func-parser): remove redundant snapshots and rename couple thin…
novusnota Aug 12, 2024
79b2ad1
feat(func/grammar): Separate hex literal
jubnzv Aug 13, 2024
56f39ea
fix(grammar): Set correct types for assignment' `lhs` and `rhs`
jubnzv Aug 13, 2024
6ebe769
feat(syntaxConstructors): Support new `grammar.ts`
jubnzv Aug 23, 2024
8d1d508
feat(codegen): Adapted the codegen
jubnzv Aug 26, 2024
ed2c982
feat(iterators): Support new grammar
jubnzv Aug 29, 2024
bb0965b
fix(grammar): Forbid ;-style comments
jubnzv Aug 29, 2024
9142be6
fix(codegen): Update some functionality
jubnzv Aug 29, 2024
8fc6f15
feat(func): Half-backed `pp` for the new AST
jubnzv Aug 29, 2024
d036d3e
feat: Finalize new AST translation
jubnzv Aug 29, 2024
6d3999a
fix(syntaxConstructors): Allow empty `method_id`
jubnzv Sep 4, 2024
299d3f7
fix(pp): Support `unit`
jubnzv Sep 4, 2024
4127b02
fix(package.json): Include func grammar bundle to dist
jubnzv Sep 4, 2024
9f54da1
fix(pp): Global types
jubnzv Sep 4, 2024
ea7928f
feat(codegen): Add stdlib
jubnzv Sep 5, 2024
123f7ae
fix(stdlib): Hack for Func parser
jubnzv Sep 6, 2024
3fc4e79
fix(stdlib): Missing brackets
jubnzv Sep 6, 2024
1344fb7
chore(ctx): Add missing `parse`
jubnzv Sep 6, 2024
ac3111a
chore(stdlib): simplify
jubnzv Sep 6, 2024
4f6e849
chore(pp): ppTy as a public interface
jubnzv Sep 7, 2024
be14b13
feat(codegen): Add accessors
jubnzv Sep 7, 2024
41c3f35
fix(accessors): Syntax errors
jubnzv Sep 8, 2024
f675f27
feat(codegen): Serializers
jubnzv Sep 8, 2024
8da2062
fix(util): `funcInitIdOf`
jubnzv Sep 8, 2024
dc3af50
feat(codegen): Init serializers
jubnzv Sep 8, 2024
5e5a5b8
feat(codegen): Storage functions
jubnzv Sep 8, 2024
10bbf30
feat(codegen): Add static functions
jubnzv Sep 8, 2024
77d12b0
chore(codegen): Add missing file
jubnzv Sep 8, 2024
3bfc322
feat(codegen): Support extensions
jubnzv Sep 8, 2024
dfa9013
feat(grammar): Support `try {} catch (_) {}`
jubnzv Sep 9, 2024
9c46edd
feat(codegen): Support all the statements
jubnzv Sep 9, 2024
9ee58a1
feat(pp): Refine API; more public methods
jubnzv Sep 10, 2024
82272f4
feat(pp): Support type vars
jubnzv Sep 10, 2024
494c240
chore(Writer): Replace `#` annotations
jubnzv Sep 10, 2024
a1b42a0
feat(func): Expose public functions
jubnzv Sep 10, 2024
8b5c98d
chore(codegen): Remove tests; they'll be rewritten
jubnzv Sep 10, 2024
7c3b01f
Merge remote-tracking branch 'origin/main' into 526-func-codegen
jubnzv Sep 10, 2024
bcfef54
feat: New codegen copied from the main version; `writeStdlib` is ported
jubnzv Sep 11, 2024
f792111
fix(codegen): Remove extra attributes
jubnzv Sep 11, 2024
a3b2877
chore(codegen): Roll-back porting `writeStdlib` because of FunC parse…
jubnzv Sep 11, 2024
2419b16
chore(syntaxConstructors): Set `if` instead of `ifnot` by default
jubnzv Sep 11, 2024
a89bd0b
feat(test): Improve readability
jubnzv Sep 11, 2024
6d4b179
feat(test): Don't add extra .tact to paths in the generated config
jubnzv Sep 11, 2024
e140b35
feat(test): Don't consider newlines in differential testing
jubnzv Sep 11, 2024
6909f93
fix(pp): Don't add extra crs
jubnzv Sep 11, 2024
6397c85
feat(codegen): Port `writeRouter`
jubnzv Sep 11, 2024
236a518
feat: support `catch(_)` clauses
novusnota Sep 11, 2024
9cfa662
fix(tests): Hack for FunC parser
novusnota Sep 11, 2024
deaa617
fix(func-parser): Correct recognition of function and method calls
novusnota Sep 11, 2024
59f8936
feat(test): Allow lowercase test names
jubnzv Sep 12, 2024
80cc2cf
fix(pp): Extra dots in new function calls
jubnzv Sep 12, 2024
deb369f
feat(pp): Add pp functions
jubnzv Sep 12, 2024
98c6fb9
fix(writeRouter): Make old `writeReceiver` work with new API functions
jubnzv Sep 12, 2024
dcca629
feat(codegen): Port `writeStdlib`
jubnzv Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(ast): Multiline comments
byakuren-hijiri committed Jul 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit e3e0715da51cefe350e03f02e24e57a826423725
2 changes: 1 addition & 1 deletion src/func/formatter.ts
Original file line number Diff line number Diff line change
@@ -310,7 +310,7 @@ export class FuncFormatter {
}

private static formatComment(node: FuncAstComment): string {
return `;; ${node.value}`;
return node.values.map((v) => `;; ${v}`).join('\n');
}

private static formatType(node: FuncType): string {
2 changes: 1 addition & 1 deletion src/func/syntax.ts
Original file line number Diff line number Diff line change
@@ -276,7 +276,7 @@ export type FuncAstFunction = {

export type FuncAstComment = {
kind: "comment";
value: string;
values: string[]; // Represents multiline comments
};

export type FuncAstInclude = {