[Completed] Sophia language and ecosystem development Q4-2023

Application Status

Status: Completed
Last updated: 01.02.2024
Submited by Radosław Rowicki, radrowicki at google’s 5-letter mail domain
Team: Gaith Hallak, Radosław Rowicki
Approved Budget (in h):
Used Budget (in h):
Planned Delivery:

Specify the funding category

Open Source Development, Research and Education

Application Title

Sophia language and ecosystem development Q4-2023

Applicant

Radosław Rowicki (@radrow) and Gaith Hallak (@ghallak)

Value Application

Improvement of smart contract development on the æternity blockchain using Sophia and FATE.

Definition of Terms

  • Sophia — most commonly used smart contract language for the æternity blockchain.
  • FATE — smart contract runtime system on the æternity blockchain.
  • Compiler — translator between a high-level language (here; Sophia) to a low level language executed by a machine (here; FATE).
  • Language ecosystem — a collective term for various tools integrated to work together for software production in a given language.

Status Quo

Sophia is a well designed language and is convenient for smart contract development. Unfortunately, the means utilizing it in professional use cases lack some maturity or external functionalities, especially regarding editor support and testing. Moreover, the language still has some parts which are underdeveloped, and while it does not drastically hinder its usability, it makes it harder to adapt by programmers not familiar with it.

Sophia developers are encouraged to use aestudio for smart contract development. While the editor is a legitimate tool, not everyone is fond of web-based editors. There is practically no alternative to it, unfortunately. While there are some extensions to VS Code, they offer little over syntax highlighting.

The REPL is a working tool and can be used for offline and online testing contracts. It supports basic debugging utilities which are accessible through a websocket layer. However, it lacks some features, especially regarding chain simulation and local variables.

Required Work

In the long term the following should be considered:

  • Develop and maintain the debugger on demand
  • Develop and maintain the REPL on demand
    • Cover all top-level Sophia declarations
      • Recursive functions
      • Namespaces
      • Contracts
      • Multiple definitions in a single prompt
    • Responsiveness polish
    • Testing, fix all crashes
    • Documentation
    • Tutorials
  • Develop the compiler
    • Regular maintenance on demand
    • Rewrite as a modularized device
      • Design and implement parser as a tree-sitter grammar
      • Compatibility layer between tree-sitter and actual AST representation
      • Rewrite typechecker
      • Redesign backend layers
      • Expose code analysis features
  • Editor support
    • Language Server Protocol
    • Integrate with REPL

Our focus in this application has been marked in bold.

Estimate

@ghallak will be working full time on this grant. @radrow will be allocating time during weekends and his free time to provide advice, code reviews, and might do development when required.

Known Limitations

Compiler construction requires a lot of expertise, research and overall engineering effort. The team is small, which hinders the pace.

Outlook

The points that are not marked in bold in the “Required work” section are the longer term goals that should be considered according to their priority in the future.

Publishment

We plan to publish our work in the official AE Github repositories. Project releases will be made by the end of this grant period. Some major changes or critical updates might require publishing new releases for certain projects before the end of the grant period.

Maintenance

Maintenance and bug fixes are part of this grant, and we will be providing bug fixes and updates as necessary to the projects that are developed under this grant.

1 Like

Update for October and November 2023

Most of the time was spent on planning and reorganizing, therefore the progress on this particular grant is smaller than usual. Regarding engineering, we accomplished:

  • Improved the tree-sitter grammar for Sophia
  • Polished web interface to the REPL for frontend integration
  • Begun works on the typechecker for the upcoming Sophia compiler re-release
  • Researched and discussed various designs for AST representation in the new compiler
1 Like

Update for December 2023

  • Improved and released new version of the Sophia REPL
  • Expanded the generic server interface in main REPL library
  • Updated the websocket interface in the REPL Phoenix web app
  • As always, code reviews and discussions
1 Like