Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

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

Open
@dubadub

Description

@dubadub

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)!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions