28 posts tagged with "rust"
View All TagsVim Practice
How to Customize your Own Error Type in Rust
Suppose you are writing a lexical analyzer(Lexer
), and you want return some customized errors while the lexer scan tokens,
and there are 3 possibel error will happens:
- Not Supported Tokens.
- Invalid Strings.
- Invalid Nums.
SO you can define the errors with a rust enum
:
pub enum LexerError {
InvalidToken(char),
InvalidString(String),
InvalidNum(String),
}
Comapre Rust with Golang
I have been using golang long time to wirte backend business logic.
After writing some rust code and I want do a comparison between golang and rust. This is maybe another good way to help you learn rust.
Build A Simple Interpreter with Rust part1
The first component of this interpreter is a Lexer which used for scan and group the chars into Tokens.
Build A Simple Interpreter with Rust Part0
What is Interpreter
From Wikipedia:
In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program. An interpreter generally uses one of the following strategies for program execution:
- Parse the source code and perform its behavior directly;
- Translate source code into some efficient intermediate representation or object code and immediately execute that;
- Explicitly execute stored precompiled bytecode made by a compiler and matched with the interpreter Virtual Machine.
First Blog Post
First Blog in buildwithrs.dev
Welcome
Buildwithrs.dev is the blog site that to record the process of building things from scratch with Rust Programming language.