Giter VIP home page Giter VIP logo

osor_tokenizer's Introduction

๐Ÿช™ A Tokenizing Module for Jai

A simple tokenizing module for the Jai programming language. You can check the code in module.jai and a few examples of how to use them in example.jai.

How To

The idea is to take text and transform it to a set of tokens that are easier to work with for parsing purposes. To start you'd initialize a Tokenizer which just contains the running data used as we generate the tokens:

text := "1 123.123 abc";
tokenizer : Tokenizer;
init_tokenizer(*tokenizer, text);

Then you can retrieve an array of all tokens by calling tokenize_all_tokens:

tokens := tokenize_all_tokens(*tokenizer);
for tokens do_something_with(token);

Alternatively you could request one token at a time and handle them as they come:

while true
{
    token, error := tokenize_one_token(*tokenizer);
    if token.type == .INVALID || token.type == .END then break;
    do_something_with(token);
}

Some running examples of this in example.jai, including some toy parser for some code.

License

I want people to be able to just use this without thinking about licensing, although give me a shout if you do use it and attribution is appreciated ๐Ÿ˜Š. Replicating STB's (https://github.com/nothings/stb) licensing stuff where you can choose to use public domain or MIT.

osor_tokenizer's People

Contributors

osor-io avatar

Stargazers

Eric Johnson avatar Angel Ortiz avatar Nick Tsaizer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.