Sol - an imperative, statically-typed language designed as a tool for learning how to program

Related tags

Desktop sol
Overview

SOL: Simple Obvious Language

Sol is an imperative, statically-typed language designed as a tool for learning how to program. It is simple, in that it has few language features and is thus can be learned quickly. It is obvious, in that it should be clear from reading the source code of an application what instructions the computer will execute.

Many common programming language features that allow programs to be more expressive were intentionally left out. See non-features for more details.

Examples

Hello, world!

function main() {
  print("Hello, world!");
}

Explicit Type Casts

function main() {
  constant answer = 42;
  constant message = "The secret is " + String(42);
  print(message);
}

Max Number

function maxNumber(numbers Number[]) -> Number {
  variable max = 0;
  for index, number in numbers {
    if index == 0 {
      max = number;
      continue;
    }
    if number > max {
      max = number;
    }
  }
  return max;
}

function main() {
  variable allNumbers = Number[1, 2];
  variable bigNumber = maxNumber(allNumbers);
  print("The biggest number is " + bigNumber);
}

Non-features

What should be of more note to existing programmers is not what features Sol implements, but rather those it does not. What follows is a non-comprehensive list, along with the rationale for omitting it.

Mutable Global State

While Sol allows constants to be defined globally, it does not have global variables. Variables only exist within the scope of a function, and to share them you must either pass their value or a pointer to them via function arguments. Similarly...

Garbage Collection

Sol does not have garbage collection for two reasons: simplicity of implementation and to expose the user more closely to their application's memory management. See memory model for more details.

Concepts

Memory Model

Sol uses a statically-determined stack-based memory management system, similar to RAII in C++ or Rust. The only heap allocations that occur in a Sol program are when elements are added to the built-in List and Map data structures. List or Map instances are stack-allocated containers that hold references to heap-allocated elements. When the references to these containers leave the current function scope (global constants are the exception), the Sol runtime will free up all of the heap allocated elements (like a C++ destructor).

Because the Sol runtime assumes that these heap-allocated data structure elements will never again be used once the function that allocated the container leaves scope, Sol does not allow functions to return pointers. If a Sol program needs to have a function initialize a data structure and then return it to the caller, either the caller needs to allocate the container and pass a pointer to the initializing function or the function must return the data structure's value (this will require a copy and thus be slower, but is the simplest to reason about).

Sol does not use manual memory management (as in C or Zig) as this can easily introduce errors that are difficult to debug.

Sol does not use garbage collection (as in most scripting languages like Python or JavaScript) because it adds implementation complexity and hides the memory management from the user. In other words, most garbage collection implementations make it impossible to know when memory has been freed simply from reading the source code.

Sol does not use reference-counting as most implementations require either the cognitive overhead on the part of the programmer to avoid cycles or they rely on a backup garbage collector.

Sol Syntax

Keywords

Keyword Description Implemented?
variable A mutable variable [ ]
constant An immutable variable [ ]
function A custom function. [x]

Primitives

Type Example Description Implemented?
String "Hello, world!" ASCII, immutable string [x]
Number 12.3 Floating point number (currently 32-bit) [ ]
boolean variable shouldUpdate = false; Either true or false [ ]
null null null literal [ ]

Composite Types

Type Example Description Implemented?
List String["A", "b", "Hello, world!"] An untyped, growable list of objects [ ]
Map Number{"age": 36} Hash map from String to a single type. [ ]

Control Flow

Keyword Example Implemented?
if if check() {} [ ]
for & in for idx, el in elementList {} [ ]

Standard Library

Process

Function Name Description Implemented?
run(String[]) Run a subprocess. [ ]

I/O

Function Name Description Implemented?
print(String) Print a String to STDOUT [ ]
printError(String) Print a String to STDERR [ ]
You might also like...

aplikasi untuk menunjang BUMDes Tirtomulyo program KKN Tematik

Smart BUMDes this application as a task of supporting the thematic KKN project in the village of Tirtomulyo, Kendal Design UI Getting Started This pro

Jul 18, 2022

Demonstrate how to easily program Android apps on Gitpod

Demonstrate how to easily program Android apps on Gitpod

Developing Android apps on Gitpod This project is intended to demonstrate how to easily program Android apps on Gitpod. It is based on this guide and

Dec 8, 2022

A backend server that makes it possible to program with Flutter syntax and reuse existing code

A backend server that makes it possible to program with Flutter syntax and reuse existing code

Get Server GetServer allows you to write backend applications with Flutter. Everything here is familiar, from the widgets, to the setState, initState

Jan 5, 2023

Sanmill is a free, powerful UCI-like N men's morris program with CUI, Flutter GUI and Qt GUI.

Sanmill is a free, powerful UCI-like N men's morris program with CUI, Flutter GUI and Qt GUI.

Sanmill is an open-source, UCI-like Mill/Morris/Merrills/Mühle/Malom (and its variants) program with CUI, Flutter GUI and Qt GUI, sharing and freely distributing the code, tools and data needed to deliver this mill game. We do this because we are convinced that open software and open data are key ingredients to make rapid progress.

Dec 28, 2022

A program for Mac, Windows and Linux to manage multiple translation files at once

A program for Mac, Windows and Linux to manage multiple translation files at once

A program for Mac, Windows and Linux to manage multiple translation files at once. Easy to use UI, multithreaded for optimization and Google Translate natively integrated. NB: At the moment it doesn't support nested translation keys.

Aug 8, 2022

A program for booking restaurants that allows two types of the user (admin & customer).

  A program for booking restaurants that allows two types of the user (admin & customer).

restaurant Programmed by Flutter A program for booking restaurants that allows two types of the user (admin & customer). The admin can upload products

May 22, 2022

Program Chat ini dibuat menggunakan Flutter versi 1.22 dan firebase untuk tugas matkul pemrograman mobile kampus UPB Nagoya

chatngopi A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Nov 3, 2022

This is the self learning of mine about Dart Language

This is the self learning of mine about Dart Language

Dart Tutorial These are dart files what iam self studied And I think to share my knowlage with others from sharing this repo as public Still Adding so

Nov 6, 2022

Dart package that converts number to words (English language)A Flutter/Dart package that converts number to words (English language)

flutter_number_to_words_english A Flutter/Dart package that converts number to words (English language) Flutter (Null Safety) Flutter (Channel stable,

Dec 9, 2022

FIDL(Flutter Interface Definition Language) is a language for transfer objects cross platforms.

FIDL(Flutter Interface Definition Language) is a language for transfer objects cross platforms.

Flutter Interface Definition Language (FIDL) README in English(TODO) FIDL 即 Flutter 接口定义语言,类似于AIDL(Android Interface Definition Language)。您可以利用它定义不同平台

Dec 7, 2022

Machine learning algorithms in Dart programming language

Machine learning algorithms for Dart developers What is the ml_algo for? The main purpose of the library is to give native Dart implementation of mach

Jan 4, 2023

Language Learning Flutter UI Kit

Language Learning Flutter UI Kit

🔥 🔥 Language Learning Flutter UI Kit 🔥 🔥 💫 ⭐️ ⭐️ 👨‍💻 Free Flutter UI Kits

Dec 14, 2022

Flutter-e-learning - E-Learning Application Built With Flutter

Flutter-e-learning - E-Learning Application Built With Flutter

E-Learning Demo Screens Explore Planner Overlay Videos Leaderboard Global Leader

Dec 27, 2022

Eflashcard - Ready to learn a new language? Try this flashcards app that will help you learn the different writing systems of each language

Eflashcard - Ready to learn a new language? Try this flashcards app that will help you learn the different writing systems of each language

Language Flashcards Mobile App Ready to learn a new language? Try this mobile fl

Jan 8, 2022

Flutter language pickers2 - Language pickers package for Dart and Flutter

Flutter language pickers2 - Language pickers package for Dart and Flutter

language_pickers2 Notes: Original repository from github.com/gomgom, unfortunate

Feb 6, 2022

This is tool to create 3D Models which can be used in Flutter Applications. Tool is developed completely using Flutter.

three_d_model_tool A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you start

Nov 8, 2022

Nakama is an open-source server designed to power modern games and apps

Nakama is an open-source server designed to power modern games and apps. Features include user accounts, chat, social, matchmaker, realtime multiplayer, and much more.

Dec 30, 2022

FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.

FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.

File Manager FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to fee

Dec 30, 2022
Owner
Christopher Fujino
Software Engineer
Christopher Fujino
Flutter widgets and themes implementing the current macOS design language.

macos_ui Flutter widgets and themes implementing the current macOS design language. NOTE: This package depends on the excellent native_context_menu pl

Reuben Turner 1.1k Jan 1, 2023
A tool for debugging your Flutter apps.

anyinspect_app A tool for debugging your Flutter apps. Platform Support Linux macOS Windows ➖ ✔️ ➖ Installation Downloads are available on the Release

AnyInspect 40 Nov 11, 2022
Parser tool is a real-time compiler and runtime engine for strongly typed PEG parsers

parser_tool Version 0.1.1 (BETA) Parser tool is a real-time compiler and runtime engine for strongly typed PEG parsers. Parser tool contains libraries

null 6 Jun 28, 2021
Manage the state of your widgets using imperative programming concepts.

Imperative Flutter Manage the state of your widgets using imperative programming concepts. Setup Intall imperative_flutter package in pubspec.yaml dep

Jeovane Santos 5 Aug 20, 2022
Stream-based strongly typed GraphQL client for Dart

A simple, powerful GraphQL Client for Flutter and Dart Documentation ?? Features ✅ Fully Typed: work faster and safer with compile time checks and IDE

GQL Dart 484 Jan 9, 2023
Widget to let the user search through a keyword string typed on a customizable keyboard in a single or multiple choices list presented as a dropdown in a dialog box or a menu.

searchable_dropdown Widget to let the user search through a keyword string typed on a customizable keyboard in a single or multiple choices list prese

Bobby Stenly Irawan 108 Sep 11, 2022
Shared preferences typed - A type-safe wrapper around shared preferences, inspired by ts-localstorage

Typed Shared Preferences A type-safe wrapper around shared_preferences, inspired

Philipp Bauer 0 Jan 31, 2022
SurrealDB client written in pure dart. auto reconnect, typed functions

SurrealDB Client For Dart & Flutter SurrealDB client for Dart and Flutter. Quick Start import 'package:surrealdb/surrealdb.dart'; void main(List<Stri

Duhan BALCI 10 Dec 18, 2022
Lightning fast, strongly typed network protocol

What is Bolt Bolt is a network protocol written in Dart to send and receive strongly typed data objects. It is designed to be easy to use and to be as

Jochum van der Ploeg 42 Dec 3, 2022
Body mass index (BMI) is a measure of body fat based on height and weight that applies to adult men and women. Here is the simple program for BMI calculator in Flutter.

BMI-Calculator Body mass index (BMI) is a measure of body fat based on height and weight that applies to adult men and women. Here is the simple progr

Renganathan 2 Oct 31, 2021