add cjsongen

This commit is contained in:
SimonFJ20 2025-03-18 16:00:00 +01:00
parent fb565d64ad
commit 33ad996f0f
2 changed files with 31 additions and 0 deletions

14
deno.lock generated
View File

@ -33,5 +33,19 @@
"source-map-generator@0.8.0": {
"integrity": "sha512-psgxdGMwl5MZM9S3FWee4EgsEaIjahYV5AzGnwUvPhWeITz/j6rKpysQHlQ4USdxvINlb8lKfWGIXwfkrgtqkA=="
}
},
"remote": {
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/assert.ts": "4a54f8579508401784d2f73e36bb8c877ff0e0ecd3abd58cab30e25f7f32ed73",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/gen/common.ts": "7d84fecc3514ee88c6011bd2e0d49836a64a5370c6444f720a79f20f4da1b6da",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/gen/json/mod.ts": "c877192ee6d9c06daf1354c0ae4c4a5bdef4b939473e59a3c93f93d09dac0098",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/gen/json/ser.ts": "bed61f8b9fd63ff1de0c450376747ec11d48ff2ca254ac2f1b7897ea90e19948",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/gen/mod.ts": "c76da4b63b7d6dafc5538bf069a6d5578b7b7174c1081d8acc5ee2758a454c08",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/gen/typedef.ts": "582f7edebcf56354a1256b4e03b05e9bc5b72d934cad04b422e78b0743c8837c",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/mod.ts": "b233ee0f643f2af5aad4a6464eff02e7465c6c6851b4bab80861a351c9815962",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/repr/hir.ts": "0a12a18d29919512ff725fe0c3eeddf5fa8c79752c2b32b0c05bde859051651d",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/repr/mir.ts": "0807554f8a7598e17dcf8204ba4daff31d22bd6c59beaa461771f0070ea1a546",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/repr/mod.ts": "ebbee03923a8182d9e7c6e388cdc7e28ceecae8ae56560206d6b903dcb498624",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/repr/node.ts": "0b0f390a4e45108ffcdcd6cc30a8e603e8145f8f58715e541684d4983fc0417c",
"https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/repr/primitives.ts": "3ac29c80ef54c2f789fc539218d18da502d9ac0563a7a9e065a6df4a04380be5"
}
}

17
main.ts
View File

@ -1,6 +1,7 @@
import * as parser from "./parser.out.js";
import * as yaml from "jsr:@std/yaml";
import * as ast from "./ast.ts";
import * as cjg from "https://raw.githubusercontent.com/camper0008/cjsongen/refs/heads/main/mod.ts";
async function main() {
const filename = Deno.args[0];
@ -40,6 +41,22 @@ async function main() {
if (rep.errorOccured) {
console.log("Errors occured. Stopping...");
}
// const hir: cjg.repr.hir.Struct = {
// name: "Product",
// values: {
// value: "int",
// },
// };
//
// const mir = cjg.repr.mir.fromHir(hir);
// const nodes = cjg.repr.fromMir(mir);
// const structDefCode = cjg.gen.typedef.structDef(nodes);
// const serDefCode = cjg.gen.json.serializerDef(nodes);
// const serImplCode = cjg.gen.json.serializerImpl(nodes);
// console.log(structDefCode);
// console.log(serDefCode);
// console.log(serImplCode);
}
type MonoUnit = {