From c9699d64e3fefef3ccd1a8be116b1edab6d87578 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Thu, 10 Dec 2020 17:07:42 -0600 Subject: [PATCH] started laying out what needs to be done --- CHANGELOG | 12 +++++++++++ core/file.onyx | 56 ++++++++++++++++++++++++++++++++++++++++++-------- docs/todo | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 9 deletions(-) create mode 100644 docs/todo diff --git a/CHANGELOG b/CHANGELOG index c6e364df..f9816a44 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,15 @@ +Release v0.0.5 +-------------- +Additions: + +Removals: + +Changes: + +Bug fixes: + + + Release v0.0.4 -------------- Additions: diff --git a/core/file.onyx b/core/file.onyx index c107ddd8..0305ba7c 100644 --- a/core/file.onyx +++ b/core/file.onyx @@ -22,15 +22,46 @@ open :: proc (file: ^File, path: string, mode := OpenMode.Read, flags := FDFlags DIR_FD :: 3; open_flags := cast(OFlags) 0; - rights := Rights.DataSync - | Rights.Sync - | Rights.FilestatGet - | Rights.FilestatSetSize - | Rights.FilestatSetTimes - | Rights.Advise - | Rights.Allocate - | Rights.PathOpen - | Rights.PathCreateFile; + // rights := Rights.DataSync + // | Rights.Sync + // | Rights.FilestatGet + // | Rights.FilestatSetSize + // | Rights.FilestatSetTimes + // | Rights.Advise + // | Rights.Allocate + // | Rights.PathOpen + // | Rights.PathCreateFile; + + rights := + Rights.DataSync + | Rights.Read + | Rights.Seek + | Rights.FdStatSetFlags + | Rights.Sync + | Rights.Tell + | Rights.Write + | Rights.Advise + | Rights.Allocate + | Rights.PathCreateDirectory + | Rights.PathCreateFile + | Rights.PathLinkSource + | Rights.PathLinkTarget + | Rights.PathOpen + | Rights.ReadDir + | Rights.PathReadlink + | Rights.PathRenameSource + | Rights.PathRenameTarget + | Rights.PathFilestatGet + | Rights.PathFilestateSetSize + | Rights.PathFilestateSetTimes + | Rights.FilestatGet + | Rights.FilestatSetSize + | Rights.FilestatSetTimes + | Rights.PathSymlink + | Rights.PathRemoveDirectory + | Rights.PathUnlinkFile + | Rights.PollFDReadWrite; + fdflags := flags; switch mode { @@ -74,6 +105,13 @@ close :: proc (file: File) -> bool { return true; } +write :: proc (file: File, data: string) { + vec := IOVec.{ buf = data.data, len = data.count }; + tmp : Size; + fd_write(file.fd, IOVecArray.{ ^vec, 1 }, ^tmp); + fd_datasync(file.fd); +} + get_size :: proc (file: File) -> u64 { fs: FileStat; if fd_filestat_get(file.fd, ^fs) != Errno.Success do return 0; diff --git a/docs/todo b/docs/todo new file mode 100644 index 00000000..77bd6741 --- /dev/null +++ b/docs/todo @@ -0,0 +1,56 @@ +Macro level tasks that need to be worked on: + +Command Line Interface: + Currently, the command line interface is trash. Pretty much the only thing + you can do is compile a binary file from a set of files. There are many + more things I would like to do with the CLI, including: + - Documentation generation in text, HTML, or man pages + - Add statistic printing (time taken, SLOC, etc) + - Abstract syntax tree printing + - Running the binary right away using Wasmtime, Wasmer or NodeJS + + [ ] Remove old code from CLI logic + [ ] Fix documentation generation (broken since compiler architecture change) + [ ] Add statistic printing + [ ] Fix AST printing (broken for a long time) + [ ] Add automated running component + - Store to temporary file (OS independent) + - Detect / choose WASM backend + - Run it + - Clean up + +Language Cohesion: + There are a couple areas of the language that have little gotchas because + of technical laziness. Cleaning up these areas will help the language feel + more cohesive and put together. + + [ ] Struct literals can only have 1 level of package before the struct + name. This is because packages were not able to be nested, so having + arbitrary package levels before a struct literal was not necessary. + The following should work when this is patched: + + var := some.packages.nested.here.StructName.{ value1, value2, ... }; + + [ ] Rearrange APIs. There is a lot of functionality in the standard libraries, + but it isn't organized in a usable way. + - 'core.array' contains a lot of functionality that would also apply to + slices. 'core.slice' should contain this functionality and 'core.array' + can provide wrappers that convert the array to a slice. + - 'core.str' is a bad name, it should be 'core.string'. The issue is that + it conflicts with 'builtin.string'. These two should be switched. Type + name should be 'str' and package name should be 'string' + + [ ] :: should not declare a local variable, just bind a name to an expression. + They can still be lexically scoped. + + [ ] Currently accessing a field directly on a function call produces invalid + WASM code; i.e. foo().bar; This should at least produce an error until + the underlying issue is fixed. + +Usability: + Currently, the compiler can only work on Linux. This is an arbitrary + restriction due completely to my laziness and lack of access to a + Windows / MacOS computer. + + [ ] Make compiler work on Windows + [ ] Make compiler work on MacOS -- 2.25.1