Simplified file structure
This commit is contained in:
38
src/core/NewFunction.go
Normal file
38
src/core/NewFunction.go
Normal file
@ -0,0 +1,38 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/arch/x64"
|
||||
"git.akyoto.dev/cli/q/src/asm"
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/cli/q/src/fs"
|
||||
"git.akyoto.dev/cli/q/src/register"
|
||||
"git.akyoto.dev/cli/q/src/scope"
|
||||
"git.akyoto.dev/cli/q/src/token"
|
||||
)
|
||||
|
||||
// NewFunction creates a new function.
|
||||
func NewFunction(pkg string, name string, file *fs.File, body []token.Token) *Function {
|
||||
return &Function{
|
||||
Package: pkg,
|
||||
Name: name,
|
||||
UniqueName: pkg + "." + name,
|
||||
File: file,
|
||||
Body: body,
|
||||
Machine: register.Machine{
|
||||
Assembler: asm.Assembler{
|
||||
Instructions: make([]asm.Instruction, 0, 8),
|
||||
},
|
||||
Stack: scope.Stack{
|
||||
Scopes: []*scope.Scope{{}},
|
||||
},
|
||||
CPU: cpu.CPU{
|
||||
All: x64.AllRegisters,
|
||||
General: x64.GeneralRegisters,
|
||||
Input: x64.InputRegisters,
|
||||
Output: x64.OutputRegisters,
|
||||
SyscallInput: x64.SyscallInputRegisters,
|
||||
SyscallOutput: x64.SyscallOutputRegisters,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user