diff --git a/lexer/lexer.go b/lexer/lexer.go index bdbc429..b8eec36 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -1,8 +1,6 @@ package lexer -import ( - "github.com/sashakoshka/arf/file" -) +import "github.com/sashakoshka/arf/file" // LexingOperation holds information about an ongoing lexing operataion. type LexingOperation struct { diff --git a/lexer/token.go b/lexer/token.go index 9ab4b2a..36e5420 100644 --- a/lexer/token.go +++ b/lexer/token.go @@ -1,8 +1,6 @@ package lexer -import ( - "github.com/sashakoshka/arf/file" -) +import "github.com/sashakoshka/arf/file" // TokenKind is an enum represzenting what role a token has. type TokenKind int diff --git a/main.go b/main.go new file mode 100644 index 0000000..b475b96 --- /dev/null +++ b/main.go @@ -0,0 +1,23 @@ +package arf + +import "os" +import "io" +import "path/filepath" +import "github.com/sashakoshka/arf/lexer" + +func CompileModule (modulePath string, output io.Writer) (err error) { + moduleFiles, err := os.ReadDir(modulePath) + if err != nil { return err } + + var moduleTokens []lexer.Token + for _, entry := range moduleFiles { + if filepath.Ext(entry.Name()) != ".arf" || entry.IsDir() { + continue + } + + tokens, err := lexer.Tokenize() + if err != nil { return err } + } + + return +}