mirror of
https://github.com/usatiuk/psil.git
synced 2025-10-28 02:37:48 +01:00
more docs
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
# CMake
|
# CMake
|
||||||
cmake-build-*/
|
cmake-build-*/
|
||||||
|
build/
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
# Mongo Explorer plugin
|
||||||
.idea/**/mongoSettings.xml
|
.idea/**/mongoSettings.xml
|
||||||
|
|||||||
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -3,6 +3,7 @@
|
|||||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
<component name="CidrRootsConfiguration">
|
<component name="CidrRootsConfiguration">
|
||||||
<excludeRoots>
|
<excludeRoots>
|
||||||
|
<file path="$PROJECT_DIR$/build" />
|
||||||
<file path="$PROJECT_DIR$/cmake-build-debug" />
|
<file path="$PROJECT_DIR$/cmake-build-debug" />
|
||||||
<file path="$PROJECT_DIR$/cmake-build-release" />
|
<file path="$PROJECT_DIR$/cmake-build-release" />
|
||||||
<file path="$PROJECT_DIR$/cmake-build-relwithdebinfo" />
|
<file path="$PROJECT_DIR$/cmake-build-relwithdebinfo" />
|
||||||
|
|||||||
52
README.md
52
README.md
@@ -13,6 +13,8 @@ cmake --build build --parallel $(nproc)
|
|||||||
|
|
||||||
should be enough (you can also change the build type for Release and disable sanitize in case it's too slow)
|
should be enough (you can also change the build type for Release and disable sanitize in case it's too slow)
|
||||||
|
|
||||||
|
Pro-tip: all these snippets can be conveniently run from an IDE if it supports it (at least clion does)
|
||||||
|
|
||||||
## How to run tests
|
## How to run tests
|
||||||
|
|
||||||
Unit tests (assuming build in `build`):
|
Unit tests (assuming build in `build`):
|
||||||
@@ -29,7 +31,7 @@ PSIL="../build/src/psil" clitests/testall.sh
|
|||||||
|
|
||||||
# How to use
|
# How to use
|
||||||
|
|
||||||
You can just run the executable and you'll be in REPL mode,
|
You can just run the executable and you'll be in REPL mode (ctrl-c to exit should work),
|
||||||
or specify an input file like `-f <file>`, the effect is the same as if you
|
or specify an input file like `-f <file>`, the effect is the same as if you
|
||||||
had put it there yourself.
|
had put it there yourself.
|
||||||
|
|
||||||
@@ -39,12 +41,50 @@ When reading from a file, REPL is still enabled by default and can be disabled w
|
|||||||
|
|
||||||
You can also change some of the behaviours of the interpreter:
|
You can also change some of the behaviours of the interpreter:
|
||||||
|
|
||||||
|
`--cell_limit:limit` (for example `--cell_limit:10000`) - limit the amount of cells that can be used
|
||||||
|
|
||||||
|
`--command_strs[+/-]` (for example `--command_strs+`) - use string representation of commands, useful for debugging the
|
||||||
|
compiler with verbose logging
|
||||||
|
|
||||||
|
`--default_log_level:level` (for example `--default_log_level:3`) - change the default logging level
|
||||||
|
|
||||||
|
`--repl[+/-]` (for example `--repl-`) - enable/disable repl
|
||||||
|
|
||||||
|
`--gc_threshold:threshold` (for example `--gc_threshold:70`) - percentage of cell_limit at which concurrent gc is
|
||||||
|
triggered
|
||||||
|
|
||||||
|
### Log options
|
||||||
|
|
||||||
|
Log can be configured in format of `--log:TAG:LEVEL` (for example `--log:VM:3`)
|
||||||
|
|
||||||
|
Where level is a number from 0 to 4 (0 - no logs, 4 - most logs)
|
||||||
|
|
||||||
|
Possible values for tags are:
|
||||||
|
|
||||||
|
`MemoryContext` - at level 2 it will print GC stats for each run, level 3 a little more stats, level 4 is debugging mode
|
||||||
|
|
||||||
|
`Compiler` - level 3 will print the compilation result of everything evaluated, you also probably want to
|
||||||
|
have `--command_strs+` enabled with it
|
||||||
|
|
||||||
|
`VM` - level 3 will print function application and return info, level 4 is debugging mode which will print every
|
||||||
|
instruction and the machine state before/after
|
||||||
|
|
||||||
|
# Some cooler examples
|
||||||
|
|
||||||
|
See the GC in action:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
--cell_limit:limit (for example --cell_limit:10000) - limit the amount of cells that can be used
|
build/src/psil -f clitests/fib.psil --repl- --log:Compiler:3 --command_strs+ --cell_limit:10000 --gc_threshold:10 --log:MemoryContext:2
|
||||||
--command_strs[+/-] (for example --command_strs+) - use string representation of commands, useful
|
|
||||||
for debugging the compiler with verbose logging
|
|
||||||
--default_log_level:level (for example --default_log_level:3) - change the default logging level
|
|
||||||
--repl[+/-] (for example --repl-) - enable/disable repl
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
See a tree of function applications:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
build/src/psil -f clitests/coffee.psil --repl- --log:Compiler:3 --command_strs+ --log:VM:3
|
||||||
|
```
|
||||||
|
|
||||||
|
Super debug mode:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
build/src/psil -f clitests/decorate.psil --repl- --command_strs+ --default_log_level:4 --log:MemoryContext:3
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user