Coder Social home page Coder Social logo

snowball-lang / snowball Goto Github PK

View Code? Open in Web Editor NEW
66.0 3.0 6.0 7.6 MB

๐Ÿฑ Anything that can be written in Snowball, will eventually be written in Snowball

Home Page: https://snowball-lang.gitbook.io/docs/

License: Other

C++ 63.92% CMake 2.60% Nix 0.78% Swift 0.16% Shell 0.64% C 31.55% CoffeeScript 0.18% Python 0.16%
compiler programming-language llvm-compiler llvm-frontend object-oriented-programming snowball-lang

snowball's Introduction

Snowball

A fast, high-level programming language ๐Ÿฑ

Snowball provides a high-level, easy-to-use syntax for writing fast, efficient code. It is designed to be easy to learn and use, while still providing the performance of a low-level language.



One example to prove itself

Object-oriented programming, high-level abstractions, and low-level control are all possible with Snowball. Here's a simple example to demonstrate its capabilities:

// Generics and interface bound checks
func print<T: ToString>(x: T) {
  // A simple yet powerful standard library
  std::io::println(x);
}

func main() {
  let mut a; // Mutability safety
  a = 10; // Type safety and type inference
  let b = a; // Borrowing and immutability
  print(b); // Type inference to its best
}

snowball's People

Contributors

amukh1 avatar emm312 avatar karkutsi avatar mauro-balades avatar perigord-kleisli avatar xqzk avatar y9rabbito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

snowball's Issues

Support for all ABIs

extern "C" fn hello();
extern "system" fn hello();
extern "cdecl" fn hello();
extern "win64" fn hello();
extern "sysv64" fn hello();
extern "snowball" fn hello();

Return non-pointer as direct value

error: (LLVM internal error) Function return type does not match operand type of return inst!
  ret %"class._$SN&10StringViewCv15436ClsGStA1T4charClsE"* %3, !dbg !86
 %"class._$SN&10StringViewCv15436ClsGStA1T4charClsE" = type { i32, i32, i8* }

This shoudn't be allowed

class MyClass {
  pub:
    let mut a: i32 = self.a;
    MyClass() {
    }
}

or even

class MyClass {
  pub:
    let mut a: i32 = self.b;
    let mut b: i32 = self.a;
    MyClass() {
    }
}

Todo for v1.0.0

Todo

  • constant
  • Add a preprocesor
  • handle if function returns void, it can't be used as variable
  • test for all operators
  • default return type
  • Add readonly variables for classes
  • check if class has been initialized
  • call public function or private e.g. (pub)function()

Known Bugs

  • Check if class function is already defined
  • Generics for class functions
  • Generics kinda not work when there are arguments.
  • Check if namespaces/modules are the same while checking if var/func is private
    • Index node
    • identifier node
  • Generic functions 'type "T" doe snot exist!'
  • Compiler errors/Warnings don't work

None important

  • Add a Any type

In Progress

  • Add all operators missing
  • Attributes
  • Add a generic system
    • Functions
    • Classes
    • Default types
    • Infer types without explicitly typing it
  • Modules
    • if library ends with .so, dlopen
    • check entry with a *.json
    • add a System class for I/O
    • add system/local modules support
    • custom variable/selected imports
  • Classes
    • Class/static keyword
    • Parse class
    • Parse class
      • Function
        • Support for static
        • Public methods diferentiate from private methods (can have the same name)
      • Variables
        • Support for static
    • Generate
      • Struct type
      • Functions
      • Variables
      • Self variable
    • Call static methods
    • Inheritance
      • generate struct with parent fields
      • Generate parent's functions/variables if they don't exist
      • virtual tables/functions
    • Add new keyword support
    • Add all default override methods

Done โœ“

  • Variables
  • Function mangling
  • rework for operators
  • global variables
  • Function creation
    • Function arguments
  • change location for OPTypes struct inside BinOP node
  • Comments
    • Normal
    • Multilines
  • Function return types
  • return statement
    • parse return statemnt
    • generate return stmt
    • check if type of return is equal to function's return type
  • Generate class function to scope before generating blocks
  • change all compiler error to call macro COMPILER_ERROR
  • Perform function calls
    • pass arguments
    • pass self argument if it is a class
    • check if function class is initiated
      • check if function is static
  • New keyword
  • API
    • Add a new class
      • Add a function to class
    • Add a function
    • Add class/function to global
  • add optimizations
  • Let user choose in 32/64 bits numbers
  • alloca should not really be in the enviroment
  • Unit testing
    • Add test keyword
    • Parse test statement
    • check for -t argument
    • add TestingContext class
    • Generate test statement
    • Execute tests
    • return result variable as int
    • Add things like assert
  • Add a Void type
  • Int class
    • Different types of integers
  • String class
  • Some "built in type" constructors are not found (sometimes)
  • change commands to separated folder/file
    • compile
    • build
    • unit testing

Todo for v1.0.0

Todo

  • constant
  • #68
  • handle if function returns void, it can't be used as variable
  • test for all operators
  • default return type
  • #177
  • Check if class has been initialized
  • For loops
    • Iterator-loops support
    • #122
  • #72
  • #66
  • #65
  • #213
  • #204
  • #186
  • #60
  • #58
  • Loop flow
  • #69
  • #34
  • #37
  • #63
  • #162
  • #74
  • #160
  • Interfaces
  • #75
  • Macro implementations
  • #38
  • #130
  • #173
  • #33
  • #32
  • #55
  • #76
  • #77
  • #56
  • Check module boundaries
  • Add a generic system
    • Functions
    • Classes
    • Default types
    • Infer types without explicitly typing it
  • Modules
    • #145
    • #91
    • add a System class for I/O
    • add system/local modules support
    • #87
  • Classes
    • Class/static keyword
    • Parse class
      • Function
        • Support for static
      • Variables
    • Generate
      • Struct type
      • Functions
      • Variables
      • Self variable
    • Call static methods
    • #25
    • Add new keyword support
    • Add all default override methods
  • Variables
  • Function mangling
  • global variables
  • Function creation
  • Comments
    • Normal
    • Multilines
  • Function return types
  • return statement
    • parse return statement
    • generate return stmt
    • check if the type of return is equal to the function's return type
  • Perform function calls
    • pass arguments
    • pass self-argument if it is a class
    • Check if function class is initiated
      • Check if function is static
  • New keyword
  • API
    • Add a new class
      • Add a function to class
    • Add a function
  • add optimizations
  • Let user choose in 32/64 bits numbers
  • Add a Void type
  • Int class
    • Different types of integers
  • String class
  • change commands to separated folder/file
    • compile
    • build
    • unit testing
  • CHeck if class items can be accessed from private contexts
  • Handle override virtual functions
  • #31
  • #114
  • Non-pointer class instances
  • Structs
    • Define and use structs
    • #57
  • Documentation generator
  • #181
  • #183
  • Enums
  • #217

Known Bugs

None Important

Check for attributes

e.g. there can't be "inline" and "no_inline" at the same time

also no_mangle and export.

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.