From 33ad996f0fc120505af26aaddefdc2c34134ed03 Mon Sep 17 00:00:00 2001 From: SimonFJ20 Date: Tue, 18 Mar 2025 16:00:00 +0100 Subject: [PATCH] add cjsongen --- deno.lock | 14 ++++++++++++++ main.ts | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/deno.lock b/deno.lock index bc89f33..89b14ef 100644 --- a/deno.lock +++ b/deno.lock @@ -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" } } diff --git a/main.ts b/main.ts index ea7b878..e04b7c9 100644 --- a/main.ts +++ b/main.ts @@ -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 = {