BlockstreamResearch / simfony

Rust-like high-level language that compiles down to Simplicity bytecode. Work in progress.
19 stars 6 forks source link

New syntax #6

Closed uncomputable closed 6 months ago

sanket1729 commented 6 months ago

I like the direction this is going towards. What does the [dosn't work] mean in section titles, do other programs compile/translate with the current rust-simplicity master?

uncomputable commented 6 months ago

Let's finalize a minimum-viable Simphony syntax + semantics without loops. The documentation is pretty much finished. Feel free to comment. I will start modifying the code base.

One open question is what {scoping} does. The syntax has rules like e1; e2. Are the {brackets} required to show precedence of operations, as in (1 + 2) * 3?

apoelstra commented 6 months ago

@uncomputable I think scoping should affect the let statement, which assigns name(s) to expressions. Any names that appear within { and } should be invisible outside of them.

Similarly these names should be invisible before the let statement.

apoelstra commented 6 months ago

We probably need to tweak the context in some subtle way to handle this (maybe just having a stack of contexts where } pops everything off since the last {?

These braces shouldn't have anything to do with precedence -- only ( ) parens should.

apoelstra commented 6 months ago

ACK bc9fcf08f80003a5bf0fd20d64e273d69d1d7577 other than the above comments.

Note that I only skimmed some of the notation-heavy descriptions of the contexts and translations.

We are missing lists and loops entirely. Should defer these to a followup PR as you say.