diff --git a/shell/src/ascii_box.rs b/nested/src/ascii_box.rs similarity index 100% rename from shell/src/ascii_box.rs rename to nested/src/ascii_box.rs diff --git a/shell/src/monstera.rs b/nested/src/monstera.rs similarity index 100% rename from shell/src/monstera.rs rename to nested/src/monstera.rs diff --git a/shell/src/plot.rs b/nested/src/plot.rs similarity index 100% rename from shell/src/plot.rs rename to nested/src/plot.rs diff --git a/shell/gram2 b/shell/gram2 new file mode 100644 index 0000000..7cae647 --- /dev/null +++ b/shell/gram2 @@ -0,0 +1,93 @@ + +‹ShellTerm› := + | Lit : "«String»" | "«Path»~«Sep Char '/'»~«Seq Char»~«TerminatedArray AsciiChar~Byte 0»" + | Var : $«ProcessArgument~ℕ~«PositionalInt 10 BigEndian»» + | Sub : $(«Process») + +$PATH:›Sequence Path‹ + :›SeparatedSequence Char '/' ‹ + :›Sequence ›Sequence Char‹‹ + :›‹ + :‹SeparatedSequence Char ':'‹ + :‹Sequence Char› + &‹OsString~› + ~‹List Char~Vec Byte› + +Seq +Vec +Sep +read :: Sep -> Seq +read (Sep xs) d -> +deco :: Style -> Seq -> + +ShellTerm::eval t:‹ShellTerm› -> ‹String› { + match t { + ShellTerm::Lit "s:«String»" -> { + + } + ShellTerm::Var var:$ + } +} + +$PATH : ‹Sequence Path› ~ ‹SeparatedSequence Char ':'› + +ShellTerm::eval := «» -> «» +«Path» :> «» + +‹Path› := [ PathSegment ] ~ ‹List › + +[Char] + :separator '/' + : + +‹ a: Int x b: Int › +( a b ) + + + +// Process is a Structure Type +‹Process› := { + env : ‹ Symbol -> ShellTerm › + exe : ‹ Path › + args : ‹ [ShellTerm] › + stdin : ‹ Pipe › +} + + + +// OsString is an Abstraction Type +[OsString] := [Sequence AsciiChar] ~ [Sequence Byte] ~ [TerminatedSequence Byte 0] ~ [Pointer Byte] ~ [MachineWord] + +execve := { + ‹ Process + ~ { env : Symbol, exe: Path~, } › + -> +} + +precedence of operators: '~' < ':' < '[ ]' < '{ }' + + := [ < ] + + + +‹Process exe=/bin/ls› : ‹Process› := { + args : ‹ [ProcessArgument] ~ [] +} + + :> «PosixShellScript ~ String» { ... } + :> «TerminalView» { ... } + + +»ProcessId«~»MachineInt«~»MachineWord«~»Register« +«ProcessId»~«MachineInt»~«MachineWord»~«Register» + +Pipe::read = { + fd: const ( FileDescriptor ~ MachineInt ~ Register ~ EAX ) + buf: ( Array Byte ~ ) +} -> + +stdout := «ProcessId» -> «FileDescriptor»~«MachineInt»~«Register»~«EAX» + + +poorly-written shell scripts often do not handle filenames with spaces. + diff --git a/shell/grammar b/shell/grammar new file mode 100644 index 0000000..e47a070 --- /dev/null +++ b/shell/grammar @@ -0,0 +1,10 @@ + +ls :: [files]: + [options]: + +: (view ls) (template +(decorate files EnumSet) + +((λx.xx) a) = aa + +-> (process files.to_seq.(map |x|{ }) ) diff --git a/shell/src/expr.rs b/shell/src/expr.rs deleted file mode 100644 index c154a87..0000000 --- a/shell/src/expr.rs +++ /dev/null @@ -1,28 +0,0 @@ -use { - std::{ - sync::{Arc, RwLock} - } - nested::{ - core::TypeTerm, - } -}; - -struct ExprEditor { - editor: Arc>, - type_tag: TypeTerm -} - -impl TreeNav for ExprEditor { - -} - -impl TerminalEditor for ExprEditor { - fn get_term_view(&self) -> OuterViewPort { - - } - - fn handle_terminal_event(&mut self, event: &TerminalEvent) -> TerminalEditorResult { - - } -} - diff --git a/shell/src/main.rs b/shell/src/main.rs index 05d9eac..0cf823e 100644 --- a/shell/src/main.rs +++ b/shell/src/main.rs @@ -1,11 +1,10 @@ extern crate portable_pty; -mod ascii_box; -mod monstera; -//mod process; mod pty; + +// TODO rewrite process & command with incubator rules +//mod process; //mod command; -mod plot; use { cgmath::{Point2, Vector2}, diff --git a/shell/src/process.rs b/shell/src/process.rs index 9f6d3f5..a25f1fc 100644 --- a/shell/src/process.rs +++ b/shell/src/process.rs @@ -21,7 +21,7 @@ use { }; //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> -/* + pub struct ProcessArg { editor: PTYListEditor, @@ -274,4 +274,4 @@ impl Diagnostics for ProcessLauncher { } impl Nested for ProcessLauncher {} -*/ +