- Notifications
You must be signed in to change notification settings - Fork2
REPL Interface wrapping Crystal Interpreter (crystal-i).
License
I3oris/ic
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
IC, forInteractive Crystal, is anREPL interface forCrystal Interpreter.
It allows to quickly try and test some crystal code, or debug your code thanks to crystalpry
.
- Crystal Interpretation (Indeed!)
- Syntax highlighting
- Multiline input
- Auto formatting
- Auto indentation
- Auto completion (Experimental)
- History
- Pasting of large expressions
- Debugger
The Crystal interpreter is experimental and not yet released, some issue can still occur while interpreting.
You need to install the same dependencies as the crystal compiler, follow the instructionshere. If you have already installed crystal from source, you can skip this step.
git clone https://github.com/I3oris/ic.gitcd icmake# => bin/ic
make release
This is a bit long, and require at least 4.5 GB of available RAM.
Install IC at/usr/local/
sudo make install
Add this to yourshard.yml
file:
development_dependencies:ic:github:I3oris/ic
And runshards install
ic
# say_hello.crname=ARGV[0]?puts"Hello#{name}!"
ic say_hello.cr World
On a file use the macrodebugger
:
# say_hello.crdebugger# <= will start the debugger at this pointname=ARGV[0]?puts"Hello#{name}!"
Then, just run IC:ic say_hello.cr World
.
You will see the current position on your code:
1:# say_hello.cr 2: 3: debugger# <= will start the debugger at this point => 4: name=ARGV[0]? 5:puts"Hello#{name}!" 6:
On thepry
prompt you can type:
next
: To jump to the next instruction (without entering into functions).step
: To jump to the next instruction (entering into functions if possible).finish
: To jump out of the current function.whereami
: To re-display where the execution is.- Other : To interpret code while debugging (e.g. the name of a variable).
alt-enter
(ctrl-enter
on Windows): Insert a new line character instead of submit edition.ctrl-c
: Keyboard Interruption.ctrl-d
: Delete char or exit (EOF).ctrl-a
/home
: Move cursor to begin.ctrl-e
/end
: Move cursor to end.ctrl-k
: Delete after cursor.ctrl-u
: Delete before cursor.alt-backspace
/ctrl-backspace
: Delete word afteralt-d
/ctrl-delete
: Delete word before.alt-f
/ctrl-right
: Move word forward.alt-b
/ctrl-left
: Move word backward.ctrl-up
/down
: On long multiline input: scroll up/down the view.ctrl-n
/ctrl-p
: Move cursor up/down.ctrl-b
/ctrl-f
: Move cursor backward/forward.
Only on debugger (pry):
ctrl-up
:whereami
ctrl-down
:next
ctrl-left
:finish
ctrl-right
:step
History is saved in<home>/.ic_history
and is limited to 10_000 entries. It can be changed with environment variablesIC_HISTORY_FILE
andIC_HISTORY_SIZE
. UseIC_HISTORY_FILE=""
to disable saving history in a file.
You can type the following commands:
# clear_history
: Clear history.# reset
: Reset the interpreter (clean all definitions, variables, constants, ...)
- Fork it (https://github.com/I3oris/ic/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
- I3oris - creator and maintainer
About
REPL Interface wrapping Crystal Interpreter (crystal-i).