Rework a bit

This commit is contained in:
Dennis Felsing 2015-02-20 03:05:46 +01:00
parent 4f5760fb33
commit 37cabd8d1d
1 changed files with 88 additions and 58 deletions

View File

@ -13,6 +13,8 @@ The following list of projects are just some ideas that the community and the de
# Projects
## Table of Contents
## Nim Compiler
#### Create a new REPL for Nim using TinyCC
@ -23,19 +25,23 @@ The following list of projects are just some ideas that the community and the de
A REPL (read-eval-print loop) can be a valuable tool while exploring a
language, new libraries and during regular development, as it allows faster
feedback. Nim provides a simple REPL (nim i) based on its compile-time virtual
machine, but it is not adequate. For example importing C based code does not
work.
feedback. Nim provides a simple REPL (`nim i`) based on its compile-time
virtual machine, but it is not adequate. For example importing C based code
does not work.
An alternative approach is the development of a new REPL that actually compiles
the entered code to C and then uses TinyCC to immediately execute this code.
TinyCC is well suited for this as it can execute C code very quickly.
the entered code to C and then uses the [TinyCC
compiler](http://bellard.org/tcc/) to immediately execute this code. TinyCC is
well suited for this as it can execute C code very quickly and can be used as a
library.
**Tasks:**
* Add a simple TinyCC based REPL for Nim.
* Add a simple TinyCC based REPL for Nim. Recompile all declarations (procedures, global variables) that were entered before for simplicity.
* Ensure that global state (that is: state stored in global variables) is kept during recompilations of the generated C code. This means the C codegen needs to emit some kind of getters and setters for global variable access.
* Make sure common Nim code works as well as importing C based libraries
* Investigate how to reduce the overhead to improve performance
* Make sure common Nim code works as well as importing C based libraries.
* Investigate how to reduce overhead to improve performance.
**Expected Result:** A working Nim REPL that makes development easier.
**Difficulty:** Medium to Hard
@ -62,13 +68,16 @@ provides configuration for the code generator and implements the logic of the ga
**Bonus points:** Implement simple forms of variety of GC algorithms as a proof-of-concept
**Expected Result:**
**Difficulty:** Medium to Hard
**Mentor:** zahary ([@zah](http://github.com/zah))
___
#### Add a code generator for OpenCL
**Desirable skills:** Good OpenCL knowledge, knowledge of the compiler internals, basics of type theory.
**Desirable skills:** Good OpenCL knowledge, knowledge of the compiler internals, basics of type theory.
**Description:**
@ -76,15 +85,14 @@ Nim currently supports C, C++, Objective C and JavaScript code generation. Howev
The vision is a ``gpu`` pragma that means a proc and all of its dependencies are translated into OpenCL instead of C but can be invoked from ordinary Nim code that is translated to C. The ``gpu`` code generator is allowed to only translate a subset of Nim, in particular things like function pointers that are not supported by OpenCL do not have to be supported. The compiler should produce a clean error message for unsupported features.
**Expected Result:** The GPU code generator works on a selected set of examples/test cases.
**Tasks:**
* Add support for new pointer types in the compiler like ``global``, ``private``.
* Add support for work groupss.
* Add support for work groups.
* Add support for the ``gpu`` pragma that translates to the OpenCL, version 2: https://www.khronos.org/registry/cl/sdk/2.0/docs/man/xhtml/
**Bonus points:** Support version 1.2 of the OpenCL specification: https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/. This should be significantly harder as version 1.2 doesn't support a shared address space with the host environment.
**Expected Result:** The GPU code generator works on a selected set of examples/test cases.
**Difficulty:** Hard
@ -99,10 +107,13 @@ ___
Nim has a JavaScript backend, which allows one to write the backend as well as
frontend in Nim. The JS backend is simple, so this is a good way to get started
with learning about Nim compiler internals.
with learning about Nim compiler internals. Some JavaScript bugs have been
[reported](https://github.com/Araq/Nim/labels/JS) already, other bugs and
missing features can be found by running [many small
examples](https://github.com/def-/nim-unsorted) with the JS backend.
**Tasks:**
* Fix the remaining JavaScript backend bugs.
* Fix JavaScript backend bugs.
* Port relevant parts of the standard library to JS.
* Make the code generator emit "source maps" for better debugging support. The current debugging support is done by emitting stack tracing instructions which slow things down and are not standard.
* Make JS test cases.
@ -111,6 +122,8 @@ with learning about Nim compiler internals.
* Speed up the JavaScript backend by targetting `asm.js`
* Write a library for communication between client-side Nim (compiled to JavaScript) and server-side Nim (compiled to C).
**Expected Result:** Nim becomes more usable for client-side website development.
**Difficulty:** Medium
**Mentor:** Araq ([@Araq](https://github.com/Araq)), def- ([@def-](http://github.com/def-))
@ -118,6 +131,8 @@ with learning about Nim compiler internals.
___
#### A strong theoretical foundation for Nim's parallel statement
**Desirable skills**: Knowledge of optimizers.
**Description:**
Nim uses a fresh idea to model fork&join parallelism via its ``parallel``
@ -157,8 +172,7 @@ Here is a sketch of a possible implementation:
* In addition to that it needs to be proven that the code is free
of "write after write" or "write after read" etc. conflicts.
**Desirable skills**: Knowledge of optimizers.
**Expected Result:** An implementation of the polyhedral model for the parallel statement.
**Difficulty:** Hard
@ -166,7 +180,8 @@ Here is a sketch of a possible implementation:
## Standard Library
#### Enhance and expand standard library documentation
#### Enhance and expand the standard library documentation
**Desirable skills:** Basic writing and documentation skills, webdesign and infrastructure setup.
**Description**:
@ -177,15 +192,16 @@ the docs](https://readthedocs.org/) is a good example of attractive as well as
readable documentation, it is something we would be after in this project.
Additionally the documentation should be generated more automatically. The
documentation of each nimble package should automatically be available online,
similar to Hackage. Upon installation of a library with nimble, its
documentation should be installed on the system as well.
documentation of each [nimble](https://github.com/nim-lang/nimble) package
should automatically be available online, similar to Hackage. Upon installation
of a library with nimble, its documentation should be installed on the system
as well.
**Tasks:**
* Ensure that documentation exists for all public methods and modules.
* Add code examples to all modules and to all procedures (where appropriate).
* Add search capabilities to the online documentation.
* Ensure that documentation exists for all public methods and modules
* Add code examples to all modules and to all procedures (where appropriate)
* Add search capabilities to the online documentation
* Improve the website design and usability
* Add cross-linking capabilities in nim doc
* Make nimble build and install the documentation locally so you have
@ -195,37 +211,34 @@ documentation should be installed on the system as well.
**Bonus Points:**
* Implement testing of the examples in the documentation into the ``testament`` test suite.
**Difficulty:** Easy to Medium
**Expected Result:** Documentation of Nim is improved, can be used more easily
**Difficulty:** Easy to Medium (depending on the scope)
**Mentor:** def- ([@def-](http://github.com/def-))
___
#### Xpath like support for macros
**Desirable skills:**
**Description:**
TODO: Fill out
**Expected Result:**
**Difficulty:** ...
**Mentor:** Araq ([@Araq](http://github.com/Araq))
___
#### MPI support
Message Passing Interface (MPI) is a portable system for writing highly
parallel programs. Nim, with its excellent performance/productivity ratio, would
make a great language for this use.
parallel programs. These programs can run on a single computer as well as on a
whole cluster, where messages are sent over the network. Nim, with its
excellent performance/productivity ratio, would make a great language for this
use. What's missing is a Nim library to make use of the existing MPI libraries
for C. An existing C library like OpenMPI can be wrapped using `c2nim` to get a
non-idiomatic low level wrapper for MPI. Since the MPI interface is very
verbose, and to make its use feel more Nim-like, a high level library should
then be written.
**Tasks**:
* Create a low level wrapper of a C library for the MPI standard using c2nim
* Create a low level wrapper of a C library for the MPI standard using `c2nim`
* Write a high level abstraction library for comfortable MPI in Nim
* Implement simple programs/benchmarks using this MPI library, demonstrating its usability and performance
* Test the created libraries and publish them
**Difficulty:** Medium
**Expected Result:** Nim programs can be make use of MPI parallelization
**Difficulty:** Easy
**Mentor:** def- ([@def-](http://github.com/def-))
@ -240,9 +253,14 @@ Something similar would be nice to have in Nim, where we have additional
freedoms, like case insensitivity, that should be handled in a consistent way
for big projects.
**Tasks**:
There is already a converter from AST to Nim code in
[renderer.nim](https://github.com/Araq/Nim/blob/devel/compiler/renderer.nim),
that is used for `repr` as well as `c2nim`. It would make sense to use and
extend this or at least use it as inspiration.
* Write a `nimfmt` tool
**Bonus points:** Make it possible to specify the coding style in some way, so that a project can choose a common style to use.
**Expected Result:** A `nimfmt` tool that can be used to convert Nim code
**Difficulty:** Medium
@ -254,13 +272,13 @@ ___
**Desirable skills:** Knowledge of C
**Description**:
Nim's c2nim tool helps create nim bindings for C libraries. However, c2nim does not parse the whole C language, and is not currently supposed to import whole APIs into nim mechanically, but rather to serve as a starting point for manual definition of interfaces to C libraries. c2nim is particularly effective in dealing with C's preprocessor macros, but is
Nim's [c2nim tool](https://github.com/nim-lang/c2nim/) helps create Nim bindings for C libraries. However, c2nim does not parse the whole C language, and is not currently supposed to import whole APIs into Nim mechanically, but rather to serve as a starting point for manual definition of interfaces to C libraries. c2nim is particularly effective in dealing with C's preprocessor macros, but is
not currently capable of parsing many C header files.
Make c2nim accept more C declarations than it currently does, and produce corresponding Nim declarations. This can be done either by directly filling-in the missing capabilities, or by interfacing it with a mature tool for parsing C code, such as LLVM's CLang or the GCC-XML tool. If one of these tools is used, then it is expected that it would not suffice by itself, but rather augment the current c2nim parser, since these tools have their own limitations. A possible implementation might pass
the header file once through gcc-xml to parse C declarations, and would use the current c2nim parser on lines that start with '#' to parse preprocessor definitions. c2nim would then process the parsed headers and produce constants, types, macros and proc declarations similar to those that it produces now.
Make c2nim accept more C declarations than it currently does, and produce corresponding Nim declarations. This can be done either by directly filling in the missing capabilities, or by interfacing it with a mature tool for parsing C code, such as LLVM's Clang or the GCC-XML tool. If one of these tools is used, then it is expected that it would not suffice by itself, but rather augment the current c2nim parser, since these tools have their own limitations. A possible implementation might pass
the header file once through GCC-XML to parse C declarations, and would use the current c2nim parser on lines that start with '#' to parse preprocessor definitions. c2nim would then process the parsed headers and produce constants, types, macros and proc declarations similar to those that it produces now.
C comments should be converted into nim documentation where appropriate.
C comments should be converted into Nim documentation where appropriate.
Although c2nim currently converts function implementations (and not only declarations), this functionality is outside the scope of this task.
@ -268,17 +286,21 @@ Although c2nim currently converts function implementations (and not only declara
Depending on the chosen implementation technique, the tasks would be either:
* detect individual deficiencies in c2nim support for .h files and fix them
or:
* interface with a feature-complete parser for C, such as that of GCC or CLANG.
* interface with a feature-complete parser for C, such as that of GCC or Clang.
* refactor c2nim so that it can generate declarations from the parsed output of the above parser, rather than directly from .h files as it currently does.
* combine the output from the previous task with the declarations that c2nim produces for preprocessor macros.
**Difficulty:** Medium
**Expected Result:** A selection of .h files that can be translated more automatically into Nim wrappers
**Difficulty:** Easy to Medium (depending on scope)
**Mentor:** Araq ([@Araq](https://github.com/Araq)), def- ([@def-](http://github.com/def-))
___
#### Implement re2nim, a lexer generator for Nim
**Desirable skills**: Knowledge of lexer generators. How to translate regexes into DFAs and how to optimize the resulting automatons.
**Description:**
Lexer generators are useful tools for writing all sorts of parsers. Currently Nim lacks a native Lexer generators. This project involves the implementation of a lexer generator. It should be modelled after [re2c](http://re2c.org/) or alternatively it can be based on the wide number of existing lexer generators such as Flex.
@ -290,19 +312,27 @@ Here is a sketch of a possible implementation:
* Minimize the DFA with Hopcroft's algorithm: http://en.wikipedia.org/wiki/DFA_minimization
* Translate the DFA into Nim code and attach the actions.
**Desirable skills**: Knowledge of lexer generators. How to translate regexes into DFAs and how to optimize the resulting automatons.
**Expected Result:** A library that can be used to easily create a lexer
**Difficulty:** Medium to Hard
**Mentor:** zahary ([@zah](http://github.com/zah))
___
#### Implement a Nim backend for the Ragel state machine generator
#### Implement a Nim backend for the Ragel state machine compiler
**Desirable skills**: Knowledge of Ragel's internals, C programming.
**Description:**
[Ragel](http://www.complang.org/ragel/) is a "finite-state machine compiler with output support for C, C++, C#, Objective-C, D, Java, OCaml, Go, and Ruby source code." This project involves the implementation of a Nim backend for Ragel. This can be based on the large number of pre-existing backends listed previously.
[Ragel](http://www.complang.org/ragel/) is a "finite-state machine compiler with output support for C, C++, C#, Objective-C, D, Java, OCaml, Go, and Ruby source code." This project involves the implementation of a Nim backend for Ragel. This can be based on the large number of pre-existing backends listed previously. Ragel itself is written in C, so C programming should be familiar to you. Ragel embeds code in the backend language directly and then generates a regular source code file from this. Ideally the new Nim backend would end upstream in Ragel, but alternatively we can maintain it ourselves.
**Desirable skills**: Knowledge of Ragel's internals.
**Tasks:**
* Become familiar with the template format used by Ragel and Ragel internals by studying how it works with other language backends
* Implement a Nim backend for Ragel
* Create interesting test cases to show how to use Ragel for protocol implementations, data format parsing, lexical analysis, ...
**Expected Result:** Easy to use finite state machines in Nim
**Difficulty:** Easy
@ -317,12 +347,12 @@ Please add your project ideas in the following format.
#### Title
**Desirable skills:**
**Desirable skills:**
**Description:**
**Expected Result:**
**Expected Result:**
**Difficulty:** ...
**Mentor:** Mentor name ([@MentorName](http://github.com/MentorName))
**Mentor:** Mentor name ([@MentorName](http://github.com/MentorName))