From 59aad853a0bf12b9690f00da663373bb9e9047ec Mon Sep 17 00:00:00 2001 From: nothendev Date: Fri, 5 May 2023 20:37:23 +0300 Subject: [PATCH] codegen start --- Cargo.lock | 126 ++++++++++++++++++++++++++++++-------- programs/aidl/src/main.rs | 1 + 2 files changed, 100 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f837b1..24b26cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,7 +35,12 @@ dependencies = [ name = "aidl" version = "0.1.0" dependencies = [ - "logos 0.13.0", + "codespan-reporting", + "derive_more", + "logos", + "proc-macro2", + "quote", + "syn 2.0.15", "thiserror", ] @@ -114,6 +119,22 @@ dependencies = [ "toml 0.5.9 (git+https://git.ablecorp.us/theoddgarlic/toml-rs)", ] +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "cpuio" version = "0.3.2" @@ -140,6 +161,19 @@ dependencies = [ name = "derelict_microarchitecture" version = "0.1.0" +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.105", +] + [[package]] name = "fnv" version = "1.0.7" @@ -226,22 +260,13 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "logos" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf8b031682c67a8e3d5446840f9573eb7fe26efe7ec8d195c9ac4c0647c502f1" -dependencies = [ - "logos-derive 0.12.1", -] - [[package]] name = "logos" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" dependencies = [ - "logos-derive 0.13.0", + "logos-derive", ] [[package]] @@ -258,20 +283,6 @@ dependencies = [ "syn 2.0.15", ] -[[package]] -name = "logos-derive" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d849148dbaf9661a6151d1ca82b13bb4c4c128146a88d05253b38d4e2f496c" -dependencies = [ - "beef", - "fnv", - "proc-macro2", - "quote", - "regex-syntax", - "syn 1.0.105", -] - [[package]] name = "logos-derive" version = "0.13.0" @@ -383,6 +394,21 @@ dependencies = [ "serde", ] +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "semver" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" + [[package]] name = "serde" version = "1.0.148" @@ -482,6 +508,15 @@ dependencies = [ "versioning", ] +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.37" @@ -587,11 +622,17 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + [[package]] name = "uri" version = "0.1.0" dependencies = [ - "logos 0.13.0", + "logos", ] [[package]] @@ -632,9 +673,40 @@ dependencies = [ name = "wat2wasm" version = "0.1.0" dependencies = [ - "logos 0.12.1", + "logos", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "winnow" version = "0.4.4" diff --git a/programs/aidl/src/main.rs b/programs/aidl/src/main.rs index 10301d4..0000eaf 100644 --- a/programs/aidl/src/main.rs +++ b/programs/aidl/src/main.rs @@ -21,6 +21,7 @@ use crate::lexer::Spanned; mod ast; mod lexer; mod parser; +mod codegen; //const TEST: &str = include_str!("../assets/why.idl");