Move reader and printer packages to the core package

This commit is contained in:
Sameer Rahmani 2020-11-15 19:33:16 +00:00
parent 95ec031ce6
commit 38baf577bb
3 changed files with 6 additions and 11 deletions

View File

@ -23,13 +23,11 @@ import (
"fmt" "fmt"
"github.com/chzyer/readline" "github.com/chzyer/readline"
"serene-lang.org/bootstrap/pkg/printer"
"serene-lang.org/bootstrap/pkg/reader"
"serene-lang.org/bootstrap/pkg/runtime" "serene-lang.org/bootstrap/pkg/runtime"
) )
func rep(rt *runtime.Runtime, line string) { func rep(rt *runtime.Runtime, line string) {
ast, err := reader.ReadString(line) ast, err := ReadString(line)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -37,8 +35,8 @@ func rep(rt *runtime.Runtime, line string) {
if rt.IsDebugMode() { if rt.IsDebugMode() {
fmt.Println("\n### DEBUG ###") fmt.Println("\n### DEBUG ###")
printer.Print(rt, ast) Print(rt, ast)
fmt.Println("#############\n") fmt.Print("#############\n\n")
} }
result, err := Eval(rt, ast) result, err := Eval(rt, ast)
@ -47,7 +45,7 @@ func rep(rt *runtime.Runtime, line string) {
return return
} }
printer.Print(rt, result) Print(rt, result)
} }
/** TODO: /** TODO:

View File

@ -16,8 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Package printer contains helper functions to printout AST and exprs package core
package printer
import ( import (
"fmt" "fmt"

View File

@ -16,9 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Package reader provides a set of functions to read forms from several package core
// different mediums
package reader
import ( import (
"serene-lang.org/bootstrap/pkg/parser" "serene-lang.org/bootstrap/pkg/parser"