Skip to content
arifali0xPublic

About

Compiler Desigining Theoritical Concept's Implementation..

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oxide

A Rust lexer — tokenizes Rust source code into categorized tokens..

Usage

cargo run -- path/to/file.rs

Each token is printed with its kind, source span, and optional value:

Token { kind: Fn,           span: 1:1-1:3,   value: Some("fn") }
Token { kind: Identifier,   span: 1:4-1:8,   value: Some("main") }
Token { kind: IntLiteral,   span: 1:21-1:23, value: Some("42") }

Token Types

Keywords — let, fn, if, else, while, loop, for, in, return, struct, enum, impl, self, match, mut, const, type, use, mod, as, break, continue

Literals — IntLiteral, FloatLiteral, StringLiteral, CharLiteral, BoolLiteral

Operators — +, -, *, /, %, =, ==, !=, <, >, <=, >=, &&, ||, &, |, ^, ~, <<, >>, +=, -=, *=, /=, ->, =>, ., .., ..=

Delimiters — (, ), {, }, [, ], ;, :, ,, _, #, @

Special — Comment, Whitespace, Newline, Unknown, Eof

Number Formats

  • Decimal: 42, 1_000
  • Hex: 0xFF, 0xdead_beef
  • Octal: 0o77
  • Binary: 0b1010
  • Float: 3.14, 1e10, 2.5e-3

String Escape Sequences

\n, \t, \r, \0, \\, \', \", \xHH, \u{HHHH}

About

Compiler Desigining Theoritical Concept's Implementation..

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages