Skip to content

RohitDas/hython

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#hython

A Python 3 interpreter implemented in Haskell.

The goal of this project is to become more familiar with Haskell. It is not to produce a replacement for CPython or PyPy. I would like to implement as much of the core language as I can. While I list features out below, they're more for me to remember what I have remaining in each part of the project.

Features

Lexical Analysis

  • Line comments
  • Significant indentation
  • Integer literals
  • Floating point literals
  • Imaginary literals
  • Single quoted string literals
  • Double quoted string literals
  • Triple quoted string literals
  • String escape sequences
  • Byte literals
  • All operators, delimiters, and keywords
  • Implicit line joining in collections
  • Explicit line joining via \\

Parsing

  • Scalar literals
  • Adjacent string literal concatenation
  • Function calls
  • Attribute access
  • Tuples
  • List literals
  • List comprehensions
  • Dictionary literals
  • Subscript operators
  • Set literals
  • All arithmetic operators
  • All bitwise operators
  • All boolean operators
  • All comparison operators
  • assert statement
  • break statement
  • class statement
  • def statement
  • del statement
  • for statement
  • global statement
  • if/elif/else statements
  • import statement (and friends)
  • lambda statement
  • nonlocal statement
  • pass statement
  • raise statement
  • return statement
  • try statement
  • while statement
  • with statement
  • yield statement
  • Keyword arguments to functions
  • Default arguments to functions

Interpreter

  • print built-in function
  • Variable assignment and retrieval
  • Loop control flow
  • Function control flow
  • Scoping (basic)
  • Functions
  • Classes
  • Inheritance
  • Modules
  • Exception handling
  • Generators
  • Standard built-in functions
  • Built-in exception types

Running

To build:

$ make

To test:

$ make test

Reference

About

Haskell-powered Python 3 interpreter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published