Skip to content

Latest commit

 

History

History
106 lines (83 loc) · 2.89 KB

README.md

File metadata and controls

106 lines (83 loc) · 2.89 KB

impe

An imperative, interpreted, simple, extendible language.

interpreting consists of these steps:

  1. parsing
  2. typing
  3. executing

Grammar

Tools

This project demonstrates the following tools:

Features

  • mutable variables
  • branching (if ... then ... else ...)
  • looping (while ... do ... )
  • functions
    • nested function definitions
    • nested scope capturing
  • procedures (functions that don't return a value)

Motivation

Prelude

The following functions are pre-defined:

_~_  :: (bool) -> bool
_&&_ :: (bool, bool) -> bool
_||_ :: (bool, bool) -> bool
show_bool :: (bool) -> string

_+_  :: (int, int) -> int
_-_  :: (int, int) -> int
_*_  :: (int, int) -> int
_/_  :: (int, int) -> int
_^_  :: (int, int) -> int
_%_  :: (int, int) -> int
_=_  :: (int, int) -> bool
_<_  :: (int, int) -> bool
_<=_ :: (int, int) -> bool
_>_  :: (int, int) -> bool
_>=_ :: (int, int) -> bool
show_int :: (int) -> string

_<>_  :: (string, string) -> string
write :: (string) -> void
read  :: () -> string

To Do

  • optimize execution by stopping execution of function once a return has been reached

  • parsing infixed operators

  • Initialization grammar construct

  • finish implementing writing to output file (all at once) - rather than handling logs by IO printing, instead tell writer at startInterpret's level

  • finish implementing reading from input file

  • organize imports/exports names

  • better organization for executing and parsing primitive functions and variables

  • error(exception) and warning codes (as ADTs)

  • parse config of verbosity

  • customize verbosity of logs throughout program

  • organize effects by newtype-wrapping logs and errors

  • abstract away interpreting programs/instruction/expression somehow

  • Main.Config module for grammar/parsing of command-line options

  • redefine synonyms to use Member <effect> r => Sem r <type> rather than explicitly defining a list of effects

  • error on duplicate names in same scope (requires using nested scoping in typechecking, so probably would be a good idea to just make a general data structure to use for both).

  • finish making new modulization for all REPL stuff

    • grammar
    • parsing
    • typing/executing/interpreting
    • commands
    • interface

Experimental

  • pointers (perhaps define whole new language for this)
  • better type and execution errors e.g. line numbers and better messages (redue the amount of abstraction for errors and stuff i.e. give message in place for each error)