/lexin

A portable lexer

Primary LanguageRust

Stars Forks

Lexin

A portable lexer frontend to lib-lexin.

  • Description
  • Getting Started
  • Lex File
  • Help
  • Authors
  • Versions
  • License
  • Description

    Lexin is a portable lexer frontend to lib-lexin that can easily be packaged with any application and has is able to lex all kinds of syntax's.

    Getting Started

    Dependencies

    These Dependencies are only required when building.

    • rustc
    • cargo
    • python

    Installing

    • Clone the repository
    git clone https://github.com/proxin187/lexin
    
    • Run the build script
    python build.py
    

    Usage

    • Create a lex file see lex section
    • The program is executed the way shown below
    Usage: lexin [config(*.lex)] [target] [options]
      Options:
        -format: [formats] defaults to python
          formats:
            json: output tokens in json format
            python: output tokens in python format
    

    Lex

    Lexin uses a .lex file to input keywords and symbols to the lexer

    Keywords

    Syntax: _keywords [value]* Example:

    _keywords "fn" "if" "else" "match" "use"
    

    Symbols

    Syntax: _symbols [value]* Example:

    _symbols "+" "-" "*" "/" "{" "}" "[" "]" "(" ")" "<" ">" ";" ":"
    

    Sections

    Syntax: _sections [[start] - [end] [name]]* Example:

    _sections
        "/*" - "*/" "comment"
    

    Name

    Names only apply to symbols Syntax: _name [[value] [name]]* Example:

    _name
        "+" "Plus"
        "-" "Minus"
    

    Help

    Currently there is no bound checking on the indexing which means that unfinished statements in the lex file may cause a panic.

    Authors

    Contributors names and contact info

    Versions

    License

    Currently there is no license, this may change in the future