diff --git a/docs/documentation.html b/docs/documentation.html index 8a6e14a..0e87fab 100644 --- a/docs/documentation.html +++ b/docs/documentation.html @@ -1,4 +1,4 @@ -
Pages
Table of Contents
done
Wrapped string literals sr
wraps multiple source strings in an uniform structure. There is no reason to delete a sr
unless you want to de-allocate, referred data of the string.
You can add two sr
using +
operator. However, resulting value will be of type str
, as memory allocation is required. It is recommended to use a string buffer for concatenating a string.
a: sr = "A"
+Yaksha Programming Language Pages
Table of Contents
1 Language Features
1.1 Data Types
1.1.1 Wrapped String References
done
Wrapped string literals sr
wraps multiple source strings in an uniform structure. There is no reason to delete a sr
unless you want to de-allocate, referred data of the string.
You can add two sr
using +
operator. However, resulting value will be of type str
, as memory allocation is required. It is recommended to use a string buffer for concatenating a string.
a: sr = "A"
b: sr = "B"
c = a + b
# Type of c would be str
@@ -244,7 +244,7 @@
def main() -> int:
println(fizzbuzz!{})
return 0
-
2 Yaksha library
Yaksha library uses multiple 3rd party libraries, set of python scripts and few other nuts and bolts to create library sources.
Core parts of runtime library functionality starts with yk__
or YK__
.
Yaksha programming language preserves anything that starts with yk__
or YK__
while prefixing any other name with yy__
.
This avoids collisions with C standard library functions or keywords.
2.1 Standard Library Components
2.1.1 Core Library
in progress
Small core library with useful features.
import libs
+
2 Yaksha library
Yaksha library uses multiple 3rd party libraries, set of python scripts and few other nuts and bolts to create library sources.
Core parts of runtime library functionality starts with yk__
or YK__
.
Yaksha programming language preserves anything that starts with yk__
or YK__
while prefixing any other name with yy__
.
This avoids collisions with C standard library functions or keywords.
2.1 Standard Library Components
2.1.1 Core Library
in progress
Small core library with useful features.
import libs
2.1.2 UI Library
in progress
Use raygui with raylib.
import raylib.gui
2.1.3 raylib - Graphics/Game/Audio Library
in progress
Use raylib to build games and such
import raylib
2.1.4 CL Library
not started
Access to OpenCL features and parallel programming.
import cl
@@ -256,7 +256,7 @@
def main() -> int:
dvc: cl.device = cl.get_device(0)
cl.run(dvc, my_program)
-
Placeholder code, API is not designed yet.
3 Language Grammar
Warning! this section needs rewriting
This describes Yaksha language grammar.
Lot learned from Crafting Interpreters
book and Python grammar page.
in progress
3.1 Statements
This section describes statements and program structure. Program is made from one or more program statements. Standard statements are what goes inside functions.
program: import_statement* program_declaration*
+
Placeholder code, API is not designed yet.
3 Language Grammar
Warning! this section needs rewriting
This describes Yaksha language grammar.
Lot learned from Crafting Interpreters
book and Python grammar page.
in progress
3.1 Statements
This section describes statements and program structure. Program is made from one or more program statements. Standard statements are what goes inside functions.
program: import_statement* program_declaration*
program_declarations:
| const_statement
| struct_statement
@@ -341,7 +341,7 @@
eof: "end of file"
ba_indent: "increase in indentation"
ba_dedent: "decrease is indentation"
-
ba_indent
and ba_dedent
gets calculated before parsing in block_analyzer
phase.
4 Compiler Internals
This section describes how compiler works.
Total of 12+
passes are planned for the compiler.
4.1 What happens when you compile a .yaka
file?
4.1.1 Let's look at a sample
4.1.1.1 Input code
def factorial(x: int) -> int:
+
ba_indent
and ba_dedent
gets calculated before parsing in block_analyzer
phase.
4 Compiler Internals
This section describes how compiler works.
Total of 12+
passes are planned for the compiler.
4.1 What happens when you compile a .yaka
file?
4.1.1 Let's look at a sample
4.1.1.1 Input code
def factorial(x: int) -> int:
if x <= 0:
return 1
return x * factorial(x - 1)
diff --git a/docs/library-docs.html b/docs/library-docs.html
index cf37b77..796831d 100644
--- a/docs/library-docs.html
+++ b/docs/library-docs.html
@@ -1,4 +1,4 @@
-Yaksha Programming Language Pages
Table of Contents
1 Core Library
Core library can be accessed by importing libs
.
This import name is subject to change.
1.1 libs
def version() -> str
+Yaksha Programming Language Pages
Table of Contents
1 Core Library
Core library can be accessed by importing libs
.
This import name is subject to change.
1.1 libs
def version() -> str
# This returns standard library version
# (Note: this is hardcoded)
1.2 libs.argparse
ARGPARSE_DEFAULT: Const[int]
@@ -555,7 +555,7 @@
def lessser(a: TimeSpec, b: TimeSpec) -> bool
# is a < b ?
def now() -> TimeSpec
-
2 Raylib
Raylib can be accessed by importing raylib
.
raylib is created by Ramon Santamaria and contributors.
Yaksha wraps raylib using a generator script.
2.1 raylib
BLEND_ADDITIVE: Const[int]
+
2 Raylib
Raylib can be accessed by importing raylib
.
raylib is created by Ramon Santamaria and contributors.
Yaksha wraps raylib using a generator script.
2.1 raylib
BLEND_ADDITIVE: Const[int]
# Blend textures adding colors
BLEND_ADD_COLORS: Const[int]
# Blend textures adding colors (alternative)
@@ -3535,7 +3535,7 @@
def tan_deg(x: float) -> float
def todeg(radians: float) -> float
def torad(degrees: float) -> float
-
3 WASM4 Support Library
Support for WASM4 fantasy console.
Additionally following function in libs
work.
libs.random.random_u64
libs.random.set_seed
wasm4 is created by Bruno Garcia and contributors.
Yaksha wraps wasm4.h
3.1 w4
BLIT_1BPP: Const[u32]
+
3 WASM4 Support Library
Support for WASM4 fantasy console.
Additionally following function in libs
work.
libs.random.random_u64
libs.random.set_seed
wasm4 is created by Bruno Garcia and contributors.
Yaksha wraps wasm4.h
3.1 w4
BLIT_1BPP: Const[u32]
BLIT_2BPP: Const[u32]
BLIT_FLIP_X: Const[u32]
BLIT_FLIP_Y: Const[u32]
diff --git a/docs/yama.html b/docs/yama.html
index 048bbb5..2d760c1 100644
--- a/docs/yama.html
+++ b/docs/yama.html
@@ -1,4 +1,4 @@
-Yaksha Programming Language Pages
Table of Contents
YAMA 0001 - Exposing C enums/#defines/consts
- Author(s): Bhathiya Perera
- Status : ✅
Problem
In C we can define enums such as below.
// Simple
+Yaksha Programming Language Pages
Table of Contents
YAMA 0001 - Exposing C enums/#defines/consts
- Author(s): Bhathiya Perera
- Status : ✅
Problem
In C we can define enums such as below.
// Simple
enum something1 {
SOMETHING1,
ANOTHER1
@@ -457,7 +457,7 @@
cl.request("GET", "/api/v1/users", "", callback)
defer free_http_client(cl)
return 0
-
Required changes to Yaksha ecosystem
Implement ability to support fixed sized arrays in Yaksha
(parser, compiler, etc).
Implement ability in YakshaLisp
to execute programs and access output.
Implement ability in carpntr
to use YakshaLisp
to build programs. (Either use program execution ability or use make/cmake
to build programs)
Implement ability in YakshaLisp
to detect platform and use appropriate build system.
CI - Add ability to build Yaksha
release on supported platforms using github actions. (Instead of cross compiling)
Remove hammer
and just use cmake
to build Yaksha
.
Update build and other scripts accordingly.
Third party libraries to be included
mongoose
- for making HTTP requests
mbedtls
- for TLS support
reproc
- for executing programs
YAMA 0012 - Static arrays
- Author(s): Bhathiya Perera
- Status : Draft
Static arrays are an important feature in C. Allowing us to create arrays in the stack and pass them around without worrying about memory management. This is a proposal to add static arrays to Yaksha.
Problem with arrays in C is that it decays to pointers. This is a problem when passing arrays to functions. And we need to pass the size of the array as well. Another problem is array size is not considered part of the data type (as it decays, information is lost).
So in Yaksha I would prefer to have a data type that mentions the size of the array as well. FixedArr[u8,10]
would be different from FixedArr[u8,20]
.
def receive_a(item_a: FixedArr[int, 3]) -> int:
+
Required changes to Yaksha ecosystem
Implement ability to support fixed sized arrays in Yaksha
(parser, compiler, etc).
Implement ability in YakshaLisp
to execute programs and access output.
Implement ability in carpntr
to use YakshaLisp
to build programs. (Either use program execution ability or use make/cmake
to build programs)
Implement ability in YakshaLisp
to detect platform and use appropriate build system.
CI - Add ability to build Yaksha
release on supported platforms using github actions. (Instead of cross compiling)
Remove hammer
and just use cmake
to build Yaksha
.
Update build and other scripts accordingly.
Third party libraries to be included
mongoose
- for making HTTP requests
mbedtls
- for TLS support
reproc
- for executing programs
YAMA 0012 - Fixed size arrays
- Author(s): Bhathiya Perera
- Status : Draft
Fixed size arrays are an important feature in C. Allowing us to create arrays in the stack and pass them around without worrying about memory management. This is a proposal to add static arrays to Yaksha.
Problem with arrays in C is that it decays to pointers. This is a problem when passing arrays to functions. And we need to pass the size of the array as well. Another problem is array size is not considered part of the data type (as it decays, information is lost).
So in Yaksha I would prefer to have a data type that mentions the size of the array as well. FixedArr[u8,10]
would be different from FixedArr[u8,20]
.
def receive_a(item_a: FixedArr[int, 3]) -> int:
item_a[0] + item_a[2]
def main() -> int:
diff --git a/yaksha_proposals/0012_static_arrays.md b/yaksha_proposals/0012_fixed_size_arrays.md
similarity index 70%
rename from yaksha_proposals/0012_static_arrays.md
rename to yaksha_proposals/0012_fixed_size_arrays.md
index f944044..0bd43d9 100644
--- a/yaksha_proposals/0012_static_arrays.md
+++ b/yaksha_proposals/0012_fixed_size_arrays.md
@@ -1,11 +1,11 @@
-# YAMA 0012 - Static arrays
+# YAMA 0012 - Fixed size arrays
- Author(s): Bhathiya Perera
- Status : Draft
-Static arrays are an important feature in C. Allowing us to create arrays in the stack and pass them around without worrying about memory management. This is a proposal to add static arrays to Yaksha.
+Fixed size arrays are an important feature in C. Allowing us to create arrays in the stack and pass them around without worrying about memory management. This is a proposal to add static arrays to Yaksha.
- Problem with arrays in C is that it decays to pointers. This is a problem when passing arrays to functions. And we need to pass the size of the array as well. Another problem is array size is not considered part of the data type (as it decays, information is lost).
+Problem with arrays in C is that it decays to pointers. This is a problem when passing arrays to functions. And we need to pass the size of the array as well. Another problem is array size is not considered part of the data type (as it decays, information is lost).
So in Yaksha I would prefer to have a data type that mentions the size of the array as well. `FixedArr[u8,10]` would be different from `FixedArr[u8,20]`.
@@ -37,4 +37,4 @@ def main() -> int:
* Add to documentation
* Add support for intellij and other editors
* Double check this works in structs.
-* Add support for things like `float[3]` etc in raylib wrapper generator using `FixedArr`.
\ No newline at end of file
+* Add support for things like `float[3]` etc in raylib wrapper generator using `FixedArr`.