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

Framing issue: goals and roadmap of cooklang-c #23

Open
1 of 7 tasks
dubadub opened this issue Mar 19, 2022 · 2 comments
Open
1 of 7 tasks

Framing issue: goals and roadmap of cooklang-c #23

dubadub opened this issue Mar 19, 2022 · 2 comments

Comments

@dubadub
Copy link
Member

dubadub commented Mar 19, 2022

Goals

C is the mother of all programming languages. Most of other languages support C code execution in one way or another. Hence the parser written in C can be wrapped in in other languages and require very little effort from us to provide consistent Cooklang support in variety of popular languages like Python, Ruby, Java, Go, NodeJS, etc. In addition it makes Cooklang evolution easier and reduces repeatability in required code updates for these parsers. In long-term this parser will replace Swift one in CLI.

Design principles

We want to make an end-user of downstream parsers experience the easiest. What it means is that if I'm, for example, a user of Cooklang Python module I shouldn't do anything else other than regular package installation and import to my project. Behind the scenes it should compile C extension for me.

That means:

  • the repo should host C-file(s) of parser with no other system dependencies except standard. We want to avoid third party system library installation.
  • we want to move away from filesystem level and operate in memory only (hence working only with strings). No cook file readings from C code. We move this responsibility to work with files to downstream parsers or apps.
  • C-invocation should be pure. Considering that many languages have automated Garbage Collection we need to provide a way for proper management of objects life-cycle.

Roadmap

Here I outline first steps which are basically to make this parser production ready:

After that we need to support features newly added into the spec (rough idea https://github.com/cooklang/CookCLI/milestones?direction=asc&sort=title&state=open). There's a chance of changing this parser to multi-pass parser to support servings (first pass for metadata and second for a recipe and adjusting amounts to scaled one).

Challenges

  • UTF support
  • evaluate Flex/Bison if it withstand future challenges:
    • not flexible enough to implement forgiveness?
    • error handling?
    • performance? generated parser file is huge (12Mb)!
@Seth-Harlaar
Copy link
Contributor

Nice, looks great!
I accidentally opened #25 and then closed it because I had not intended to open it. I did not attempt to solve that problem.

I did open #26 on purpose though.

@Accacio
Copy link
Contributor

Accacio commented Mar 22, 2022

I don't know if it's the best policy to support files with errors. I know it can be frustrating to the end user but if we have nice error messages the person will know what was wrong.

If you choose to guess the typical errors there should be a flashing warning with "did you mean ..." messages.

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

3 participants