SomonScriptDocs

SomonScript documentation for schools and students

This page is the overall learning plan. If you are a beginner or teach a class, start here: 3 steps to installing, writing a first program and understanding the basics of the language.

Step 1: Quick start

First make sure Node.js is installed, then install the SomonScript CLI and write a simple program, салом.som.

1. Node.js

Go to nodejs.org and install the LTS version.

2. SomonScript CLI

Install the CLI globally with npm.

3. First program

Create the file салом.som and run it with somon run.

Installing the CLI and checking it in the terminal

Run these commands in Terminal or PowerShell. The docs show commands this way throughout.

terminal
# Check the versions
node -v
npm -v

# Install the SomonScript CLI
npm install -g @lindentech/somon-script

# Check
somon --version

Step 2: "Hello, world" in SomonScript

Now let us write a first program. This example comes up in other sections too and works well in class.

салом.som
// First program
чоп.сабт("Салом ҷаҳон!");

What to do

  1. Create a new folder, for example somon-project.
  2. Create the file салом.som in that folder.
  3. Copy the code into the file and run it in the terminal.
somon run салом.som
Салом ҷаҳон!

Step 3: The basics of SomonScript

To learn step by step, start with the lessons: 18 lessons with examples that run right in the browser. Below is a map of the docs chapters to come back to for reference.

Syntax basics

Variables, data types, operators and conditions.

Functions and data

Simple functions, recursion and repeated work.

Classes, OOP and modules

For bigger projects: classes, inheritance and splitting code into files.

Type system and errors

Advanced types, error checks and exceptions for reliable programs.

The SomonScript CLI in one table

These commands come up often in the examples and exercises. Schools may want to print this table and hang it in the classroom.

CommandDescription
somon runCompile and run a .som file.
somon compileCompile to JavaScript without running.
somon bundleBundle several files into one .js file.
somon module-infoShow the dependencies between modules.

A guide for students

If you are learning on your own, we suggest this path:

  1. Go through the lessons from 1 to 18: run every example and watch it step by step.
  2. Solve the tasks in the playground: the "Check" button tests your solution.
  3. For bigger programs, install SomonScript on your computer (step 1) and use chapters 2-11 of the docs as a reference.

A guide for teachers

The 18 lessons make a 6-week course with three lessons a week. A suggested plan:

  • Weeks 1-2: lessons 1-6 - printing, errors, variables, numbers, input and calculations.
  • Weeks 3-4: lessons 7-12 - comparisons, conditions and loops.
  • Weeks 5-6: lessons 13-18 - functions, lists, strings and objects.

How to hand out and check tasks, common mistakes of students, and how the lessons match the textbook "Технологияи иттилоотӣ" (Information technology) are described in the teacher's guide, in Tajik and Russian.