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

Write a chunk parser using nom parser combinators #51

Open
helgoboss opened this issue Aug 5, 2021 · 5 comments
Open

Write a chunk parser using nom parser combinators #51

helgoboss opened this issue Aug 5, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@helgoboss
Copy link
Owner

To finally get a robust and fast way to dive into chunks from Rust (e.g. for detecting FX parameter modulation and other stuff for which we don't have an API yet).

@helgoboss helgoboss added the enhancement New feature or request label Aug 5, 2021
@helgoboss helgoboss changed the title Write a chunk parser using nom parser combinator Write a chunk parser using nom parser combinators Aug 5, 2021
@GavinRay97
Copy link
Contributor

Hey Benjamin, I've actually been interested in & working on this problem as well.

There's no high-performance chunk parser which is a barrier to being able to do any sort of near-realtime processing of project data from chunks.

Instead of parsing it into language-specific structs though, I've been working on converting it from not-quite-XML into valid XML, and exposing that through a C API + header.

The idea being your language (C++, Rust, D, whatever) passes the chunk or .rpp-file string into it and then the XML result is passed back in a struct field:

#include <stdint.h>

typedef struct rpp_parse_result {
  int error_code;
  const char *results;
  uint64_t len;
} rpp_parse_result;

rpp_parse_result RPPtoXML(const char *rpp_text, uint64_t length);

Then you can use a language-specific XML parser to serialize it into your language's structs/classes, which is more universal.

What do you think about this? 👀

@helgoboss
Copy link
Owner Author

Hi Gavin. Normalizing this to real XML sounds useful and would instantly make access to the chunk stuff easier from many languages! So I'm definitely intrigued. That said, I'm not sure if I would use it for reaper-rs because I would prefer building the parser directly in Rust (which I hope is not a big deal with a proper parser combinator library such as nom).

@baadc0de
Copy link

I've made a first pass at it.

https://github.com/audiocloud/reaper-chunks

@helgoboss
Copy link
Owner Author

Cool! Will try that as soon as I need to get down to chunk level again.

@GavinRay97
Copy link
Contributor

@baadc0de This is awesome, thank you!

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

No branches or pull requests

3 participants