Phate6660 / crust

A shell written in Rust.
Other
7 stars 1 forks source link

Begin work on lexing and parsing #3

Open Phate6660 opened 3 years ago

Phate6660 commented 3 years ago

Currently the REPL is very basic. It uses basic pattern matching features on larger variable contents. It's about to time to implement a lexer and parser to more accurately scan the line being entered. And once I get lexing and parsing set up I can get going on the shell scripting side of things.

Phate6660 commented 3 years ago

Current thoughts on this right now:

* Matches up with what I plan for the shell in the future. By the time I feel this shell is "ready", I want to have any and all deps written from scratch. I'm currently only using pre-made crates right now to get the shell on it's feet so to speak.

Phate6660 commented 3 years ago

@TheOnAndOnlyZenomat This is what I wanted to bring up. Honestly, only supporting one set of quotes right now is fine, because I plan to kill multiple birds with one stone with the PRs that will accompany the issue. Tokenizing, lexing, and parsing the command line string will allow us to:

TheOnAndOnlyZenomat commented 3 years ago

It sounds sensible to implement lexing and parsing. I basically know nothing about lexing and parsing, so I'll read up on that. All I think I know about that topic, is, that it is related to creating a programming language, so way over my head, but could be interesting to get into.

TheOnAndOnlyZenomat commented 3 years ago
  • Matches up with what I plan for the shell in the future. By the time I feel this shell is "ready", I want to have any and all deps written from scratch. I'm currently only using pre-made crates right now to get the shell on it's feet so to speak.

This is gonna be a hard task, I mean I totally vibe with the idea and I really like it, but it's gonna be hard^^ But let's do it

TheOnAndOnlyZenomat commented 3 years ago

Do you by chance have a good resource to start to read about that topic?

Phate6660 commented 3 years ago

Nah. But I can look around for some, and I do have previous experience with tokenizing, lexing, and parsing in previous projects.

TheOnAndOnlyZenomat commented 3 years ago

Alright, sounds good. Do you have a link to such an example project, so that I can take a look at it?

Phate6660 commented 3 years ago

Yep! https://github.com/Phate6660/bcalc is a major one!

Phate6660 commented 3 years ago

By the way. I have started work on this. Once I have a good base set up (which should be tomorrow (preferably) or the day after), I'll make a branch that'll be tracked. I'm currently in the [try an idea] => [break everything down] => [repeat] stage. But I already have tokenizing done, and started working on a bit of lexing. Figured I should comment so that you aren't in the dark.

Phate6660 commented 3 years ago

Hitting some breakthroughs! Expect a branch today :D

TheOnAndOnlyZenomat commented 3 years ago

Uh, sounding good. I am exited

Phate6660 commented 3 years ago

@TheOnAndOnlyZenomat Got a branch set up: https://github.com/Phate6660/crusty/tree/tok_lex_par

So far with basic testing it should support alpha-numeric characters and quotes out of the box. Not sure about nested quotes, haven't tried it yet.

Phate6660 commented 3 years ago

Obviously it needs more development and testing and all that, but what do you think so far?

TheOnAndOnlyZenomat commented 3 years ago

It definitely looks good. I'll have to take a closer look at the code and play around with the code a bit to fully get it, but looks promising. Regarding the testing, I will probably sit down sometime and build out our testframework, and will probably try to get some progress done on the prompt.