Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fergusq/pscript
PScript is a small programming language
https://github.com/fergusq/pscript
compiler programming-language
Last synced: 27 days ago
JSON representation
PScript is a small programming language
- Host: GitHub
- URL: https://github.com/fergusq/pscript
- Owner: fergusq
- Created: 2016-06-25T17:00:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-22T22:25:18.000Z (almost 7 years ago)
- Last Synced: 2024-11-17T13:20:45.089Z (3 months ago)
- Topics: compiler, programming-language
- Language: Haskell
- Homepage:
- Size: 1.53 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PScript
=======PScript is a small programming language based on a concept called _models_,
which are similar to type classes in Haskell or traits in Rust. To put it
simply, a model is like an interface in Java (a collection of method
signatures). The difference between interfaces and models is that the
implementations of the methods must not be defined when defining a type, since
they can be declared anywhere in the code. One can use models to extend
existing types to support new functionalities.Two of the most striking features of the language are:
* No inheritance
* No classes with methods, only structures with fields, every method comes from
a modelBelow is an example of a model declaration.
```
model Squarable {
$ square();
}extend Int : Squarable {
Int square() {
return this*this;
}
}
```The dollar type `$` represents the type for which the method is implemented,
`Int` in this case.See DOC.md for more information.
## Building
To build the compiler, you need the Happy parser generator and Cabal installed. The program itself has following dependencies:
* base
* containers
* directory
* mtl
* splitCommands:
happy src/Parser.y
cabal build## Features / TODO
### Compiler
- [x] Successfully compiles all tests
- [x] All tests pass
- [x] Module search path
- [ ] Meaningful error messages (half-done)
- [ ] Validation of type parametrized declarations
- [ ] Compiling multiple modules to multiple filesS
- [ ] Disable the exponential growth of size of the resulting C-file when using intersection types### Language
- Modules
- [x] Module declarations
- [x] Importing modules
- [x] Importing external C-functions
- [ ] Header files?
- Literals
- [x] String literals
- [x] Integer literals
- [x] List literals
- [ ] Floating point literals
- [ ] Character literals
- Expressions
- [x] Lambda functions
- [x] Explicit type casts
- [x] Function pointers
- Declarations
- [x] Models
- [x] Extensions
- [x] Model prerequisites
- [ ] Model inheritance
- [x] Structs
- [x] Enums
- Generics
- [x] The dollar type
- [x] Type parametrization of types
- [x] Type parametrization of functions
- Type inference
- [x] Variable type inference
- [x] Type parameter inference
- [x] List type inference
- [x] Lambda type inference
- [ ] Inference using supertypes
- [ ] Inference of object type using method parameters