Skip to main content

26 posts tagged with "rust"

View All Tags

How to Customize your Own Error Type in Rust

· 2 min read
forfd8960
Author

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

· 4 min read
forfd8960
Author

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 Part0

· 2 min read
forfd8960
Author

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:

  1. Parse the source code and perform its behavior directly;
  2. Translate source code into some efficient intermediate representation or object code and immediately execute that;
  3. Explicitly execute stored precompiled bytecode made by a compiler and matched with the interpreter Virtual Machine.

Welcome

· One min read
forfd8960
Author

Buildwithrs.dev is the blog site that to record the process of building things from scratch with Rust Programming language.