Giter Club home page Giter Club logo

plang's Introduction

Plang

The new language for programming Arduino platform.

Example:

module Main where
import Core
import Core.Native.List

class TestClass do
  arr: ptr list<int>

  TestClass do
    pass

  TestClass arr: ptr list<int> do
    this|arr = arr

Main -> int do
  arr = [int|]
  arr.add(12)
  tArr = TestClass(arr)
  arrPtr = tArr.arr
  if arrPtr? then
    for i in arr do
      println(i)
  ret 0

plang's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

plang's Issues

implement Scopes

Catalogue and store basic information about variable, function and class declarations.
Provide a mechanism for referring to a variable from an exact scope - this variable may be eclipsed by variable from a higher level scope.

fix checking generics in classes

Right now operations on generic types are check before generic type is defined, so it caused errors.

Solution

During class checking skip errors caused by undefined generics and check those classes again during class initialization, when generics are given.

Indexing declared names

How to check:

  • if a given name was declared before use
  • if a variable was initialized before and now should be only reassigned or maybe it is the first assignation

Memory allocation deduction mechanism

Continuation of issue #10 (Handle pointers)
I hope that I will be able to merge ptr and ref keywords in the future, so new ref keyword will offer functionality of them both. But to do this I probably will need to prepare a deduction mechanism that will gather information how the variable is used in the code. Because when there is no need to allocate object on the heap (making reference of object is enough), the reference will be created. Otherwise when the object is allocated on the stack and we need to have it on the heap, a pointer should be created.

[C++ error] capture lambda don't work with function ptr

Solution

  1. Use auto when assign lambda.
  2. Store lambda inside class with template and use function to create new instance of such class.
template <typename T>
class Task{
   T callback{};
   Task(T callback) : callback(callback){};
};
template <typename T>
Task newTask(T callback){
   return Task(callback);
}

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.