A quick documentation on how to run a pocketlang program locally (#45)

* A quick documentation on how to run a pocketlang program locally

With a small factorial program written in pocketlang and executed
on the terminal, this demonstrates how to execute a script on a
loalhost using pocketlang binary

* Apply changes requested in review #1
This commit is contained in:
Derick Alangi 2021-06-08 17:21:15 +01:00 committed by GitHub
parent 63d3039eeb
commit 595f120ecd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,30 @@ It's a [WebAssembly](https://webassembly.org/) build of the VM compiled using [e
Note that in the webassembly version of the language, some features (input, relative import, etc.) have disabled, has Note that in the webassembly version of the language, some features (input, relative import, etc.) have disabled, has
limited memory allocations, and the IO calls might be slower. limited memory allocations, and the IO calls might be slower.
### On Your System
NOTE: Make sure you've compiled the `pocketlang` source code and you have the `pocket` binary in `build/debug/`.
Copy/paste or type in the following factorial code in any editor of your choice:
```ruby
# A recursive factorial function
def fac(n)
if n == 0 then return 1 end
return n*fac(n-1)
end
# Prints all factorials from 0 to 10 exclusive.
print('Factorial of 0 - 9\n')
for i in 0..10
print(fac(i))
end
```
Save the file as `factorial.pk` and execute it from your pocketlang directory with: `./build/debug/pocket <path-to-factorial.wren>/factorial.pk`.
This should print out the output of the factorial program in your STDOUT (terminal).
## Documentation ## Documentation
The pocketlang documentation is hosted at https://thakeenathees.github.io/pocketlang/ which The pocketlang documentation is hosted at https://thakeenathees.github.io/pocketlang/ which