Giter VIP home page Giter VIP logo

bobascript's Introduction

BobaScript

Crates.io CI Open in VS Code Matrix

a nice, cold, refreshing scripting language built in Rust, with some fun little gimmicks!

tell me more

ok here's the jist of my plans:

  • inspired by TypeScript and Rust! has very Rust-like syntax and is expression-based, but has modern JavaScript-like elements such as tuples and records. a type system like TypeScript's is planned!
  • built with several use-cases in mind! from embedding it in your own app to building web apps in it, BobaScript has you covered! build server side rendered apps PHP-style using BSX, or compile it to either WASM or modern JavaScript!
  • we don't know the concept of null values! I've never even heard of them, personally! in this language anything that doesn't return a value just returns an empty tuple by default! I also plan on introducing Option types when the type system gets thrown in.

these are all subject-to-additions as I work on this, but never removals or changes! I, the person who hasn't worked in lang dev before, will be stubbornly sticking to my guns on at least those three points

this is ridiculous and pointless

that's just, like, your opinion, man!

bobascript's People

Contributors

sand-head avatar

Stargazers

 avatar  avatar

Watchers

 avatar

bobascript's Issues

Type system

I want a type system like TypeScript's that makes me feel all-powerful and godlike in defining the structure of my objects. is that so much to ask?

initial concept:

type Option<T> = enum {
  Some(T),
  None,
};

type DataWrapper<T> = #{
  "data": T
};

type TwitchUser = #{
  "id": String,
  "login": String,
  "display_name": String,
  "type": String,
  "broadcaster_type": String,
  "description": String,
  "profile_image_url": String,
  "offline_image_url": String,
  "view_count": Number,
  "email": String,
  "created_at": String,
};

fn get_user(id: Number): Option<DataWrapper<TwitchUser>> {
  let user = // get the user from the Twitch API somehow...
  user
};

// `user` is inferred to be of type `Option<DataWrapper<TwitchUser>>`
let user = get_user(141981764);
if let Some(user) = user {
  log("we got a user!");
} else {
  log("we probably have to refresh our key...");
};

Block expressions in binary operations are wonky and cause errors

the following code throws a type error at runtime:

let test = "1" + {
  let test2 = 15;
  test2 / 3
};

this is the debug result:

== code ==
0000 #0001 Constant 0001 "1"
0001 #0002 Constant 0002 15 
0002 #0003 GetLocal(0)      
0003 #0003 Constant 0003 3  
0004 #0003 Divide
0005 #0004 Pop
0006 #0004 Add
0007 #0004 DefineGlobal(0)
0008 #0004 Return

0001 #0001 Constant 0001 "1"
        ["1"]
0002 #0002 Constant 0002 15
        ["1"][15]
0003 #0003 GetLocal(0)
        ["1"][15]["1"]
0004 #0003 Constant 0003 3
        ["1"][15]["1"][3]
0005 #0003 Divide
[!] Runtime error: Type error: expected value of type "number", found "1".

resolving locals doesn't work when there are other values in the stack, as it recognizes 15 as the value of the first local and assumes it to be at stack index 0, when it isn't. this is probably covered in the book during the function chapter but I haven't read it yet

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.