Code Monkey home page Code Monkey logo

kos's People

Contributors

cdragan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kos's Issues

core: add basic optimisations

  • Constant expression folding, including immutable constants.
  • Basic dead code elimination (with a warning).
  • Unused variable elimination (with a warning).

interpreter: pass script on command line or stdin

  • Add argument -c to pass a script on the command line.
  • ? In case of a script passed with -c, lang module should be automatically included.
  • Also add another argument (just a dash?) to read a script from stdin. No default import needed here.

tests: check coding style

Write a Kos script which checks coding style.

Update source code to correct any coding style errors.

core: improve float parsing

The current routine used for extracting doubles from strings has a minor roundoff error when the number of digits reaches the limits of double precision.

core: pass stack frame to functions, don't use TLS for exception status

Pass stack frame pointer instead of context pointer.

Require all threads invoking Kos functions to be registered. KOS_get_stack_frame() invoked to obtain a stack frame pointer should take care of registering automagically.

In debug builds: assert if current thread is not the thread registered in the stack frame.

Allocate stack frames from a buffer (except for stack frames for generators). Initial measurements suggest that we spend a lot of time allocating stack frames.

Keep exception status in the stack frame. Initial measurements suggest that TLS access is too slow for that.

Consider keeping registers in stack frame as well, or alternatively keeping them in a growable register array (except independent variables and generators).

tests: add thorough negative tests

Run one script (or multiple if necessary) multiple times, with an error index passed on the command line, incremented on every run. All conditions which can possibly fail should be ordered an each error condition should fail on subsequent runs.

This will require building interpreter/lang/modules with a special flag.

unicode: add unicode support

Consider adding unicode support in 'unicode' module.

Some amount of memory may be required for unicode tables, so it may make sense to put this in a module.

An alternative is to support it in core.

Consider parsing the public Unicode tables, e.g.:
http://www.unicode.org/Public/9.0.0/ucd/UnicodeData.txt
to extract lowercase/uppercase relations and ordering (for lexicographical sorting).

core: add printf abstraction

Add _KOS_printf function which can be re-implemented when embedding Kos if needed.

All code in Kos should use it for all internal prints.

Consider it also for any stdout interaction.

core: implement garbage collector

  • Two ways of collecting garbage: scavenge (frequent) and full (rare).
  • Objects (most?) allocated in a scavenged pool.

Problem to solve: how to handle external calls, native functions and objects held by C functions without races?

One possibility: individual short-lived (scavenged) heaps for each thread.

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.