1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
Psi CLI Language
========================
Psi is a new programming language designed with simplicity, flexibility, and performance in mind. It provides a clean and intuitive syntax that is easy to read and write, making it an excellent choice for both beginners and experienced programmers.
Features
--------
- `Lexer Module`_: The lexer module is responsible for converting the source code into a sequence of tokens. It recognizes the basic elements of the language such as identifiers, keywords, operators, and literals.
- `Parser Module`_: The parser module takes the sequence of tokens generated by the lexer module and transforms it into an Abstract Syntax Tree (AST). The AST is a tree-like data structure that represents the source code in a way that is closer to the syntactic structure of the programming language.
- `Built-in Types Module`_: This module defines the built-in types of the Psi language, such as lists and dictionaries. It provides functions for creating and manipulating instances of these types.
- `Error Handling Module`_: This module provides a mechanism for catching and handling errors during runtime. It defines a set of exception classes and functions for throwing and catching these exceptions.
- `Execution Environment Module`_: This module defines the execution environment of the Psi language, including the scope and lifecycle of variables. It provides functions for defining and looking up variables in the execution environment.
- `Interpreter Module`_: The main task of this module is to traverse the AST and perform the corresponding operations in the execution environment.
- `Mathematics Foundation Module`_: This module provides basic mathematical functions and constants, such as addition, subtraction, multiplication, and division.
- `Documentation Module`_: This module uses reStructuredText and Sphinx to build the documentation, providing API interface descriptions and usage examples.
.. _`Lexer Module`: https://github.com/HydroRoll-Team/psi/blob/main/psi/lexer.py
.. _`Parser Module`: https://github.com/HydroRoll-Team/psi/blob/main/psi/parser.py
.. _`Built-in Types Module`: https://github.com/HydroRoll-Team/psi/blob/main/psi/type.py
.. _`Error Handling Module`: https://github.com/HydroRoll-Team/psi/blob/main/psi/exception.py
.. _`Execution Environment Module`: https://github.com/HydroRoll-Team/psi/blob/main/psi/execution.py
.. _`Interpreter Module`: https://github.com/HydroRoll-Team/psi/blob/main/psi/interpreter.py
.. _`Mathematics Foundation Module`: https://github.com/HydroRoll-Team/psi/blob/main/psi/mathematics.py
.. _`Documentation Module`: https://github.com/HydroRoll-Team/psi/blob/main/docs
Getting Started
---------------
To get started with Psi, you can clone the repository and follow the instructions in the README file. The repository includes a comprehensive set of examples that demonstrate the various features of the language.
.. @TODO 完整的Keywords列表
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| *Data Structures* | *Data Types* | *keywords* | *Special Characters* |
+=====================+=====================+=========================================+=============================================+
| List | Integer | ``reply`` ``ask`` | ``?``: if, ``!``: else, ``|``: condition |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| Dictionary | Float | ``import`` ``export`` | ``==`` ``<`` ``>`` ``!=`` ``~=`` ``=`` |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| Set | Boolean | ``def`` ``call`` | ``&``: parallel, ``~``: delay |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| Tuple | String | ``list`` ``dict`` ``set`` ``tuple`` | ``#`` ``""""...""""`` |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| Array | Null | ``try`` ``catch`` ``assert`` | ``>>``: output stream, ``<<``: input stream |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| Queue | Object | ``alias`` | ``@``: hook events |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| Stack | Function | ``wait`` ``async`` ``cancel`` ``yield`` | ``*``: repeat |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| Graph | Class | ``match`` ``search`` ``replace`` | ``&&``: and, ``||``: or, ``!``: not |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| Tree | Interface | ``namespace`` | ``{}``: code block, refer |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
| LinkedList | Enum | ``loop`` ``break`` ``continue`` | ``=>``: functional program |
+---------------------+---------------------+-----------------------------------------+---------------------------------------------+
Contributing
------------
Contributions to the Psi project are welcome. If you have a feature request, bug report, or proposal for improvement, please open an issue on the project's GitHub page. If you wish to contribute code, please fork the repository and submit a pull request.
License
-------
Psi is open-source software, licensed under the MIT license. This means you are free to use, modify, and distribute it under the terms of this license.
|