phelt-cr
phelt
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
orhash["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.
- When calling a function on an object (eg.
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
- Fork it (https://github.com/benphelps/phelt/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Ben Phelps - creator and maintainer
Repository
phelt-cr
Owner
Statistic
- 3
- 0
- 1
- 0
- 1
- about 4 years ago
- August 1, 2020
License
MIT License
Links
Synced at
Thu, 07 Nov 2024 21:27:36 GMT
Languages