diff options
| author | 2023-07-22 10:42:57 +0800 | |
|---|---|---|
| committer | 2023-07-22 10:42:57 +0800 | |
| commit | c282739c54c3568b6b2e928750333946b21c6e49 (patch) | |
| tree | 7cac128878f5dc21c1341655d35b3cb15463704a | |
| parent | 5902e1b0959c44b4176efccdbfe8dfdb7d912569 (diff) | |
| download | TRPGNivis-c282739c54c3568b6b2e928750333946b21c6e49.tar.gz TRPGNivis-c282739c54c3568b6b2e928750333946b21c6e49.zip | |
👻add something else
| -rw-r--r-- | .vscode/ltex.disabledRules.en-US.txt | 1 | ||||
| -rw-r--r-- | .vscode/ltex.hiddenFalsePositives.en-US.txt | 5 | ||||
| -rw-r--r-- | .vscode/settings.json | 3 | ||||
| -rw-r--r-- | psi/exception.py | 0 | ||||
| -rw-r--r-- | psi/interpreter.py | 0 | ||||
| -rw-r--r-- | psi/lexer.py | 0 | ||||
| -rw-r--r-- | psi/mathmatics.py | 0 | ||||
| -rw-r--r-- | psi/parser.py | 0 | ||||
| -rw-r--r-- | psi/readme.md (renamed from readme.md) | 4 | ||||
| -rw-r--r-- | psi/type.py | 0 | ||||
| -rw-r--r-- | readme.rst | 94 |
11 files changed, 105 insertions, 2 deletions
diff --git a/.vscode/ltex.disabledRules.en-US.txt b/.vscode/ltex.disabledRules.en-US.txt new file mode 100644 index 0000000..460aa2b --- /dev/null +++ b/.vscode/ltex.disabledRules.en-US.txt @@ -0,0 +1 @@ +MORFOLOGIK_RULE_EN_US diff --git a/.vscode/ltex.hiddenFalsePositives.en-US.txt b/.vscode/ltex.hiddenFalsePositives.en-US.txt new file mode 100644 index 0000000..8bd355f --- /dev/null +++ b/.vscode/ltex.hiddenFalsePositives.en-US.txt @@ -0,0 +1,5 @@ +{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\Q词法分析器(Lexer)模块*:这个模块的主要任务是将输入的源代码(字符串)转换为一个个的标记(Token)。例如,它可以将字符串 \"list colors = red, blue, green\" 转换为以下的标记序列:[LIST, IDENTIFIER, EQUALS, IDENTIFIER, COMMA, IDENTIFIER, COMMA, IDENTIFIER]。\\E$"} +{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\Q语法分析器(Parser)模块*:这个模块的主要任务是将Lexer模块生成的标记序列转换为一个抽象语法树(AST)。AST是一种树形数据结构,它以一种更接近于编程语言的语法结构来表示源代码。\\E$"} +{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\Q内置类型模块*:这个模块定义了psi语言的内置类型,如列表和字典。它应该提供一些函数,用于创建和操作这些类型的实例。\\E$"} +{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\Q执行环境模块*:这个模块定义了psi语言的执行环境,包括变量的作用域和生命周期等。它应该提供一些函数,用于在执行环境中定义和查找变量。\\E$"} +{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\Q解释器模块*:这个模块的主要任务是遍历AST,并在执行环境中执行相应的操作。\\E$"} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a7d0fc7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "esbonio.sphinx.confDir": "" +}
\ No newline at end of file diff --git a/psi/exception.py b/psi/exception.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/psi/exception.py diff --git a/psi/interpreter.py b/psi/interpreter.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/psi/interpreter.py diff --git a/psi/lexer.py b/psi/lexer.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/psi/lexer.py diff --git a/psi/mathmatics.py b/psi/mathmatics.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/psi/mathmatics.py diff --git a/psi/parser.py b/psi/parser.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/psi/parser.py diff --git a/readme.md b/psi/readme.md index 5987baa..9264857 100644 --- a/readme.md +++ b/psi/readme.md @@ -228,7 +228,7 @@ r: 这是一个别名 *** -3. **逻辑运算**:我们可以添加一些命令来进行逻辑运算,例如 `and`, `or`, `not` 等。例如:`? x > 0 and y > 0: reply: Both numbers are positive`。 +**逻辑运算**:我们可以添加一些命令来进行逻辑运算,例如 `and`, `or`, `not` 等。例如:`? x > 0 and y > 0: reply: Both numbers are positive`。 4. **类型转换**:我们可以添加一些命令来进行类型转换,例如 `toInt`, `toFloat`, `toString` 等。例如:`toInt: "123"`。 @@ -240,7 +240,7 @@ r: 这是一个别名 8. **异步操作**:我们可以添加一些命令来进行异步操作,例如 `async`, `await` 等。例如:`async: longRunningTask`。 -9. **环境变量**:我们可以添加一些命令来获取和设置环境变量,例如 `getEnv`, `setEnv` 等。例如:`getEnv: "PATH"`。 +9. **环境变量**:我们可以添加一些命令来获取和设置环境变量,例如 `getEnv`, `setEnv` 等。例如:`getEnv: "PATH"`。 10. **调试工具**:我们可以添加一些命令来进行调试,例如 `log`, `debug`, `trace` 等。例如:`log: "Starting task"`。 diff --git a/psi/type.py b/psi/type.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/psi/type.py diff --git a/readme.rst b/readme.rst new file mode 100644 index 0000000..3dd6db5 --- /dev/null +++ b/readme.rst @@ -0,0 +1,94 @@ +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. + +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. + + ++---------------------+---------------------+---------------------+ +| Data Structures | Data Types | Keywords | ++=====================+=====================+=====================+ +| List | Integer | if | ++---------------------+---------------------+---------------------+ +| Dictionary | Float | else | ++---------------------+---------------------+---------------------+ +| Set | String | while | ++---------------------+---------------------+---------------------+ +| Tuple | Boolean | for | ++---------------------+---------------------+---------------------+ +| | Null | return | ++---------------------+---------------------+---------------------+ + + ++---------------------+---------------------+---------------------+ +| Data Structures | Data Types | Keywords | ++=====================+=====================+=====================+ +| List | Integer | if | ++---------------------+---------------------+---------------------+ +| Dictionary | Float | else | ++---------------------+---------------------+---------------------+ +| Set | Boolean | for | ++---------------------+---------------------+---------------------+ +| Tuple | String | while | ++---------------------+---------------------+---------------------+ +| Array | Null | return | ++---------------------+---------------------+---------------------+ +| Queue | Object | break | ++---------------------+---------------------+---------------------+ +| Stack | Function | continue | ++---------------------+---------------------+---------------------+ +| Graph | Class | import | ++---------------------+---------------------+---------------------+ +| Tree | Interface | from | ++---------------------+---------------------+---------------------+ +| LinkedList | Enum | as | ++---------------------+---------------------+---------------------+ + +Some Other Keywords: + ++---------------------+---------------------+---------------------+ +| if | else | elif | ++---------------------+---------------------+---------------------+ +| for | while | do | ++---------------------+---------------------+---------------------+ +| switch | case | default | ++---------------------+---------------------+---------------------+ +| try | catch | finally | ++---------------------+---------------------+---------------------+ +| throw | assert | import | ++---------------------+---------------------+---------------------+ +| export | from | as | ++---------------------+---------------------+---------------------+ + +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. |
