Most files suffered major changes
- Less ambiguous syntax - Better parser (Chumsky only does tokenization now) - Tidy(|ier) error handling - Facade for simplified embedding - External code grouped in (fairly) self-contained Systems - Dynamic action dispatch - Many STL additions
This commit is contained in:
31
src/systems/io/io.orc
Normal file
31
src/systems/io/io.orc
Normal file
@@ -0,0 +1,31 @@
|
||||
import std::panic
|
||||
import system::io
|
||||
import system::async::yield
|
||||
|
||||
export const print := \text.\ok. (
|
||||
io::write_str io::stdout text
|
||||
(io::flush io::stdout
|
||||
ok
|
||||
(\e. panic "println threw on flush")
|
||||
yield
|
||||
)
|
||||
(\e. panic "print threw on write")
|
||||
yield
|
||||
)
|
||||
|
||||
export const println := \line.\ok. (
|
||||
print (line ++ "\n") ok
|
||||
)
|
||||
|
||||
export const readln := \ok. (
|
||||
io::read_line io::stdin
|
||||
ok
|
||||
(\e. panic "readln threw")
|
||||
yield
|
||||
)
|
||||
|
||||
export module prelude (
|
||||
import super::*
|
||||
|
||||
export ::(print, println, readln)
|
||||
)
|
||||
Reference in New Issue
Block a user