phelt

Version, currently master branch1 version
  • master branchlatestAug 22, 2020

github.com/benphelps/phelt-cr

phelt is a toy programming language

3 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  phelt:
    github: benphelps/phelt-cr
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.35.1
License
MIT
Author
Ben Phelps
Target
  • phelt from src/phelt.cr

Dependencies

Runtime Dependencies

  • debug*github: Sija/debug.cr

README

phelt

Build Status

phelt is a toy programming language.

Features

phelt is based on Monkey, as implemented in the Interpreter Book, with the following additions:

  • Run code from files, not just a REPL.
  • Improved error reporting, including line and column information.
  • 64 bit Floats & Integers.
  • Infix assignment operators =, +=, -=, *= /=.
  • Additional comparsion operators, <=, >=.
  • do { } blocks for scoped expressions.
  • For loops, for(initial; condition; final) { break; } & while loops, `while(condition) { break; }`.
  • eval() for executing code from string input.
  • Arrays are mutable, with an extended array toolset.
  • Truly constant constants, once defined they can never be redefined, regardless of scope.
  • Fully reworked hashes. Hash keys are limited to identifiers and integers. You can access as well as index hash entries, hash.entry or hash["entry"] both work.
    • This allows for some level of pseudo-class functionality.
    • This may be expanded upon in the future by implementing meta-functions on hashes.
  • Pseudo object functionality built using hashes.
    • When calling a function on an object (eg. [1, 2, 3].first), the functions object type is mapped to an internal hash. The hash stores functions callable on that object type.
    • See environment.ph for functionality built unsing phelt it's self.

Installation

Once you have Crystal setup locally, simply run:

shards build phelt

The phelt interpreter can be found in the bin/ directory.

Usage

Usage: phelt [command] [program file]
    -v, --version                    Show version
    -h, --help                       Show help
    -d, --debugger                   Interactive Debugger
    -i, --interactive                Interactive REPL

Contributing

  1. Fork it (https://github.com/benphelps/phelt/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors