Giter VIP home page Giter VIP logo

swiftinterpreter's Introduction

swiftInterpreter

A swift interpreter written in python allowing swift code to be ran on any platform that supports python.

Running

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.

Project Organization

swift.py

The main script that either runs a .swift file or if none is given, starts a REPL session.

interpreter.py

Contains the class that parses swift code and runs code from swiftLang and stdlib

swiftLang

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

stdlib

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

Project Progress

swiftLang

Lexical Structure

Grammar Complete Comment
Whitespace Only comment complete
Identifier
Literal
Integer Literal
Floating Point Literal
String Literal
Operators

Types

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

Expressions

Grammar Complete Comment

Statements

Grammar Complete Comment

Declarations

Grammar Complete Comment

Attributes

Grammar Complete Comment

Patterns

Grammar Complete Comment

Generic Parameters and Arguments

Grammar Complete Comment

stdlib

TODO

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.