/*
DO NOT IMPORT THIS FILE
DO NOT IMPORT THIS FILE
DO NOT IMPORT THIS FILE

Module `lang`

Visible to IDEs and documentation tools,
NOT importable, NOT executable as a real module.

Library/lang/lang.fig

Copyright © 2025 PuqiAR. All rights reserved.
*/


// values

var null: Null;

var true: Bool;
var false: Bool;


// Error interface

public interface Error
{
    toString() -> String;
    getErrorClass() -> String;
    getErrorMessage() -> String;
}

public struct TypeError
{
    public msg: String;
}

impl Error for TypeError
{
    toString()
    {
        return "TypeError: " + getErrorMessage();
    }
    getErrorClass()
    {
        return "TypeError";
    }
    getErrorMessage()
    {
        return msg;
    }
}

// Operation interface

public interface Operation
{
// math
    Add(T, T) -> T;
    Sub(T, T) -> T;
    Mul(T, T) -> T;
    Div(T, T) -> T;
    Mod(T, T) -> T;
    Pow(T, T) -> T;

// logic
    Neg(T) -> T;
    Not(T) -> T;

    And(T, T) -> T;
    Or(T, T) -> T;

// comparision
    Equal(T, T) -> T;
    NotEqual(T, T) -> T;
    LessThan(T, T) -> T;
    LessEqual(T, T) -> T;
    GreaterThan(T, T) -> T;
    GreaterEqual(T, T) -> T;
    Is(T, T) -> T;

// Bit
    BitNot(T) -> T;

    BitAnd(T, T) -> T;
    BitOr(T, T) -> T;
    BitXor(T, T) -> T;
    ShiftLeft(T, T) -> T;
    ShiftRight(T, T) -> T:
}

public struct Any {}
public struct Int {}
public struct Null {}
public struct String {}
public struct Bool {}
public struct Double {}
public struct Function {}
public struct List {}
public struct Map {}