pikapython/assets/syntax.mdpp

58 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-07-02 20:13:13 +08:00
#### Operator
| + | - | * | / | == | > | < | >= | <= | % | ** | // | != | & | >> | << | and | or | not | += | -= | *= | /= |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|√|
#### Control flow
2022-07-02 20:19:57 +08:00
| Syntax | State |
| --- | --- |
| if | √ |
| while | √ |
| for in [list] | √ |
| for in range(a, b) | √ |
| for in [dict] | √ |
| if elif else | √ |
| for break/continue | √ |
| while break/continue | √ |
2022-07-02 20:13:13 +08:00
#### 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
2022-07-02 20:19:57 +08:00
| Syntax | State |
| --- | --- |
| l = list() | √ |
| l = [a, b, c] | √ |
| d = dict() | √ |
| d = {'a':x, 'b':y, 'c':z} | √ |
2022-07-02 20:13:13 +08:00
#### Exception
2022-07-02 20:19:57 +08:00
| Syntax | State |
| --- | --- |
|try except | √ |
2022-07-02 20:22:27 +08:00
|try except [errname]| - |
|try except [errname] as [e] | - |
2022-07-02 20:13:13 +08:00
#### Slice
2022-07-02 20:19:57 +08:00
| Syntax | str | bytes | list |
| --- | --- | --- | --- |
| test[i] | √ | √ | √ |
| test[a : b : c] | √ | √ | - |
| test[a :] | √ | √ | - |
2022-07-02 20:13:13 +08:00
#### Other keywords/Syntax
| yield | is | comprehensions |
| --- | --- | --- |
| - | - | - |