Turkestan

怎么实现一个 JSON Parser

  •  
  •   Turkestan · Jul 17, 2021 · 2042 views
    This topic created in 1771 days ago, the information mentioned may be changed or developed.
    我看大多数人推荐的都是 Parsing Technique,这书 600 多页,我没有定力可以看完。。。
    micean
        1
    micean  
       Jul 17, 2021
    处理好对称的括号和引号就行了
    Knuth
        2
    Knuth  
       Jul 17, 2021 via Android
    leptjson
    一个简易的 json 实现库
    Acebiu
        4
    Acebiu  
       Jul 17, 2021
    > Lark is a parser - a program that accepts a grammar and text, and produces a structured tree that represents that text. In this tutorial we will write a JSON parser in Lark, and explore Lark's various features in the process.


    https://github.com/lark-parser/lark/blob/master/docs/json_tutorial.md
    ao99
        5
    ao99  
       Jul 17, 2021
    agagega
        6
    agagega  
       Jul 17, 2021 via iPhone   ❤️ 1
    这书虽然是神书,但不研究这块的是看不完的。有点类似你问算法看什么,让你去看 TAOCP.

    https://www.json.org/json-en.html 已经给了形式化定义了,json 语法也不涉及左递归。所以只要懂一点点终结符 /非终结符的概念,就能写一个递归下降了。(其实不懂也可以写,懂递归就行)
    yangzhezjgs
        7
    yangzhezjgs  
       Jul 18, 2021
    https://zhuanlan.zhihu.com/p/22457315 可参考叶老师的教程
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1344 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 17:07 · PVG 01:07 · LAX 10:07 · JFK 13:07
    ♥ Do have faith in what you're doing.