From 362f7c9c45598b429c92e67756f41b690043e0c4 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 22 Mar 2024 16:59:25 +0100 Subject: feat: add initial support for import, provide minimal fmt (#6) The `import` statement is now parsed. It only provides minimal support for the `fmt` package (only `Println` symbol is defined). This should be sufficient to pass a few tests. Full support of package namespaces, source and binary imports will be supported later, based on this work. --- parser/package.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 parser/package.go (limited to 'parser/package.go') diff --git a/parser/package.go b/parser/package.go new file mode 100644 index 0000000..f03c59f --- /dev/null +++ b/parser/package.go @@ -0,0 +1,15 @@ +package parser + +import ( + "fmt" + + "github.com/mvertes/parscan/vm" +) + +var packages = map[string]map[string]vm.Value{ + "fmt": fmtPkg, +} + +var fmtPkg = map[string]vm.Value{ + "Println": vm.ValueOf(fmt.Println), +} -- cgit v1.2.3