A swift interpreter written in python allowing swift code to be ran on any platform that supports python.
Run the python swift interpreter with the following command
py swift.py [<*.swift file to be run>]
If no *.swift file is given, swift's REPL will start.
The main script that either runs a .swift file or if none is given, starts a REPL session.
Contains the class that parses swift code and runs code from swiftLang
and stdlib
Contains the modules to support the base swift language.
All module names begin with lang_
Each module is named after the section it's found in in swift.org's Summary of Grammar.
For example, everything defined under GRAMMAR OF WHITESPACE should be defined in the file lang_whitespace.py
Contains implementations in python of Apple's own stdlib
Internal folder structure matches Apple's.
Eventually the ability to read directly from the .swift files defined in Apple's own stdlib should be added as to not have to reinvent the wheel in python. May not happen for libraries that interface with things like stdout (Print.swift).
All module names begin with the parent folder's name followed by an underscore.
For example, the equivalent of Print.swift
is named core_print.py
Grammar | Complete | Comment |
---|---|---|
Whitespace | ❌ | Only comment complete |
Identifier | ❌ | |
Literal | ❌ | |
Integer Literal | ❌ | |
Floating Point Literal | ❌ | |
String Literal | ❌ | |
Operators | ❌ |
Grammar | Complete | Comment |
---|---|---|
Type | ❌ | |
Type Annotation | ❌ | |
Type Identifier | ❌ | |
Tuple Type | ❌ | |
Function Type | ❌ | |
Array Type | ❌ | |
Dictionary Type | ❌ | |
Optional Type | ❌ | |
Implicitly Unwrapped Optional Type | ❌ | |
Protocol Composition Type | ❌ | |
Metatype Type | ❌ | |
Type Inheritance Clause | ❌ |
Grammar | Complete | Comment |
---|
Grammar | Complete | Comment |
---|
Grammar | Complete | Comment |
---|
Grammar | Complete | Comment |
---|
Grammar | Complete | Comment |
---|
Grammar | Complete | Comment |
---|
TODO