No description
Find a file
2022-10-17 09:25:55 -04:00
.github Write a new workflow for Windoes 2022-03-19 21:58:29 -05:00
benchmarks Update benchmarks/README.md 2022-04-12 10:12:23 -05:00
docs Update the docs about the compiler 2022-04-07 19:19:21 -05:00
editor Update the Vim highlighter 2022-03-19 22:37:51 -05:00
lib Move some files to src/obj directory 2022-04-10 21:46:37 -05:00
samples Add samples 2022-03-22 11:11:51 -05:00
src Fix type built-in function 2022-04-14 00:42:45 -05:00
tests Add tests for os and io libraries 2022-03-21 18:41:15 -05:00
.gitignore Update the .gitignore 2022-03-22 23:11:19 -05:00
build.bat Create build.bat 2022-02-21 23:21:14 -06:00
build.sh Update build.sh 2022-03-12 20:57:11 -06:00
LICENSE Create LICENSE 2022-02-16 23:34:02 -06:00
README.md Update README.md 2022-10-17 09:25:55 -04:00
SLAP.nimble Update SLAP.nimble 2022-03-24 20:18:04 -05:00

The SLAP Programming Language

| Doc |

Ubuntu macOS Windows

WARNING!! THIS LANGUAGE IS IN DEVELOPMENT (AND FOR LEARNING PURPOSES). ANYTHING CAN CHANGE AT ANY MOMENT.

🖐 SLAP stands for "SLow And Powerless." And I hope to make it "Powerful" 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).

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

  • Basic Data Types
    • Integer
    • Float
    • String
    • Boolean
    • Null
    • List
    • Map
  • Basic Arithmetics
  • Variables
  • If Statements
    • elif
    • else
  • While Loops
  • For Loops
    • Break
    • Continue
    • "Enhanced" for loop (in the form of forEach)
  • Try-except Blocks
  • Functions
    • Lambdas (anonymous functions)
    • Default Arguments
    • Rest Parameters
  • Standard Library
    • Std
    • String
    • OS
    • I/O interfaces
    • Math
    • Networking
  • Classes
    • Class Methods
    • Inheritance
    • Abstract Class (Interface)
  • Import
  • Concurrency
  • Virtual Machine Compiler

Others

  • Assignment Shorthands (e.g, +=, *=)
  • String Interpolation
  • Optional Type Annotations
  • Multi-line Comments
  • Vim Highlighter
  • VSCode Highlighter
  • 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 for more info).

Credits

I learned a lot from