Improved documentation
This commit is contained in:
parent
a7afd680da
commit
8974b8b0aa
12
README.md
12
README.md
@ -56,9 +56,15 @@ q build examples/hello --dry
|
|||||||
The `Build` type defines all the information needed to start building an executable file.
|
The `Build` type defines all the information needed to start building an executable file.
|
||||||
The name of the executable will be equal to the name of the build directory.
|
The name of the executable will be equal to the name of the build directory.
|
||||||
|
|
||||||
`Run` starts the build which will scan all files in the build directory.
|
`Run` starts the build which will scan all `.q` source files in the build directory.
|
||||||
The functions found in the scan will be translated to generic assembler instructions.
|
Every source file is scanned in its own goroutine for performance reasons.
|
||||||
All the functions that are required to run the program will be added to final assembler.
|
Parallelization here is possible because the order of code in a directory is not significant.
|
||||||
|
|
||||||
|
The main function is meanwhile waiting for new function objects to arrive from the scanners.
|
||||||
|
Once a function has arrived, it will create another goroutine for the function compilation.
|
||||||
|
The function will then be translated to generic assembler instructions.
|
||||||
|
|
||||||
|
All the functions that are required to run the program will be added to the final assembler.
|
||||||
The final assembler resolves label addresses, optimizes the performance and generates the specific x86-64 machine code from the generic instruction set.
|
The final assembler resolves label addresses, optimizes the performance and generates the specific x86-64 machine code from the generic instruction set.
|
||||||
|
|
||||||
The `Run` method is currently not fully implemented.
|
The `Run` method is currently not fully implemented.
|
||||||
|
2
go.mod
2
go.mod
@ -1,5 +1,5 @@
|
|||||||
module git.akyoto.dev/cli/q
|
module git.akyoto.dev/cli/q
|
||||||
|
|
||||||
go 1.21
|
go 1.22
|
||||||
|
|
||||||
require git.akyoto.dev/go/assert v0.1.3
|
require git.akyoto.dev/go/assert v0.1.3
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
// Scan scans the directory.
|
// Scan scans the directory.
|
||||||
func Scan(path string) (<-chan *Function, <-chan error) {
|
func Scan(path string) (<-chan *Function, <-chan error) {
|
||||||
functions := make(chan *Function, 16)
|
functions := make(chan *Function)
|
||||||
errors := make(chan error)
|
errors := make(chan error)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -7,6 +7,7 @@ type InvalidDirectory struct {
|
|||||||
Path string
|
Path string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error implements the text representation.
|
||||||
func (err *InvalidDirectory) Error() string {
|
func (err *InvalidDirectory) Error() string {
|
||||||
if err.Path == "" {
|
if err.Path == "" {
|
||||||
return "Invalid directory"
|
return "Invalid directory"
|
||||||
|
Loading…
Reference in New Issue
Block a user