diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba2906d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +main diff --git a/README.md b/README.md index ddb9b07..fcfd17b 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,44 @@ igo A simple interactive Go interpreter built on [go-eval](https://github.com/sbinet/go-eval) with some readline-like refinements +## Setting up + +```sh + +$ git clone git@github.com:sbinet/igo.git +$ cd igo +$ go install +$ go build main.go +$ ./main + +******************************** +** Interactive Go interpreter ** +******************************** + + +igo> + +``` + +You can add compiled main file to your bash file for easy access from anywhere: + +``` sh + +$ echo 'alias igo="$PWD/main"' >> ~/.bash_profile +$ source ~/.bash_profile +$ igo + +******************************** +** Interactive Go interpreter ** +******************************** + +igo> println("Hello, World!") +Hello, World! +igo> + +``` + + ## Example @@ -14,7 +52,7 @@ hello world igo> type Foo struct { ... A int ... } -... +... igo> foo := Foo{A:32} igo> foo {32} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..1142352 --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module igo + +go 1.14 + +require ( + github.com/peterh/liner v1.2.0 + github.com/sbinet/go-eval v0.0.0-20160521182218-34e015998e32 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..330d907 --- /dev/null +++ b/go.sum @@ -0,0 +1,6 @@ +github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4= +github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/peterh/liner v1.2.0 h1:w/UPXyl5GfahFxcTOz2j9wCIHNI+pUPr2laqpojKNCg= +github.com/peterh/liner v1.2.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/sbinet/go-eval v0.0.0-20160521182218-34e015998e32 h1:RqyVn2fzuaVCGTWwJ6j7wohwNeFO0s1WdSYGo1KMWfE= +github.com/sbinet/go-eval v0.0.0-20160521182218-34e015998e32/go.mod h1:tUT5A+RkN5QvJhO6P9cY0JGX1bBStjLdsWcb+qbLuMM=