GithubHelp home page GithubHelp logo

3f / sobascript Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 78 KB

Extensible Modular Scripting Programming Language -- #SobaScript

License: MIT License

C# 87.70% Batchfile 12.30%
programming-language scripting-language interpreter sobascript soba script-engine vssbe vssolutionbuildevent sbe-scripts embedded

sobascript's Introduction

Interpreted Embedded Domain Specific a Weakly Typed an Extensible at runtime Modular Scripting Programming Language -- #SobaScript.

Build status release-src License NuGet package Tests

Build history

License

Licensed under the MIT License

Copyright (c) 2014-2019  Denis Kuzmin < [email protected] > GitHub/3F

[ โ˜• Donate ]

SobaScript contributors: https://github.com/3F/SobaScript/graphs/contributors

#

#["
    #SobaScript in action
"]
#[var v = 1.2.3]
#[$(log = "$(TMP)/v.txt")]

#[($(Configuration) ~= Deb || true)
{
    #[var tBase     = $([System.DateTime]::Parse('2019/08/01').ToBinary())]
    #[var tNow      = $([System.DateTime]::UtcNow.Ticks)]
    #[var revBuild  = #[$(
        [System.TimeSpan]::FromTicks('$(
            [MSBuild]::Subtract(
            $(tNow), 
            $(tBase))
        )')
        .TotalMinutes
        .ToString('0')
    )]]
    
    #[var v = $(v).$([MSBuild]::Modulo($(revBuild), $([System.Math]::Pow(2, 14))))]
}]

#[var v = $([System.String]::Format("v{0}\r\n\t", $(v)))]

#[try
{ 
    #[File write("#[var log]"):> Example #[var v] Generated by a vsSBE]
    #[IO scall("notepad", "#[var log]")]
}
catch(err, msg)
{
    $(err) - Type of Exception
    $(msg) - Error Message
}]

Can be closely integrated with E-MSBuild:

#[$(
    [System.Math]::Exp('$(
        [MSBuild]::Multiply(
            $([System.Math]::Log(10)), 
            4
        ))'
    )
)]

Or even be loyal to your any preferences on the fly ๐Ÿ”ง.

Syntax and features

evaluation region (container) escaping
#[ โ€ฆ ] ##[ โ€ฆ ]

Arguments

Although SobaScript is a weakly typed, internally it operates with the following types by default* (means you can still extend something through new component):

type description
integer Signed 32-bit integer
string Both types: From "double quotes" & From 'single quotes'.
char
float Signed floating-point number with single-precision. The f postfix for clarify: 1.25f, -1.25f
double Signed floating-point number with double-precision. The optional d postfix for clarify: 1.25d or simply 1.25, -1.25
enum
const
object
bool
mixed Unspecified mixed data
expression An composite definition like a conditional expression ~ `(((1 < 2) && true)

Object type

The object type is a type for work with complex mixed data.

Value can be from all available scalar types + complex, like this:

{}
{"str", true}
{"str", {1, 'y', {-12.457f}}, true}
...

Boolean type

Allowed forms:

true false
1 0
True False
TRUE FALSE
true false

In (Input) type

This is unspecified or mixed type of data. To consider data 'as is'. As for string arguments may contain other inner containers that will be evaluated before.

It's safe only for pair symbols of container. For unpaired you need either place your data inside string argument or use special marker <#data> โ€ฆ </#data>

Custom extending via IPM analyzer

IPM pm = new PM(raw)

Where raw it's your raw data 'as is'. After, you can work with parsed data via pm instance.

For example, how about this:

#[Func hash.SHA1("test")]

here's complete minimal logic:

IPM pm = new PM(data); // pointed to - ILevel lvlHash
// hash.SHA1("data")
if(pm.FinalEmptyIs(LevelType.Method, "SHA1"))
{
    lvlHash.Is("hash.SHA1(string data)", ArgumentType.StringDouble);
    return ((string)lvlHash.Args[0].data).SHA1Hash();
}

That's all. Now you can calculate hash value from user scripts with allowed syntax above.

It can be a more flexible, just use other available way: SNode.IPM

third-party projects

SobaScript - https://github.com/3F/SobaScript

Uses the following third-party projects:

*


#SobaScript ใ€Ž ่•Ž้บฆ, enjoy your meal ใ€

`, aka SBE-Scripts aka vssbe scripts

sobascript's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.