Git Product home page Git Product logo

sll's Introduction

The SL Programing Language

sll logo Sll is a simple yet powerful programing language intended for beginner as well as advanced software developers.

The documentation is located here.

sll's People

Contributors

dependabot[bot] avatar krzem5 avatar mvmo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sll's Issues

Add mapping objects

Add mapping object (ex. <"a" 0 2 [1 3 4]>) as well as object types, printing functions, assembly functions, optimizer funtions, etc.

Caching optimization

Cache results from functions such as ($) or (:) when it is known that no change to the source array/string is made.

Add typed arrays

Add typed arrays (src/sll/lib/typed_array.sll) and matching functions in src/sll/api/typed_array.c. This would speed up array functions as well as decrease memory requirements. Could be linked with #3.

Change build process

Change the build process to build files directly instead of combining them into one file

Inline function calls

Optimize a call to a single-use or fast function by inlining it. For example:

(<- (,,, a b c (@@ (* a b c))) 1 2 3)

Would be optimize into:

(, (= a 1) (= b 2) (= c 3) (* a b c))

(Wait for #43)

Add a function-like operator

Implement an operator ((***)), which will return the value returned by return ((@@)) or nil.

It is similar to calling a single-use function ((<- (,,, |# code #|)))

Evaluate known terms

  • During the optimization process, replace expressions like (+ 2 3 4 5) with 14. This would apply to every mathematical operator.
  • However, expressions like (+ 10 2 a 5 b) should be replaced with (+ 12 a 5 b).

Make string checksums 32-bit values

  • String should be allocated with a length multiple of 8 (bytes)
  • This would allow for quick XOR-ing of the string with an intermediate 64-bit value, which can be later converted to a 32-bit value by a single XOR. When combining, strings checksums can be bit-rotated to match the length offset.

Cleanup stack before/after function call

Cleanup stack if function does not use all of the passed arguments. Insert zeros (SLL_ACQUIRE_STATIC(int_zero)) if function requires more arguments than are passed.

Useless code in parser

Remove useless clean-up code in the parser in locations where it is obvious that no new variable scopes have been created.

This is the following code to remove:

if (n_l_sc.m){
	free(n_l_sc.m);
}

Add array, string and map functions

  • Array function:
    • sll_array_join
    • sll_array_push
    • sll_array_pop
    • sll_array_shift
    • sll_array_unshift
    • sll_array_remove
    • sll_array_remove_multiple
    • sll_array_clone
    • sll_array_resize
    • sll_array_count
    • sll_array_count_multiple
  • String functions:
    • sll_string_join
    • sll_string_remove
    • sll_string_replace
    • sll_string_title_case
    • sll_string_count
  • Map function:
    • sll_map_join
    • sll_map_add
    • sll_map_remove
    • sll_map_clone
    • sll_map_keys
    • sll_map_values

Add a comma operator

Implement a comma ((,)) operator which would execute every statement and return the last one

Implement `src/sll/operator.c`

List of operations to be implemented:

  • sll_operator_inc
    • I
    • F
    • C
    • S
    • A
    • H
    • M
  • sll_operator_dec
    • I
    • F
    • C
    • S
    • A
    • H
    • M
  • sll_operator_add
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C C
    • C S
    • C A
    • C H
    • C M
    • S S
    • S A
    • S H
    • S M
    • A A
    • A H
    • A M
    • H H
    • H M
    • M M
  • sll_operator_sub
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F I
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C I
    • C F
    • C C
    • C S
    • C A
    • C H
    • C M
    • S I
    • S F
    • S C
    • S S
    • S A
    • S H
    • S M
    • A A
    • A *
    • H I
    • H F
    • H C
    • H S
    • H A
    • H H
    • H M
    • M *
  • sll_operator_mult
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C C
    • C S
    • C A
    • C H
    • C M
    • S S
    • S A
    • S H
    • S M
    • A A
    • A H
    • A M
    • H H
    • H M
    • M M
  • sll_operator_div
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F I
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C I
    • C F
    • C C
    • C S
    • C A
    • C H
    • C M
    • S I
    • S F
    • S C
    • S S
    • S A
    • S H
    • S M
    • A A
    • A *
    • H I
    • H F
    • H C
    • H S
    • H A
    • H H
    • H M
    • M I
    • M F
    • M C
    • M S
    • M A
    • M H
    • M M
  • sll_operator_floor_div
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F I
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C I
    • C F
    • C C
    • C S
    • C A
    • C H
    • C M
    • S I
    • S F
    • S C
    • S S
    • S A
    • S H
    • S M
    • A A
    • A *
    • H I
    • H F
    • H C
    • H S
    • H A
    • H H
    • H M
    • M I
    • M F
    • M C
    • M S
    • M A
    • M H
    • M M
  • sll_operator_mod
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F I
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C I
    • C F
    • C C
    • C S
    • C A
    • C H
    • C M
    • S I
    • S F
    • S C
    • S S
    • S A
    • S H
    • S M
    • A I
    • A F
    • A C
    • A S
    • A A
    • A H
    • A M
    • H I
    • H F
    • H C
    • H S
    • H A
    • H H
    • H M
    • M I
    • M F
    • M C
    • M S
    • M A
    • M H
    • M M
  • sll_operator_and
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C C
    • C S
    • C A
    • C H
    • C M
    • S S
    • S A
    • S H
    • S M
    • A A
    • A H
    • A M
    • H H
    • H M
    • M M
  • sll_operator_or
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C C
    • C S
    • C A
    • C H
    • C M
    • S S
    • S A
    • S H
    • S M
    • A A
    • A H
    • A M
    • H H
    • H M
    • M M
  • sll_operator_xor
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C C
    • C S
    • C A
    • C H
    • C M
    • S S
    • S A
    • S H
    • S M
    • A A
    • A H
    • A M
    • H H
    • H M
    • M M
  • sll_operator_inv
    • I
    • F
    • C
    • S
    • A
    • H
    • M
  • sll_operator_shr
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F I
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C I
    • C F
    • C C
    • C S
    • C A
    • C H
    • C M
    • S I
    • S F
    • S C
    • S S
    • S A
    • S H
    • S M
    • A I
    • A F
    • A C
    • A S
    • A A
    • A H
    • A M
    • H I
    • H F
    • H C
    • H S
    • H A
    • H H
    • H M
    • M I
    • M F
    • M C
    • M S
    • M A
    • M H
    • M M
  • sll_operator_shl
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F I
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C I
    • C F
    • C C
    • C S
    • C A
    • C H
    • C M
    • S I
    • S F
    • S C
    • S S
    • S A
    • S H
    • S M
    • A I
    • A F
    • A C
    • A S
    • A A
    • A H
    • A M
    • H I
    • H F
    • H C
    • H S
    • H A
    • H H
    • H M
    • M I
    • M F
    • M C
    • M S
    • M A
    • M H
    • M M
  • sll_operator_len
    • I
    • F
    • C
    • S
    • A
    • H
    • M
  • sll_operator_dup
    • I
    • F
    • C
    • S
    • A
    • H
    • M
  • sll_operator_access
    • S I
    • A I
    • M *
  • sll_operator_access_range
    • S I I
    • A I I
    • M * *
  • sll_operator_access_range_step
    • S I I I
    • A I I I
    • M * * *
  • sll_operator_cast
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • I K
    • I V
    • F I
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • F K
    • F V
    • C I
    • C F
    • C C
    • C S
    • C A
    • C H
    • C M
    • C K
    • C V
    • S I
    • S F
    • S C
    • S S
    • S A
    • S H
    • S M
    • S K
    • S V
    • A I
    • A F
    • A C
    • A S
    • A A
    • A H
    • A M
    • A K
    • A V
    • H I
    • H F
    • H C
    • H S
    • H A
    • H H
    • H M
    • H K
    • H V
    • M I
    • M F
    • M C
    • M S
    • M A
    • M H
    • M M
    • M K
    • M V
  • sll_operator_bool
    • I
    • F
    • C
    • S
    • A
    • H
    • M
  • sll_operator_compare
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F I
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C I
    • C F
    • C C
    • C S
    • C A
    • C H
    • C M
    • S I
    • S F
    • S C
    • S S
    • S A
    • S H
    • S M
    • A I
    • A F
    • A C
    • A S
    • A A
    • A H
    • A M
    • H I
    • H F
    • H C
    • H S
    • H A
    • H H
    • H M
    • M I
    • M F
    • M C
    • M S
    • M A
    • M H
    • M M
  • sll_operator_equal
    • I I
    • I F
    • I C
    • I S
    • I A
    • I H
    • I M
    • F I
    • F F
    • F C
    • F S
    • F A
    • F H
    • F M
    • C I
    • C F
    • C C
    • C S
    • C A
    • C H
    • C M
    • S I
    • S F
    • S C
    • S S
    • S A
    • S H
    • S M
    • A I
    • A F
    • A C
    • A S
    • A A
    • A H
    • A M
    • H I
    • H F
    • H C
    • H S
    • H A
    • H H
    • H M
    • M I
    • M F
    • M C
    • M S
    • M A
    • M H
    • M M

Symbols:

  • I: Int
  • F: Float
  • C: Char
  • S: String
  • A: Array
  • H: Handle
  • M: Map
  • K: Keys
  • V: Values
  • *: Any type

Incorrect clean-up code

Generate Clean-Up Code (SLL_ASSEMBLY_INSTRUCTION_TYPE_DEL and SLL_ASSEMBLY_INSTRUCTION_TYPE_LOAD_DEL) at the end of every major control path (SLL_OBJECT_TYPE_FOR, SLL_OBJECT_TYPE_WHILE, SLL_OBJECT_TYPE_LOOP, SLL_OBJECT_TYPE_RETURN and SLL_OBJECT_TYPE_EXIT)

Add break & continue operators

Add operators for breaking out of loops ((@)) or jumping to the beginning of a loop ((<<<)).

Also rename the exit function ((@)) to ((@@@)).

Fix `include`d headers

Some files include non-used header or do not include headers that are used (ex. src/sll/vm.c does not include sll/gc.h)

Tail call optimization

Implement tail call optimization by jumping to a function instead of calling it and returning.

Add tests

Test to reduce the size of the untested code and prevent bugs.

Bug in `print.c`

The PRINT_INT_SIGN macro does not print the sign when v is equal to 0.

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.