The Original Intent and Purpose of Developing BT
Notes 2024-10-20

As a senior programmer, I spend most of my time writing low-level code, especially architecture design. In web development, PHP is the language I have used the longest. I have profound opinions on this, such as function calling and nesting issues, because PHP’s syntax does not use chain syntax like Rust and JavaScript. For example, in PHP:

The abbreviation is:

You will find that although the first paragraph of code is cumbersome, it is easy to understand. However, when you implement a simple string processing logic, you need to write a lot of code to achieve it. When we simplify the code, due to syntax reasons, it can only be used in nested ways. At this time, you will find that the code needs to be read from right to left. This kind of code is very difficult to understand, and you definitely don’t want to implement it this way.

So I decided to develop a scripting language that can support chain syntax. This is my initial position.

After a period of hard work, BT language was implemented, supporting chain syntax, and the above code was converted into BT language:

It seems simple and easy to understand, because the habit of going from left to right is more clear at a glance. Therefore, the syntax of BT language draws on the syntax advantages of some programming languages. In terms of development, this will definitely make you extremely comfortable.

The development of a programming language must make up for the shortcomings and difficulties faced by other programming languages, otherwise it will be meaningless. In programming, development on the Web accounts for a huge proportion, so what PHP can achieve, BT must achieve.

For web development, the huge advantage of PHP is that it is based on script interpretation. What you see is what you get and does not require compilation. However, in languages such as Java, Go, Rust, etc., any changes need to be compiled and run. The larger the project, the longer the compilation time. Therefore, I think this is the advantage of scripting languages.

The second setting of BT is the interpretability of the language. This setting is that we hope that the BT language can be run directly like Python, PHP, and JavaScript, instead of needing to be compiled into a binary file and then run like Rust and Go.

In this way, BT makes up for the shortcomings of PHP, but it is not enough. PHP itself does not support scheduled tasks. This is a major flaw and can only be implemented through other command tools. Compared with Java and Rust, PHP's scheduled task implementation is very different.

Therefore, BT fully supports scheduled tasks, because BT continues to run when the Web service is enabled. We only need to write scheduled tasks in BT, and it supports free changes and shutdowns.

PHP is single-threaded. As a server-side scripting language, this means that PHP can only process one request at the same time. The running mechanism of PHP is not completely multi-threaded. Although the execution of PHP scripts is single-threaded, servers (such as Apache and Nginx) are multi-threaded. Every time a certain PHP file is accessed, the server will create a new process or thread to execute the corresponding PHP file. Therefore, although the processing of a single request is single-threaded, the server can process multiple requests at the same time, thereby achieving concurrent processing.

However, PHP is too dependent on itself and cannot be independent. Therefore, BT's settings must be independent of any dependencies and support multi-threading. After some time of optimization, BT has achieved an amazing breakthrough:

This is something that PHP cannot do, and it is also a major motivation for me to develop the BT language. The setting of BT is to maintain a high degree of simplicity, spotless, small and skillful, making development simpler and code more concise.

One of the biggest headaches for developers is the establishment and configuration of various environments, and BT is streamlined to the extreme. There is no need to set up an environment, and it can be executed and run in any directory.

The first version of BT has been completed, with explanation of BT language, and this website is based on BT driver.

Next is the compilation process of BT language. This is the second major setting of BT language. BT language is both an interpreted language and a compiled language, which means that it can be executed as a script, just like Python and PHP. Of course, it can also be directly compiled into a binary executable file, or it can be compiled into a jar and run virtually like Java.

So BT language has huge advantages in many development fields.

BT language can be used to quickly develop Web websites. Because of its unique purity, it does not rely on Web servers such as Apache and Nginx. You only need to write a few lines of simple BT code to configure the binding of domain names, SSL certificates, and project directories.

Unlike PHP, the BT language only serves the Web. BT can develop desktop software. If it is used as a BT script, it can be run directly, and can also be embedded in common mainstream programming languages and called, just like Python, because the compiler only has a simple executable file, which can be called directly through the command line or external execution functions.

BT is cross-platform and can run on multiple operating systems such as Windows, Linux, macOS, etc. without requiring extensive modifications to the code.

Currently, the BT language has just come out, and it only implements the interpretation and execution of scripts. The compilation mechanism will be gradually improved in later versions.