USB and console-mode support

Hello.
I'm considering using Rust for my project, which is a terminal IDE for a Forth compiler I'm writing for a microcontroller. I wanted to use Racket Scheme but that was a no-go because Racket doesn't have any support for USB, so I'm considering Rust. Just to verify, Rust does support USB, right?

I will also need support for console-mode display (I don't want a GUI because that would be a lot to learn, and it would be an overkill for a terminal). Something roughly comparable to NCURSES should be fine. I had NOTCURSES recommended to me, but I haven't looked into it yet.

Eventually I would like to write a Scheme interpreter in Rust. This would probably be byte-code as it doesn't need a lot of speed. It would be for the end-user to do some customization (add some new messages to and from the microcontroller). Has anybody written a scripting language for Rust? This doesn't have to be Scheme, but most anything would be adequate. I was impressed by Lua that C programmers use, but I would prefer to not use C for my project.

I'm using Windows-11. Some C-based languages (such as Chicken Scheme) use MINGW. This might be a problem for me, as this involves using Bash. I want my program to run out of PowerShell or CMD.EXE because that is what Windows users should be familiar with. My terminal presumably will not include a text-editor, but will interact with whichever Windows text-editor the user chooses.

thanks for any info --- Hugh Aguilar

If its educational, there are a bunch of Lox implementations here in different languages - and rust is for some reason one of the more popular languages to do it in.
AST walkers and byte code interpreters.

Something roughly comparable to NCURSES should be fine.

There are a couple of actual ncurses crates - with c-backends - but best avoid if you are starting from scratch. I think Crossterm is similar to ncurses i capability - but more robust. I have used it in a couple of projects - e.g. here.

Note that I haven't really looked at either of these in a while, but last I checked Rune and Rhai were two of the most popular and complete options.

I looked at the descriptions of these and they both look like they would work. :slight_smile:

Writing a Scheme interpreter is something that I might do for fun at some distant time in the future, but right now I have my project that I want to complete so I am okay with using an existing scripting language, especially if it already has a community of people using it who could jump into my program without much of a learning curve.

I had never heard of Lox before, but I'll look into it. Why did you ask if my project is educational? Is Lox not allowed for commercial work? My project is educational, but I wouldn't want to deny myself the (unlikely) possibility of making money in the future.

It would be good if the console-mode code-library supports virtual windows.
If only one big window is supported I can split it up myself into virtual windows, although this adds a lot of complication to my code.

One of the most popular options is GitHub - ratatui/ratatui: A Rust crate for cooking up terminal user interfaces (TUIs) 👨‍🍳🐀 https://ratatui.rs but I have yet to write any TUI in Rust, haven't had the need yet.