Repository navigation
feat: Add MoonBit nom-like parser combinator framework (cogna-dev/parkit/nom) with JSON parser, Rust criterion benchmarks, and cross-language comparison - #1
Conversation
Agent-Logs-Url: https://github.com/cogna-dev/parsec/sessions/963f26e7-434b-446d-9bf4-b7b0ae4243c8 Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cogna-dev/parsec/sessions/963f26e7-434b-446d-9bf4-b7b0ae4243c8 Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
|
@copilot I have already set cogna-dev/moonbit-actions and https://github.com/cogna-dev/moonbit-skill to public. You can try re-importing them; just configure MoonBit using |
…kill submodule Agent-Logs-Url: https://github.com/cogna-dev/parsec/sessions/ce910f5d-b639-4c37-b93a-e3573693993c Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Done in commit a320bac. Updated both workflows to use |
|
@copilot See follows:
|
…nchmark results Agent-Logs-Url: https://github.com/cogna-dev/parsec/sessions/62e8b758-9a21-4d8b-bb33-3af7f736c49d Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Done in commit b986e43. Here's a summary of the three changes:
|
|
@copilot
|
…table Agent-Logs-Url: https://github.com/cogna-dev/parkit/sessions/57400887-1dc9-4d2c-b5cb-d7673acc3275 Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Done in commit 254b260.
|
|
@copilot
|
Agent-Logs-Url: https://github.com/cogna-dev/parkit/sessions/f29ff5cd-5182-4692-9036-27ff77e6e642 Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Done in commit d1c05da.
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Implements a Rust nom-inspired parser combinator library in MoonBit as a monorepo package under
cogna-dev/parkit, including an ECMA-404 compliant JSON parser sample, Rust nom reference cross-validation tests, MoonBit benchmarks (native target), and Rust criterion.rs benchmarks with a cross-language performance comparison.src/nom/— parkit core (cogna-dev/parkit/nom)Parser[O]wraps(String) -> IResult[O];IResult[O]isResult[(String, O), ParseError]tag,satisfy,char_,take_while,take_while1,take,take_while_m_nmap,map_res,alt,pair,tuple3,preceded,terminated,delimited,many0,many1,separated_list0/1,opt,verify,success,fail,eof,contextuint,int,double(manual computation, no external deps)examples/json/— JSON parser sample (not published to mooncakes)JsonValueenum (Null | Bool | Number | Str | Array | Object) withShow+Eq\uXXXXparse(String) -> Result[JsonValue, ParseError]cogna-dev/parkit-examplesworkspace module so it is not published to mooncakesexamples/benchmark/— MoonBit benchmarks (not published to mooncakes)@bench.TAPI (moon bench --target native)tag,take_while1,separated_list0Benchmark results
Benchmarks run on
ubuntu-latest. MoonBit targets the native backend; Rust uses criterion.rs with a native release build. Both use the same 3-object JSON array input.json_parse(3-object array)MoonBit native benchmark details:
json_parse(3-object array)tagtake_while1_digitsseparated_list0reference/nom-json/— Rust nom reference tests and criterion benchmarksexamples/json/json_test.mbt, confirming identical results across both implementationsbenches/json_bench.rsusing the same input as the MoonBit benchmark suitecargo test --manifest-path reference/nom-json/Cargo.tomlcargo bench --manifest-path reference/nom-json/Cargo.tomlCI & infrastructure
.github/workflows/ci.yml—moonbitjob viacogna-dev/moonbit-actions/setup@v0withmoon check,moon build,moon testall using--manifest-path moon.work.json;rust-referencejob runscargo testonreference/nom-jsonmoon.work.json— MoonBit workspace linking the publishable library (.) and the examples module (examples/)examples/moon.mod.json— separatecogna-dev/parkit-examplesmodule for JSON sample and benchmarks.github/workflows/copilot-setup-steps.yml— agent env viacogna-dev/moonbit-actions/setup@v0.agents/skills/moonbit—cogna-dev/moonbit-skillregistered and initialized as a git submoduleCargo.toml— Cargo workspace root includingreference/nom-json.gitignore— excludes_build/,target/,.mooncakes/,Cargo.lockOriginal prompt