Typhon-Language 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. {typhon_language-0.1.1/src/Typhon_Language.egg-info → typhon_language-0.1.2}/PKG-INFO +46 -6
  2. typhon_language-0.1.1/PKG-INFO → typhon_language-0.1.2/README.md +148 -123
  3. {typhon_language-0.1.1 → typhon_language-0.1.2}/pyproject.toml +1 -1
  4. typhon_language-0.1.1/README.md → typhon_language-0.1.2/src/Typhon_Language.egg-info/PKG-INFO +163 -108
  5. {typhon_language-0.1.1 → typhon_language-0.1.2}/LICENSE +0 -0
  6. {typhon_language-0.1.1 → typhon_language-0.1.2}/setup.cfg +0 -0
  7. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Driver/debugging.py +0 -0
  8. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Driver/diagnostic.py +0 -0
  9. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Driver/run.py +0 -0
  10. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Driver/translate.py +0 -0
  11. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Driver/type_check.py +0 -0
  12. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Driver/utils.py +0 -0
  13. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Grammar/__init__.py +0 -0
  14. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Grammar/_typhon_parser.py +0 -0
  15. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Grammar/line_break.py +0 -0
  16. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Grammar/parser.py +0 -0
  17. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Grammar/parser_helper.py +0 -0
  18. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Grammar/syntax_errors.py +0 -0
  19. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Grammar/token_factory_custom.py +0 -0
  20. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Grammar/tokenizer_custom.py +0 -0
  21. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Grammar/typhon_ast.py +0 -0
  22. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/SourceMap/__init__.py +0 -0
  23. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/SourceMap/ast_match_based_map.py +0 -0
  24. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/SourceMap/ast_matching.py +0 -0
  25. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/SourceMap/datatype.py +0 -0
  26. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/__init__.py +0 -0
  27. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/comprehension_to_function.py +0 -0
  28. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/const_member_to_final.py +0 -0
  29. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/forbidden_statements.py +0 -0
  30. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/func_literal_to_def.py +0 -0
  31. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/if_while_let.py +0 -0
  32. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/inline_statement_block_capture.py +0 -0
  33. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/insert_self_to_method.py +0 -0
  34. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/name_generator.py +0 -0
  35. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/optional_operators_to_checked.py +0 -0
  36. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/placeholder_to_function.py +0 -0
  37. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/record_to_dataclass.py +0 -0
  38. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/scope_check_rename.py +0 -0
  39. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/transform.py +0 -0
  40. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/type_abbrev_desugar.py +0 -0
  41. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/type_annotation_check_expand.py +0 -0
  42. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/utils.py +0 -0
  43. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Transform/visitor.py +0 -0
  44. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Typing/__init__.py +0 -0
  45. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Typing/pyright.py +0 -0
  46. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/Typing/result_diagnostic.py +0 -0
  47. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/__init__.py +0 -0
  48. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon/__main__.py +0 -0
  49. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon_Language.egg-info/SOURCES.txt +0 -0
  50. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon_Language.egg-info/dependency_links.txt +0 -0
  51. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon_Language.egg-info/entry_points.txt +0 -0
  52. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon_Language.egg-info/requires.txt +0 -0
  53. {typhon_language-0.1.1 → typhon_language-0.1.2}/src/Typhon_Language.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Typhon-Language
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Typhon programming language
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -17,14 +17,50 @@ Dynamic: license-file
17
17
 
18
18
  Typhon is a modernized syntax sugar for Python, designed to improve developer experience with features like static typing, brace-based scoping, and expressive functional programming capabilities.
19
19
 
20
- GitHub repository: [Typhon](https://github.com/hnakamura5/Typhon)
21
- PyPI package: [Typhon-Language](https://pypi.org/project/Typhon-Language/)
20
+ - GitHub repository: [Typhon](https://github.com/hnakamura5/Typhon)
21
+ - PyPI package: [Typhon-Language](https://pypi.org/project/Typhon-Language/)
22
+ - VSCode extension: [Typhon Language Support](https://marketplace.visualstudio.com/items?itemName=hnakamura5.typhon-language-support) from [GitHub Repository](https://github.com/hnakamura5/typhon-language-support)
23
+
24
+ ## Getting Started
25
+
26
+ Install Typhon via pip:
27
+
28
+ ```bash
29
+ pip install typhon-language
30
+ ```
31
+
32
+ Run Typhon from the command line:
33
+
34
+ ```bash
35
+ typhon --help
36
+ ```
37
+ Create a simple Typhon program in `hello.typh`:
38
+
39
+ ```typhon
40
+ def main() {
41
+ print("Hello, Typhon!")
42
+ }
43
+ main()
44
+ ```
45
+
46
+ Run the program:
47
+
48
+ ```bash
49
+ typhon run hello.typh
50
+ ```
51
+
52
+ Or run directly using uvx:
53
+
54
+ ```bash
55
+ uvx --from typhon-language typhon run hello.typh
56
+ ```
57
+
22
58
 
23
59
  ## Design Concepts
24
60
 
25
61
  Typhon is built on three core pillars:
26
62
 
27
- 1. **Safety**: As expected from modern programming languages, Typhon enforces safety through static typing, lexical scopes, immutable-by-default variables (`let`), and null safety features (`?.`, `??`).
63
+ 1. **Safety**: As expected in modern programming languages, Typhon enforces safety through static typing, lexical scopes, immutable-by-default variables (`let`), and null safety features (`?.`, `??`, `?()`, `?[]`).
28
64
  2. **Expressiveness**: Expression-oriented design with functional programming features. Control comprehension forms for `if`, `match`, `try`, and so on enable concise, value-returning expressions. Function literals, placeholders and pipe operators facilitate clean and readable code.
29
65
  3. **Python Interoperability**: Typhon compiles directly to Python, allowing you to use the vast ecosystem of Python libraries seamlessly while enjoying a modern syntax.
30
66
 
@@ -48,8 +84,8 @@ Typhon retains most of Python's semantics but introduces significant syntax chan
48
84
 
49
85
  ### Main Changes
50
86
 
51
- - **Brace Scoping**: Typhon uses `{ ... }` for blocks, replacing indentation-based scoping. Both `;` and line breaks can also act as delimiters. See [Lexical Structure](doc/reference/lexical_structure.md).
52
- - **Static Typing**: Type checking is enforced at compile time.
87
+ - **Brace Scoping**: Typhon uses `{ ... }` for blocks, replacing indentation-based scoping. Both `;` and line breaks can also act as delimiters. See [Lexical Structure](doc/reference/lexical_structure.md) for more details.
88
+ - **Static Typing**: Type checking is enforced at compile time. Currently powered by [basedpyright](https://docs.basedpyright.com/latest/) type checker.
53
89
  - **Declarations**: Variables must be declared with `let` (immutable) or `var` (mutable). See [Variables](doc/reference/variables.md).
54
90
 
55
91
  ### Syntax Extensions
@@ -83,6 +119,10 @@ Some Python features are removed to enforce safety and clarity. See [Removed Fea
83
119
 
84
120
  Typhon can be run directly or translated to Python.
85
121
 
122
+ `.typh` files are Typhon source files. In directory mode, all `.typh` files are processed.
123
+
124
+ Note Typhon uses `.typhon` directory in source paths to place translated Python files and caches.
125
+
86
126
  ### Run
87
127
 
88
128
  Run a Typhon source file or directory.
@@ -1,123 +1,148 @@
1
- Metadata-Version: 2.4
2
- Name: Typhon-Language
3
- Version: 0.1.1
4
- Summary: Typhon programming language
5
- Requires-Python: >=3.12
6
- Description-Content-Type: text/markdown
7
- License-File: LICENSE
8
- Requires-Dist: basedpyright>=1.32.1
9
- Requires-Dist: fire>=0.7.1
10
- Requires-Dist: intervaltree>=3.1.0
11
- Requires-Dist: pegen>=0.3.0
12
- Requires-Dist: pytest>=8.4.1
13
- Requires-Dist: ruff>=0.12.5
14
- Dynamic: license-file
15
-
16
- # Typhon
17
-
18
- Typhon is a modernized syntax sugar for Python, designed to improve developer experience with features like static typing, brace-based scoping, and expressive functional programming capabilities.
19
-
20
- GitHub repository: [Typhon](https://github.com/hnakamura5/Typhon)
21
- PyPI package: [Typhon-Language](https://pypi.org/project/Typhon-Language/)
22
-
23
- ## Design Concepts
24
-
25
- Typhon is built on three core pillars:
26
-
27
- 1. **Safety**: As expected from modern programming languages, Typhon enforces safety through static typing, lexical scopes, immutable-by-default variables (`let`), and null safety features (`?.`, `??`).
28
- 2. **Expressiveness**: Expression-oriented design with functional programming features. Control comprehension forms for `if`, `match`, `try`, and so on enable concise, value-returning expressions. Function literals, placeholders and pipe operators facilitate clean and readable code.
29
- 3. **Python Interoperability**: Typhon compiles directly to Python, allowing you to use the vast ecosystem of Python libraries seamlessly while enjoying a modern syntax.
30
-
31
- ## Documentation
32
-
33
- For a complete guide to the language, please visit the **[Typhon Reference Manual](doc/reference/README.md)**.
34
-
35
- ### Quick Links
36
-
37
- - [Lexical Structure](doc/reference/lexical_structure.md) (Comments, Keywords, Delimiters)
38
- - [Types](doc/reference/types.md)
39
- - [Variables](doc/reference/variables.md)
40
- - [Expressions](doc/reference/expressions/README.md)
41
- - [Statements](doc/reference/statements/README.md)
42
- - [Definitions](doc/reference/definitions/README.md) (Functions, Classes, Modules)
43
- - [Removed Features](doc/reference/removed_features.md)
44
-
45
- ## Syntax Changes from Python
46
-
47
- Typhon retains most of Python's semantics but introduces significant syntax changes.
48
-
49
- ### Main Changes
50
-
51
- - **Brace Scoping**: Typhon uses `{ ... }` for blocks, replacing indentation-based scoping. Both `;` and line breaks can also act as delimiters. See [Lexical Structure](doc/reference/lexical_structure.md).
52
- - **Static Typing**: Type checking is enforced at compile time.
53
- - **Declarations**: Variables must be declared with `let` (immutable) or `var` (mutable). See [Variables](doc/reference/variables.md).
54
-
55
- ### Syntax Extensions
56
-
57
- - **Null Safety**: `?.`, `??`, `?()`, `?[]` operators. See [Null Safety](doc/reference/expressions/null_safety.md).
58
- - **Function literals**: Unrestricted function literals with `(x) => { return x + 1 }` syntax, with totally the same capability as normal functions. See[Function literals](doc/reference/expressions/literals.md#function-literals).
59
- - **Pipe Operator**: `x |> f` for function chaining. See [Pipe Operator](doc/reference/expressions/pipe_operator.md).
60
- - **Placeholders**: `_` for concise anonymous functions (e.g., `_ + 1`). See [Placeholders](doc/reference/expressions/placeholders.md).
61
- - **Control Comprehensions**: Control statements as expressions (e.g., `(if (c) x else y)`). All `if/while/for/let/try/with/match` are supported as comprehension. See [Comprehensions](doc/reference/expressions/comprehensions.md).
62
- - **Pattern Matching**: Enhanced `match`, `if-let`, and `let-else` statements. See [Control Flow](doc/reference/statements/control_flow.md).
63
- - **`self` Keyword**: `self` is a keyword and is not explicitly declared in method signatures. See [Classes](doc/reference/items/classes.md).
64
- - **Data Records**: Anonymous immutable structs `{|x=1|}`. See [Types](doc/reference/types.md).
65
- - **Block Comments**: `#( ... )#` allows nested comments.
66
-
67
- ### Detailed Design Changes
68
-
69
- - **Logical Operators**: `&&`, `||`, `!` replace `and`, `or`, `not` (though Python keywords are still reserved).
70
- - **Const Parameters**: Function parameters are immutable by default.
71
- - **Line Breaks**: Stricter rules for line continuations. See [Lexical Structure](doc/reference/lexical_structure.md).
72
-
73
- ### Syntax Restrictions
74
-
75
- Some Python features are removed to enforce safety and clarity. See [Removed Features](doc/reference/removed_features.md).
76
-
77
- - No `del`, `global`, `nonlocal`.
78
- - No wildcard imports.
79
- - No chained assignments (`a = b = c`).
80
- - No control statements inside class bodies.
81
-
82
- ## Usage
83
-
84
- Typhon can be run directly or translated to Python.
85
-
86
- ### Run
87
-
88
- Run a Typhon source file or directory.
89
-
90
- ```bash
91
- typhon run <source> [args...]
92
- ```
93
-
94
- ### Translate
95
-
96
- Translate Typhon code to Python.
97
-
98
- ```bash
99
- typhon translate <source> [-o output_dir]
100
- ```
101
-
102
- ### Type Check
103
-
104
- Run type checking on Typhon code.
105
-
106
- ```bash
107
- typhon type_check <source>
108
- ```
109
-
110
- ## Future Plans
111
-
112
- See [Future Plans](doc/reference/future_plans.md) for planned features like compile-time controls (`static if`) and known limitations.
113
-
114
- ## Influenced By
115
-
116
- Typhon draws inspiration from several modern programming languages:
117
-
118
- - Python
119
- - TypeScript
120
- - Swift
121
- - Rust
122
- - Scala
123
- - F#
1
+ # Typhon
2
+
3
+ Typhon is a modernized syntax sugar for Python, designed to improve developer experience with features like static typing, brace-based scoping, and expressive functional programming capabilities.
4
+
5
+ - GitHub repository: [Typhon](https://github.com/hnakamura5/Typhon)
6
+ - PyPI package: [Typhon-Language](https://pypi.org/project/Typhon-Language/)
7
+ - VSCode extension: [Typhon Language Support](https://marketplace.visualstudio.com/items?itemName=hnakamura5.typhon-language-support) from [GitHub Repository](https://github.com/hnakamura5/typhon-language-support)
8
+
9
+ ## Getting Started
10
+
11
+ Install Typhon via pip:
12
+
13
+ ```bash
14
+ pip install typhon-language
15
+ ```
16
+
17
+ Run Typhon from the command line:
18
+
19
+ ```bash
20
+ typhon --help
21
+ ```
22
+ Create a simple Typhon program in `hello.typh`:
23
+
24
+ ```typhon
25
+ def main() {
26
+ print("Hello, Typhon!")
27
+ }
28
+ main()
29
+ ```
30
+
31
+ Run the program:
32
+
33
+ ```bash
34
+ typhon run hello.typh
35
+ ```
36
+
37
+ Or run directly using uvx:
38
+
39
+ ```bash
40
+ uvx --from typhon-language typhon run hello.typh
41
+ ```
42
+
43
+
44
+ ## Design Concepts
45
+
46
+ Typhon is built on three core pillars:
47
+
48
+ 1. **Safety**: As expected in modern programming languages, Typhon enforces safety through static typing, lexical scopes, immutable-by-default variables (`let`), and null safety features (`?.`, `??`, `?()`, `?[]`).
49
+ 2. **Expressiveness**: Expression-oriented design with functional programming features. Control comprehension forms for `if`, `match`, `try`, and so on enable concise, value-returning expressions. Function literals, placeholders and pipe operators facilitate clean and readable code.
50
+ 3. **Python Interoperability**: Typhon compiles directly to Python, allowing you to use the vast ecosystem of Python libraries seamlessly while enjoying a modern syntax.
51
+
52
+ ## Documentation
53
+
54
+ For a complete guide to the language, please visit the **[Typhon Reference Manual](doc/reference/README.md)**.
55
+
56
+ ### Quick Links
57
+
58
+ - [Lexical Structure](doc/reference/lexical_structure.md) (Comments, Keywords, Delimiters)
59
+ - [Types](doc/reference/types.md)
60
+ - [Variables](doc/reference/variables.md)
61
+ - [Expressions](doc/reference/expressions/README.md)
62
+ - [Statements](doc/reference/statements/README.md)
63
+ - [Definitions](doc/reference/definitions/README.md) (Functions, Classes, Modules)
64
+ - [Removed Features](doc/reference/removed_features.md)
65
+
66
+ ## Syntax Changes from Python
67
+
68
+ Typhon retains most of Python's semantics but introduces significant syntax changes.
69
+
70
+ ### Main Changes
71
+
72
+ - **Brace Scoping**: Typhon uses `{ ... }` for blocks, replacing indentation-based scoping. Both `;` and line breaks can also act as delimiters. See [Lexical Structure](doc/reference/lexical_structure.md) for more details.
73
+ - **Static Typing**: Type checking is enforced at compile time. Currently powered by [basedpyright](https://docs.basedpyright.com/latest/) type checker.
74
+ - **Declarations**: Variables must be declared with `let` (immutable) or `var` (mutable). See [Variables](doc/reference/variables.md).
75
+
76
+ ### Syntax Extensions
77
+
78
+ - **Null Safety**: `?.`, `??`, `?()`, `?[]` operators. See [Null Safety](doc/reference/expressions/null_safety.md).
79
+ - **Function literals**: Unrestricted function literals with `(x) => { return x + 1 }` syntax, with totally the same capability as normal functions. See[Function literals](doc/reference/expressions/literals.md#function-literals).
80
+ - **Pipe Operator**: `x |> f` for function chaining. See [Pipe Operator](doc/reference/expressions/pipe_operator.md).
81
+ - **Placeholders**: `_` for concise anonymous functions (e.g., `_ + 1`). See [Placeholders](doc/reference/expressions/placeholders.md).
82
+ - **Control Comprehensions**: Control statements as expressions (e.g., `(if (c) x else y)`). All `if/while/for/let/try/with/match` are supported as comprehension. See [Comprehensions](doc/reference/expressions/comprehensions.md).
83
+ - **Pattern Matching**: Enhanced `match`, `if-let`, and `let-else` statements. See [Control Flow](doc/reference/statements/control_flow.md).
84
+ - **`self` Keyword**: `self` is a keyword and is not explicitly declared in method signatures. See [Classes](doc/reference/items/classes.md).
85
+ - **Data Records**: Anonymous immutable structs `{|x=1|}`. See [Types](doc/reference/types.md).
86
+ - **Block Comments**: `#( ... )#` allows nested comments.
87
+
88
+ ### Detailed Design Changes
89
+
90
+ - **Logical Operators**: `&&`, `||`, `!` replace `and`, `or`, `not` (though Python keywords are still reserved).
91
+ - **Const Parameters**: Function parameters are immutable by default.
92
+ - **Line Breaks**: Stricter rules for line continuations. See [Lexical Structure](doc/reference/lexical_structure.md).
93
+
94
+ ### Syntax Restrictions
95
+
96
+ Some Python features are removed to enforce safety and clarity. See [Removed Features](doc/reference/removed_features.md).
97
+
98
+ - No `del`, `global`, `nonlocal`.
99
+ - No wildcard imports.
100
+ - No chained assignments (`a = b = c`).
101
+ - No control statements inside class bodies.
102
+
103
+ ## Usage
104
+
105
+ Typhon can be run directly or translated to Python.
106
+
107
+ `.typh` files are Typhon source files. In directory mode, all `.typh` files are processed.
108
+
109
+ Note Typhon uses `.typhon` directory in source paths to place translated Python files and caches.
110
+
111
+ ### Run
112
+
113
+ Run a Typhon source file or directory.
114
+
115
+ ```bash
116
+ typhon run <source> [args...]
117
+ ```
118
+
119
+ ### Translate
120
+
121
+ Translate Typhon code to Python.
122
+
123
+ ```bash
124
+ typhon translate <source> [-o output_dir]
125
+ ```
126
+
127
+ ### Type Check
128
+
129
+ Run type checking on Typhon code.
130
+
131
+ ```bash
132
+ typhon type_check <source>
133
+ ```
134
+
135
+ ## Future Plans
136
+
137
+ See [Future Plans](doc/reference/future_plans.md) for planned features like compile-time controls (`static if`) and known limitations.
138
+
139
+ ## Influenced By
140
+
141
+ Typhon draws inspiration from several modern programming languages:
142
+
143
+ - Python
144
+ - TypeScript
145
+ - Swift
146
+ - Rust
147
+ - Scala
148
+ - F#
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "Typhon-Language"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "Typhon programming language"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,108 +1,163 @@
1
- # Typhon
2
-
3
- Typhon is a modernized syntax sugar for Python, designed to improve developer experience with features like static typing, brace-based scoping, and expressive functional programming capabilities.
4
-
5
- GitHub repository: [Typhon](https://github.com/hnakamura5/Typhon)
6
- PyPI package: [Typhon-Language](https://pypi.org/project/Typhon-Language/)
7
-
8
- ## Design Concepts
9
-
10
- Typhon is built on three core pillars:
11
-
12
- 1. **Safety**: As expected from modern programming languages, Typhon enforces safety through static typing, lexical scopes, immutable-by-default variables (`let`), and null safety features (`?.`, `??`).
13
- 2. **Expressiveness**: Expression-oriented design with functional programming features. Control comprehension forms for `if`, `match`, `try`, and so on enable concise, value-returning expressions. Function literals, placeholders and pipe operators facilitate clean and readable code.
14
- 3. **Python Interoperability**: Typhon compiles directly to Python, allowing you to use the vast ecosystem of Python libraries seamlessly while enjoying a modern syntax.
15
-
16
- ## Documentation
17
-
18
- For a complete guide to the language, please visit the **[Typhon Reference Manual](doc/reference/README.md)**.
19
-
20
- ### Quick Links
21
-
22
- - [Lexical Structure](doc/reference/lexical_structure.md) (Comments, Keywords, Delimiters)
23
- - [Types](doc/reference/types.md)
24
- - [Variables](doc/reference/variables.md)
25
- - [Expressions](doc/reference/expressions/README.md)
26
- - [Statements](doc/reference/statements/README.md)
27
- - [Definitions](doc/reference/definitions/README.md) (Functions, Classes, Modules)
28
- - [Removed Features](doc/reference/removed_features.md)
29
-
30
- ## Syntax Changes from Python
31
-
32
- Typhon retains most of Python's semantics but introduces significant syntax changes.
33
-
34
- ### Main Changes
35
-
36
- - **Brace Scoping**: Typhon uses `{ ... }` for blocks, replacing indentation-based scoping. Both `;` and line breaks can also act as delimiters. See [Lexical Structure](doc/reference/lexical_structure.md).
37
- - **Static Typing**: Type checking is enforced at compile time.
38
- - **Declarations**: Variables must be declared with `let` (immutable) or `var` (mutable). See [Variables](doc/reference/variables.md).
39
-
40
- ### Syntax Extensions
41
-
42
- - **Null Safety**: `?.`, `??`, `?()`, `?[]` operators. See [Null Safety](doc/reference/expressions/null_safety.md).
43
- - **Function literals**: Unrestricted function literals with `(x) => { return x + 1 }` syntax, with totally the same capability as normal functions. See[Function literals](doc/reference/expressions/literals.md#function-literals).
44
- - **Pipe Operator**: `x |> f` for function chaining. See [Pipe Operator](doc/reference/expressions/pipe_operator.md).
45
- - **Placeholders**: `_` for concise anonymous functions (e.g., `_ + 1`). See [Placeholders](doc/reference/expressions/placeholders.md).
46
- - **Control Comprehensions**: Control statements as expressions (e.g., `(if (c) x else y)`). All `if/while/for/let/try/with/match` are supported as comprehension. See [Comprehensions](doc/reference/expressions/comprehensions.md).
47
- - **Pattern Matching**: Enhanced `match`, `if-let`, and `let-else` statements. See [Control Flow](doc/reference/statements/control_flow.md).
48
- - **`self` Keyword**: `self` is a keyword and is not explicitly declared in method signatures. See [Classes](doc/reference/items/classes.md).
49
- - **Data Records**: Anonymous immutable structs `{|x=1|}`. See [Types](doc/reference/types.md).
50
- - **Block Comments**: `#( ... )#` allows nested comments.
51
-
52
- ### Detailed Design Changes
53
-
54
- - **Logical Operators**: `&&`, `||`, `!` replace `and`, `or`, `not` (though Python keywords are still reserved).
55
- - **Const Parameters**: Function parameters are immutable by default.
56
- - **Line Breaks**: Stricter rules for line continuations. See [Lexical Structure](doc/reference/lexical_structure.md).
57
-
58
- ### Syntax Restrictions
59
-
60
- Some Python features are removed to enforce safety and clarity. See [Removed Features](doc/reference/removed_features.md).
61
-
62
- - No `del`, `global`, `nonlocal`.
63
- - No wildcard imports.
64
- - No chained assignments (`a = b = c`).
65
- - No control statements inside class bodies.
66
-
67
- ## Usage
68
-
69
- Typhon can be run directly or translated to Python.
70
-
71
- ### Run
72
-
73
- Run a Typhon source file or directory.
74
-
75
- ```bash
76
- typhon run <source> [args...]
77
- ```
78
-
79
- ### Translate
80
-
81
- Translate Typhon code to Python.
82
-
83
- ```bash
84
- typhon translate <source> [-o output_dir]
85
- ```
86
-
87
- ### Type Check
88
-
89
- Run type checking on Typhon code.
90
-
91
- ```bash
92
- typhon type_check <source>
93
- ```
94
-
95
- ## Future Plans
96
-
97
- See [Future Plans](doc/reference/future_plans.md) for planned features like compile-time controls (`static if`) and known limitations.
98
-
99
- ## Influenced By
100
-
101
- Typhon draws inspiration from several modern programming languages:
102
-
103
- - Python
104
- - TypeScript
105
- - Swift
106
- - Rust
107
- - Scala
108
- - F#
1
+ Metadata-Version: 2.4
2
+ Name: Typhon-Language
3
+ Version: 0.1.2
4
+ Summary: Typhon programming language
5
+ Requires-Python: >=3.12
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: basedpyright>=1.32.1
9
+ Requires-Dist: fire>=0.7.1
10
+ Requires-Dist: intervaltree>=3.1.0
11
+ Requires-Dist: pegen>=0.3.0
12
+ Requires-Dist: pytest>=8.4.1
13
+ Requires-Dist: ruff>=0.12.5
14
+ Dynamic: license-file
15
+
16
+ # Typhon
17
+
18
+ Typhon is a modernized syntax sugar for Python, designed to improve developer experience with features like static typing, brace-based scoping, and expressive functional programming capabilities.
19
+
20
+ - GitHub repository: [Typhon](https://github.com/hnakamura5/Typhon)
21
+ - PyPI package: [Typhon-Language](https://pypi.org/project/Typhon-Language/)
22
+ - VSCode extension: [Typhon Language Support](https://marketplace.visualstudio.com/items?itemName=hnakamura5.typhon-language-support) from [GitHub Repository](https://github.com/hnakamura5/typhon-language-support)
23
+
24
+ ## Getting Started
25
+
26
+ Install Typhon via pip:
27
+
28
+ ```bash
29
+ pip install typhon-language
30
+ ```
31
+
32
+ Run Typhon from the command line:
33
+
34
+ ```bash
35
+ typhon --help
36
+ ```
37
+ Create a simple Typhon program in `hello.typh`:
38
+
39
+ ```typhon
40
+ def main() {
41
+ print("Hello, Typhon!")
42
+ }
43
+ main()
44
+ ```
45
+
46
+ Run the program:
47
+
48
+ ```bash
49
+ typhon run hello.typh
50
+ ```
51
+
52
+ Or run directly using uvx:
53
+
54
+ ```bash
55
+ uvx --from typhon-language typhon run hello.typh
56
+ ```
57
+
58
+
59
+ ## Design Concepts
60
+
61
+ Typhon is built on three core pillars:
62
+
63
+ 1. **Safety**: As expected in modern programming languages, Typhon enforces safety through static typing, lexical scopes, immutable-by-default variables (`let`), and null safety features (`?.`, `??`, `?()`, `?[]`).
64
+ 2. **Expressiveness**: Expression-oriented design with functional programming features. Control comprehension forms for `if`, `match`, `try`, and so on enable concise, value-returning expressions. Function literals, placeholders and pipe operators facilitate clean and readable code.
65
+ 3. **Python Interoperability**: Typhon compiles directly to Python, allowing you to use the vast ecosystem of Python libraries seamlessly while enjoying a modern syntax.
66
+
67
+ ## Documentation
68
+
69
+ For a complete guide to the language, please visit the **[Typhon Reference Manual](doc/reference/README.md)**.
70
+
71
+ ### Quick Links
72
+
73
+ - [Lexical Structure](doc/reference/lexical_structure.md) (Comments, Keywords, Delimiters)
74
+ - [Types](doc/reference/types.md)
75
+ - [Variables](doc/reference/variables.md)
76
+ - [Expressions](doc/reference/expressions/README.md)
77
+ - [Statements](doc/reference/statements/README.md)
78
+ - [Definitions](doc/reference/definitions/README.md) (Functions, Classes, Modules)
79
+ - [Removed Features](doc/reference/removed_features.md)
80
+
81
+ ## Syntax Changes from Python
82
+
83
+ Typhon retains most of Python's semantics but introduces significant syntax changes.
84
+
85
+ ### Main Changes
86
+
87
+ - **Brace Scoping**: Typhon uses `{ ... }` for blocks, replacing indentation-based scoping. Both `;` and line breaks can also act as delimiters. See [Lexical Structure](doc/reference/lexical_structure.md) for more details.
88
+ - **Static Typing**: Type checking is enforced at compile time. Currently powered by [basedpyright](https://docs.basedpyright.com/latest/) type checker.
89
+ - **Declarations**: Variables must be declared with `let` (immutable) or `var` (mutable). See [Variables](doc/reference/variables.md).
90
+
91
+ ### Syntax Extensions
92
+
93
+ - **Null Safety**: `?.`, `??`, `?()`, `?[]` operators. See [Null Safety](doc/reference/expressions/null_safety.md).
94
+ - **Function literals**: Unrestricted function literals with `(x) => { return x + 1 }` syntax, with totally the same capability as normal functions. See[Function literals](doc/reference/expressions/literals.md#function-literals).
95
+ - **Pipe Operator**: `x |> f` for function chaining. See [Pipe Operator](doc/reference/expressions/pipe_operator.md).
96
+ - **Placeholders**: `_` for concise anonymous functions (e.g., `_ + 1`). See [Placeholders](doc/reference/expressions/placeholders.md).
97
+ - **Control Comprehensions**: Control statements as expressions (e.g., `(if (c) x else y)`). All `if/while/for/let/try/with/match` are supported as comprehension. See [Comprehensions](doc/reference/expressions/comprehensions.md).
98
+ - **Pattern Matching**: Enhanced `match`, `if-let`, and `let-else` statements. See [Control Flow](doc/reference/statements/control_flow.md).
99
+ - **`self` Keyword**: `self` is a keyword and is not explicitly declared in method signatures. See [Classes](doc/reference/items/classes.md).
100
+ - **Data Records**: Anonymous immutable structs `{|x=1|}`. See [Types](doc/reference/types.md).
101
+ - **Block Comments**: `#( ... )#` allows nested comments.
102
+
103
+ ### Detailed Design Changes
104
+
105
+ - **Logical Operators**: `&&`, `||`, `!` replace `and`, `or`, `not` (though Python keywords are still reserved).
106
+ - **Const Parameters**: Function parameters are immutable by default.
107
+ - **Line Breaks**: Stricter rules for line continuations. See [Lexical Structure](doc/reference/lexical_structure.md).
108
+
109
+ ### Syntax Restrictions
110
+
111
+ Some Python features are removed to enforce safety and clarity. See [Removed Features](doc/reference/removed_features.md).
112
+
113
+ - No `del`, `global`, `nonlocal`.
114
+ - No wildcard imports.
115
+ - No chained assignments (`a = b = c`).
116
+ - No control statements inside class bodies.
117
+
118
+ ## Usage
119
+
120
+ Typhon can be run directly or translated to Python.
121
+
122
+ `.typh` files are Typhon source files. In directory mode, all `.typh` files are processed.
123
+
124
+ Note Typhon uses `.typhon` directory in source paths to place translated Python files and caches.
125
+
126
+ ### Run
127
+
128
+ Run a Typhon source file or directory.
129
+
130
+ ```bash
131
+ typhon run <source> [args...]
132
+ ```
133
+
134
+ ### Translate
135
+
136
+ Translate Typhon code to Python.
137
+
138
+ ```bash
139
+ typhon translate <source> [-o output_dir]
140
+ ```
141
+
142
+ ### Type Check
143
+
144
+ Run type checking on Typhon code.
145
+
146
+ ```bash
147
+ typhon type_check <source>
148
+ ```
149
+
150
+ ## Future Plans
151
+
152
+ See [Future Plans](doc/reference/future_plans.md) for planned features like compile-time controls (`static if`) and known limitations.
153
+
154
+ ## Influenced By
155
+
156
+ Typhon draws inspiration from several modern programming languages:
157
+
158
+ - Python
159
+ - TypeScript
160
+ - Swift
161
+ - Rust
162
+ - Scala
163
+ - F#
File without changes