slap
所属分类:编程语言基础
开发工具:Nim
文件大小:0KB
下载次数:0
上传日期:2022-10-17 13:26:06
上 传 者:
sh-1993
说明: 一种动态和强类型的面向对象编程语言,
(A dynamically- and strongly-typed, object-oriented programming language,)
文件列表:
LICENSE (1073, 2022-10-17)
SLAP.nimble (214, 2022-10-17)
benchmarks/ (0, 2022-10-17)
benchmarks/bubbleSort/ (0, 2022-10-17)
benchmarks/bubbleSort/javascript.js (7498, 2022-10-17)
benchmarks/bubbleSort/julia.jl (7457, 2022-10-17)
benchmarks/bubbleSort/python3.py (7453, 2022-10-17)
benchmarks/bubbleSort/slap.slap (7538, 2022-10-17)
benchmarks/fib/ (0, 2022-10-17)
benchmarks/fib/javascript.js (127, 2022-10-17)
benchmarks/fib/julia.jl (105, 2022-10-17)
benchmarks/fib/python3.py (96, 2022-10-17)
benchmarks/fib/slap.slap (123, 2022-10-17)
benchmarks/prime/ (0, 2022-10-17)
benchmarks/prime/javascript.js (161, 2022-10-17)
benchmarks/prime/julia.jl (117, 2022-10-17)
benchmarks/prime/python3.py (119, 2022-10-17)
benchmarks/prime/slap.slap (159, 2022-10-17)
build.bat (67, 2022-10-17)
build.sh (1214, 2022-10-17)
docs/ (0, 2022-10-17)
docs/_config.yml (103, 2022-10-17)
docs/index.md (1538, 2022-10-17)
docs/slap-to-js-compiler.md (198, 2022-10-17)
docs/syntax_doc/ (0, 2022-10-17)
docs/syntax_doc/classes.md (1203, 2022-10-17)
docs/syntax_doc/comments.md (495, 2022-10-17)
docs/syntax_doc/control_flow.md (1212, 2022-10-17)
docs/syntax_doc/data_types.md (1805, 2022-10-17)
... ...
The SLAP Programming Language
|
Doc
|
[![Ubuntu](https://github.com/bichanna/slap/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/bichanna/slap/actions/workflows/ubuntu.yml)
[![macOS](https://github.com/bichanna/slap/actions/workflows/mac.yml/badge.svg)](https://github.com/bichanna/slap/actions/workflows/mac.yml)
[![Windows](https://github.com/bichanna/slap/actions/workflows/windows.yml/badge.svg)](https://github.com/bichanna/slap/actions/workflows/windows.yml)
**WARNING!! THIS LANGUAGE IS IN DEVELOPMENT (AND FOR LEARNING PURPOSES). ANYTHING CAN CHANGE AT ANY MOMENT.**
**SLAP** stands for "**SL**ow **A**nd **P**owerless." And I hope to make it "**P**owerful" someday.
**SLAP** is a dynamically- and strongly-typed, object-oriented programming language. Its syntax is a member of the C family with a bit of difference.
## Example
As of March 2022, you can write pretty decent, small programs in SLAP.
>*Note*: The SLAP-to-JS transpiler is in progress (see [compiler branch](https://github.com/bichanna/slap/tree/compiler)).
SLAP-to-JS Compiler Example
https://user-images.githubusercontent.com/60306074/162365051-630e6171-93c0-4af5-a55c-c600ae1efa92.mov
## Installation
On Linux/macOS, you may be able to run the following commands to install SLAP.
```
$ git clone https://github.com/bichanna/slap.git
$ cd slap
$ chmod +x ./build.sh
$ ./build.sh # The SLAP Vim highlighter automatically gets installed
```
For Windows, I haven't written bat version of `build.sh`, so you have to manually compile the source code.
```
$ nimble build --multimethods:on -d:release
```
Then, mark it as an executable file if necessary, and try running `slap --version`.
```
$ slap --version
SLAP 0.0.3
```
You may want to test current SLAP you just built before running your programs.
```
$ nimble test
```
## TODO
*Note:* If you have a feature request, please open an issue.
### Main
- [x] Basic Data Types
- [x] Integer
- [x] Float
- [x] String
- [x] Boolean
- [x] Null
- [x] List
- [x] Map
- [x] Basic Arithmetics
- [x] Variables
- [x] If Statements
- [x] elif
- [x] else
- [x] While Loops
- [x] For Loops
- [x] Break
- [x] Continue
- [x] "Enhanced" for loop (in the form of `forEach`)
- [ ] Try-except Blocks
- [x] Functions
- [x] Lambdas (anonymous functions)
- [x] Default Arguments
- [x] Rest Parameters
- [x] Standard Library
- [x] Std
- [x] String
- [x] OS
- [x] I/O interfaces
- [x] Math
- [ ] Networking
- [x] Classes
- [x] Class Methods
- [x] Inheritance
- [ ] Abstract Class (Interface)
- [x] Import
- [ ] Concurrency
- [ ] Virtual Machine Compiler
### Others
- [x] Assignment Shorthands (e.g, `+=`, `*=`)
- [x] String Interpolation
- [ ] Optional Type Annotations
- [x] Multi-line Comments
- [x] Vim Highlighter
- [ ] VSCode Highlighter
- [x] Transpiler (to JavaScript)
- [ ] Newline As Statement Separator
## Contribution
Bug reports and contributions are always welcome :)
Please be sure to add test files if you want to add new features (see [tests directory](https://github.com/bichanna/slap/tree/master/tests#tests) for more info).
## Credits
I learned a lot from
- [Oak programming language](https://github.com/thesephist/oak) by [thesephist](https://github.com/thesephist)
- [Bob Nystrom (munificent)](https://github.com/munificent)'s great book, [*Crafting Interpreters*](https://craftinginterpreters.com/).
近期下载者:
相关文件:
收藏者: