Is ANTLR suitable for markup-to-markup compilation? - eviltoast

I want to compile a docx file into a Typst file, I believe deep down docx is XML, and Typst is close to markdown with interesting functionalities, is that feasible? Note that Typst does have syntax to define functions and call them and I want to create special functions during the code gen step, is ANTLR the right tool for the job? Are there better tools? I want to have as few bugs as possible

  • solrize@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    8 months ago

    Antlr sounds excessive for either of those. Use an ordinary xml library for docx (if there’s not already one for docx) and something simple for typst.

      • solrize@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        8 months ago

        Oh, ok, antlr would be inappropriate then. I’d check whether pandoc already does that conversion.

        • notTheCat@lemmy.mlOP
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          8 months ago

          I just checked, it does convert to Typst but I do want to write custom stuff alongside what pandoc will output, that seems like the right tool and saves me a lot of efforts, thanks