tea-age.solutions
Coder
Hello community! 🙂
I am developing a new script language TeaScript I would like to share and introduce here.
TeaScript is a Multi-Paradigm script language. Direct available already is easy to use Functional programming, Lambda functions, higher order functions, Uniform Definition Syntax, “Types are Values”, Type-Safe programming, generic programming, in-string evaluation, automatic number to- and from-string conversion, simple text file processing, time measurement, random number generator, arithmetic operations, … and many more!
It is written in C++ and can use the full power of a C++ environment. Actually, the Host Application is available for Windows only.
You can use it for FREE, download link below. Later there will be also a C++ Library (usable for free in private, noncommercial projects) as a header-only library (this implies with including source code).
At the end of the post I show you source code written in TeaScript for demonstrate its power which is already available. The same source code is included in the download package, so that it can be easily tested and tried.
Some basics:
TeaScript is close to C++ syntax but differ in some aspects.
A few important changes are:
https://tea-age.solutions/teascript/overview-and-highlights/
as well as the language documentation:
https://tea-age.solutions/teascript/teascript-language-documentation/
Now I post a TeaScript file which will demonstrate its already available power.
Try to read and understand the source code. I hope, you will easily see what it does and get an idea what other things could be done already.
The same script file and other examples are included in the download package.
You can try and use TeaScript for free (currently Windows 10/11 64 bit only, more to follow).
It is a portable version, so there is no installation required! - Just download, unpack and use it!
Download and try it here: https://tea-age.solutions/downloads/
Please, let me know any concerns or problems. A basic instruction is available in the link above as well as in the readme.txt of the package.
I can provide more detailed instructions if you wish.
(A slightly better syntax highlighting can be found on my webpage)
I still have tons of features and ideas which I want to realize in some next pre-release.
For the very next pre-releases will come:
What is your impression of it? Please, don't hesitate to write a comment.
I am developing a new script language TeaScript I would like to share and introduce here.
TeaScript is a Multi-Paradigm script language. Direct available already is easy to use Functional programming, Lambda functions, higher order functions, Uniform Definition Syntax, “Types are Values”, Type-Safe programming, generic programming, in-string evaluation, automatic number to- and from-string conversion, simple text file processing, time measurement, random number generator, arithmetic operations, … and many more!
It is written in C++ and can use the full power of a C++ environment. Actually, the Host Application is available for Windows only.
You can use it for FREE, download link below. Later there will be also a C++ Library (usable for free in private, noncommercial projects) as a header-only library (this implies with including source code).
At the end of the post I show you source code written in TeaScript for demonstrate its power which is already available. The same source code is included in the download package, so that it can be easily tested and tried.
Some basics:
TeaScript is close to C++ syntax but differ in some aspects.
A few important changes are:
- No semicolon ; for end a statement
- curly brackets {} for if-statements/loops are mandatory, also if there is only one inner statement.
- assignment is :=, compare is ==, a single = is a syntax error (avoiding the common bug of forget one = )
- No &&. ||, !. Use and, or, not
- a repeat loop (additional forall loop coming with next release)
- implicit return the last statement.
- blocks, if-statements, etc. can be assigned.
- ...
https://tea-age.solutions/teascript/overview-and-highlights/
as well as the language documentation:
https://tea-age.solutions/teascript/teascript-language-documentation/
Now I post a TeaScript file which will demonstrate its already available power.
Try to read and understand the source code. I hope, you will easily see what it does and get an idea what other things could be done already.
The same script file and other examples are included in the download package.
You can try and use TeaScript for free (currently Windows 10/11 64 bit only, more to follow).
It is a portable version, so there is no installation required! - Just download, unpack and use it!
Download and try it here: https://tea-age.solutions/downloads/
Please, let me know any concerns or problems. A basic instruction is available in the link above as well as in the readme.txt of the package.
I can provide more detailed instructions if you wish.
(A slightly better syntax highlighting can be found on my webpage)
C++:
/*
* SPDX-FileCopyrightText: Copyright (c) 2022 Florian Thake (tea-age.solutions). All rights reserved. (Of course permission granted by me to post it in codeforum.org)
*/
// This is a file io test for the TeaScript Core Library written in TeaScript for versions >= 0.8.
// The test will create files and write data into the temp directory which is reported
// by the tempdir() CoreLibrary function of TeaScript. The files will not be removed and remain there.
// NOTE: assuming core library test 1 and 2 passed 100%!
const some_str := "TEST"
const hello_world_tea := "// This is a hello world TeaScript file\n" %
"// created by the fileio_test01.tea script\n" %
"// for testing purposes. \n\n" %
"const str := \"Hello World!\"\n" %
"println( str )\n\n" %
"str\n\n"
_out( "Start testing file io of TeaScript Core Library ...\n" )
const dir := tempdir()
if( _strlen( dir ) == 0 ) {
fail_with_message( "tempdir() returned an empty string!" )
}
println( "using tempdir: \"%(dir)\"" )
func make_filename()
{
def time_str := timetostr(clock_utc(), true)
// windows does not allow : in file name...
repeat {
if( not strreplacefirst( time_str, ":", "-" ) ) { stop }
}
strreplacefirst( time_str, ".", "_" )
"teascript_fileio_test_utc%(time_str)_r%(random(1000,9999)).tea"
}
const filename01 := make_filename()
println( "using filename01: \"%(filename01)\"" )
// no overwrite, write bom
if( not writetextfile( dir % filename01, hello_world_tea, false, true ) ) {
fail_with_message( "writetextfile() failed for %(dir % filename01)!" )
}
const fsize := file_size( dir % filename01 )
println( "file \"%(dir % filename01)\" written with size %(fsize) (bytes)." )
def read_str := readtextfile( dir % filename01 )
if( read_str is Bool and not read_str ) {
fail_with_message( "readtextfile() failed for %(dir % filename01)!" )
}
if( read_str != hello_world_tea ) {
println( "readtextfile() did not read back same content:" )
print( read_str )
_out( "\n\n" )
fail_with_message( "file io test failed!" )
}
strreplacefirst( read_str, "World", some_str )
println("Now excuting read back and slightly modified file content ... \n\n" )
const x := eval( read_str )
if( x == "Hello TEST!" ) {
println( "\n=== TEST FINISHED ===" )
} else {
println( "\n !!! TEST FAILED !!! " )
}
I still have tons of features and ideas which I want to realize in some next pre-release.
For the very next pre-releases will come:
- built in arrays and tuples
- forall loop
- Linux support (Ubuntu at least)
- C++ Library
- better and more file io capabilities
- Parallel syntax (multi-threading build into the core language syntax)
- Pipe Syntax like in Unix/Linux shells.
What is your impression of it? Please, don't hesitate to write a comment.