Created stub high-level module compilation function

This commit is contained in:
Sasha Koshka 2022-08-08 03:08:50 -04:00
parent 93f0ac945f
commit e8f6165f38
3 changed files with 25 additions and 6 deletions

View File

@ -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 {

View File

@ -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

23
main.go Normal file
View File

@ -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
}