Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand functionality to support tokenization #8

Open
libsteve opened this issue Feb 13, 2014 · 0 comments
Open

Expand functionality to support tokenization #8

libsteve opened this issue Feb 13, 2014 · 0 comments

Comments

@libsteve
Copy link
Owner

You should be able to specify state transitions with the following data:

  • the state to transition from
  • either:
    • a string to transition over
    • an automata to transition over
  • either:
    • the state to transition to
    • a function that takes the matched string transitioned over and returns:
      • what state to transition to
      • a 'token' value that can hold the data

Using this method, evaluating the automata may be able to return a list of the 'token' values generated during execution.

possible signature of adding a transition:

addTransition(
    start_state, 
    [ transition_string | transition_automata ], 
    [ token_data (*)(matched_string), ]
    destination_state);

possible signature of executing an automata:

struct { list_of_tokens, did_pass, passing_length } execute(automata);

The goal of these modifications is that the framework could in theory be used as a lexer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant