pikapython/assets/syntax.mdpp

56 lines
2.8 KiB
Plaintext
Raw Normal View History

2022-07-02 20:13:13 +08:00
#### Operator
| + | - | * | / | == | > | < | >= | <= | % | ** | // | != | & | >> | << | and | or | not | += | -= | *= | /= |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|
#### Control flow
| Syntax | State | Comment |
| --- | --- | --- |
| if | √ | |
| while | √ | |
| for in [list] | √ | ([PikaStdData.List](https://pikadoc.readthedocs.io/zh/latest/PikaStdData%20%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84.html)) |
| for in range(a, b) | √ | |
| for in [dict] | √ | ([PikaStdData.Dict](https://pikadoc.readthedocs.io/zh/latest/PikaStdData%20%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84.html)) |
| if elif else | √ | |
| for break/continue | √ ||
| while break/continue | √ ||
#### Module
| Syntax | Python Module | C Module |
| --- | --- | --- |
| import [module] | √ | √ |
| import [module] as | √ | - |
| from [module] import [class/function>]| √ | - |
| from [module] import [class/function>] as | √ | - |
| from [module] import * | - | PikaObj Module Only |
#### List/Dict
| Syntax | State | Comment |
| --- | --- | --- |
| l = list() | √ | Can be disabled in [configuration](https://pikadoc.readthedocs.io/zh/latest/%E4%BC%98%E5%8C%96%E5%86%85%E5%AD%98%E5%8D%A0%E7%94%A8%E3%80%81%E9%85%8D%E7%BD%AE%20libc.html). |
| l = [a, b, c] | √ | Can be disabled in [configuration](https://pikadoc.readthedocs.io/zh/latest/%E4%BC%98%E5%8C%96%E5%86%85%E5%AD%98%E5%8D%A0%E7%94%A8%E3%80%81%E9%85%8D%E7%BD%AE%20libc.html). |
| d = dict() | √ | Can be disabled in [configuration](https://pikadoc.readthedocs.io/zh/latest/%E4%BC%98%E5%8C%96%E5%86%85%E5%AD%98%E5%8D%A0%E7%94%A8%E3%80%81%E9%85%8D%E7%BD%AE%20libc.html). |
| d = {'a':x, 'b':y, 'c':z} | √ | Can be disabled in [configuration](https://pikadoc.readthedocs.io/zh/latest/%E4%BC%98%E5%8C%96%E5%86%85%E5%AD%98%E5%8D%A0%E7%94%A8%E3%80%81%E9%85%8D%E7%BD%AE%20libc.html).|
#### Exception
| try except | try except else | try except as |
| --- | --- | --- |
| - | - | - |
#### Slice
| Syntax | str | bytes | list (PikaStdData.List) |Comment |
| --- | --- | --- | --- | --- |
| test[i] | √ | √ | √ | Can be disabled in [configuration](https://pikadoc.readthedocs.io/zh/latest/%E4%BC%98%E5%8C%96%E5%86%85%E5%AD%98%E5%8D%A0%E7%94%A8%E3%80%81%E9%85%8D%E7%BD%AE%20libc.html). |
| test[a : b : c] | √ | √ | - | Can be disabled in [configuration](https://pikadoc.readthedocs.io/zh/latest/%E4%BC%98%E5%8C%96%E5%86%85%E5%AD%98%E5%8D%A0%E7%94%A8%E3%80%81%E9%85%8D%E7%BD%AE%20libc.html). |
| test[a :] | √ | √ | - |Can be disabled in [configuration](https://pikadoc.readthedocs.io/zh/latest/%E4%BC%98%E5%8C%96%E5%86%85%E5%AD%98%E5%8D%A0%E7%94%A8%E3%80%81%E9%85%8D%E7%BD%AE%20libc.html). |
#### Other keywords/Syntax
| yield | is | comprehensions |
| --- | --- | --- |
| - | - | - |