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

Parse the Gesture runefile #27

Merged
merged 6 commits into from
Feb 28, 2021
Merged

Conversation

Michael-F-Bryan
Copy link
Contributor

This updates the parser so we can handle the new gestures Runefile. I also shuffled around the runefile.pest file to parse things with more fidelity, which will give analysis and codegen easier access to information it needs.

  • Differentiate between integer, float, and string literals so that when you pass a parameter to a proc block we know what type it is (helps a lot with codegen because you don't resort to hacky string manipulation/parsing)
  • Parse types (e.g. the F32[150, 2] in CAPABILITY<F32[150, 2], _>) in a more strongly-typed way so the analysis stage can reason about them better (e.g. instead of blindly comparing strings it knows something is a 150x2 f32 array)
  • Made paths (e.g. for a proc block) have more structure than an opaque string so codegen knows how to add it as a dependency in Cargo.toml
  • Removed the explicit whitespace parsing

Drive-by changes to the Runefile format:

  • A CAPABILITY only really has an output type, so instead of writing CAPABILITY<_, F32>, we drop the _ to write CAPABILITY<F32>
  • Rearranged instructions so it goes CAPABILITY<output_type> friendly_name RAND or MODEL<input, output> gesture ./gesture.tflite --some-arg 42

(I can easily revert these. It's just a case of rearranging a couple words and following the test failures)

@Michael-F-Bryan Michael-F-Bryan changed the title Draft: Parse the Gesture runefile Parse the Gesture runefile Feb 27, 2021
@Michael-F-Bryan Michael-F-Bryan merged commit 7e5241b into master Feb 28, 2021
@Michael-F-Bryan Michael-F-Bryan deleted the parsing-gesture-runefile branch March 1, 2021 14:08
@Michael-F-Bryan Michael-F-Bryan mentioned this pull request Mar 1, 2021
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

Successfully merging this pull request may close these issues.

None yet

1 participant