Atlas-core
Crate to host the Atlas77 project. An embeddable functional language.
atlas_core
atlas_core is a Rust library designed to facilitate lexical analysis and token parsing for programming languages. It provides a flexible and customizable lexer implementation, along with macros to define language-specific tokens, keywords, and symbols.
Features
- Lexer Generation: Automatically generate lexer structures and methods using macros.
- Token Kind Definition: Easily define various token kinds including literals, keywords, and symbols.
- Error Handling: Robust error handling with detailed error messages and support for recoverable errors.
- Customizable: Configure your lexer with specific keywords, symbols, and number parsing options.
Installation
Add the following to your Cargo.toml:
[]
= "0.1.0"
Usage
Defining Symbols
Use the symbols! macro to define symbols used in your language:
symbols!
Defining Keywords
Use the keyword! macro to define keywords:
keyword!
Configuring Number Parsing
Use the number! macro to configure number parsing options:
number!
Generating the Lexer
Use the lexer! macro to generate the lexer with default or customized configurations:
lexer!;
Example
Here's an example of using atlas_core to create a simple lexer:
use *;
symbols!
keyword!
number!
lexer!;
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.