Skip to content

Leko1705/Tscript

Repository files navigation

Welcome to Tscript!

(Teaching Script) Tscript is a dynamically typed programming language, designed for teaching common programming concepts to newcomers and advanced programmers. This implementation is a re-implementation of the original implementation which can be found here. Besides the original features this implementation supports a couple of new features or feature changes.

What's new?

A list of all new features can be found here.

Getting Stated

Set up a project as shown here. You may use exampleProject as a template.

Then run the project:

Using Docker:

docker build -t tscript .
docker run -p 8080:8080 tscript

From Java Code:

import com.tscript.projectfile.ProjectFile;
import com.tscript.projectfile.ProjectFileRunner;

public class Main {

    public static void main(String[] args) {
        ProjectFile projectFile = ProjectFile.parse(
                "./exampleProject/project.tsrt");
        int exitCode = ProjectFileRunner.runTscriptProject(projectFile);
        System.exit(exitCode);
    }

}

Often Asked Questions

Why are namespaces treated as Types?

Namespaces are generated as classes. Consider the following namespace:

namespace math {
    const E = 2.718281828459045;
    
    function abs(x) {
        if x > 0 then return x;
        else return -x;
    }
}

This namespace gets compiled as:

abstract class math {
    public:
        
    static const E = 2.718281828459045;
    
    static function abs(x) {
        if x > 0 then return x;
        else return -x;
    }
    
    private:
    constructor(){
        throw "namespaces can not get instanted";
    }
}

As we can see namespaces are transformed into non instantiable or inheritable classes with only static members.
The same concept of to-Type-conversion also applies to enums, where the enums constants are static constants in that enum.

About

A reimplementation of the Tscript programming Language, originally by Tobias Glachmachers (reference implementation:https://github.com/TGlas/tscript/).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors