Tea language, also known as (Tealang), is a new computer programming language that adopts strong specification design (standard is grammar), has a simple strong type system and unit module system, supports type inference, object-oriented and functional programming, and grammar Refined and concise. Its goal is to become a friendly programming language that supports multi-terminal development, and try to support the ecosystem of commonly used programming languages so that developers can continue to use existing work results. Currently, PHP code is generated by compiling and running, and the PHP library can be called, which can be used for web server-side development. It is expected that some other programming languages will be supported in the future.
Tea language attaches great importance to the friendliness of syntax. By optimizing the design of syntax, we hope that developers can write code more easily and naturally, and can focus more on creative implementation. We also try our best to maintain the grammatical styles and habits of commonly used programming languages to reduce learning costs.
The Tea language project first started in February 2019. The original intention of the project was mainly to improve internal development efficiency and realize product functions. It initially had few features. After improvement and optimization, it was first released as open source in early December 2019.
Tea language features Strong specification, specification is syntax, clear and concise, strong type system with type inference. Type inference and checking will be performed during compilation. Convenient XView type, very suitable for developing Web view components. Intelligent ReturnCollector feature, which can automatically press types Capture data into an array as a return value. Limited type compatibility. Data operations are convenient without losing security. Built-in types are encapsulated into pseudo objects and support object member style calls, such as: "Somestring".length
The built-in unit module (Unit) system organizes programs based on unit modules. There are no ordinary global variables and access control. The variable scope is up to the ordinary function level, so there is no need to worry about global variable contamination. The string processing syntax is flexible, simple and powerful. The process control syntax is flexible. , simple and unified (all support catch/finally branches, for supports else branches)
Operator rules are simple and regular, easy to remember. It supports Lambda expressions and ordinary functions. Functions are first-class citizens. It supports classes and interfaces. Interfaces can have default implementations. The object-oriented feature is simple yet powerful. It supports ordinary functions, ordinary constants, classes and Access control of interface (public/internal)
Support access control of class/interface members (public/internal/protected/private)
Run by compiling and generating target language code
Tea language installation and use:
Install PHP7.2+. The compiler and the compiled output program depend on the PHP7.2 or above version of the running environment. After installing PHP, add the directory where the PHP execution file is located to the operating system environment variable. Clone the Tea language project to the local (or other methods Download, but make sure the directory name of the Tea language project is tea)
#clonewiththeGitclient
gitclonehttps://github.com/tealang/tea.git
Switch the current directory to the superior directory of tea and execute the following command to compile the sample program:
#usethenormalmethod
phptea/bin/teatea/examples
If you use a Mac or Linux system, you can use the Shebang method, such as:
#letsthescriptscouldbeexecute
chmod+xtea/bin/*
#usetheShebangmethod
tea/bin/teatea/docs
You can see the compilation results in the dist directory of the compilation target Unit to create or initialize a new Unit, such as:
phptea/bin/tea--initmyproject/hello