switched to lrpar parser generator
This commit is contained in:
509
Cargo.lock
generated
509
Cargo.lock
generated
@@ -12,28 +12,25 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ascii-canvas"
|
||||
version = "3.0.0"
|
||||
name = "anyhow"
|
||||
version = "1.0.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6"
|
||||
dependencies = [
|
||||
"term",
|
||||
]
|
||||
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.5.3"
|
||||
name = "autocfg"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
|
||||
dependencies = [
|
||||
"bit-vec",
|
||||
]
|
||||
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||
|
||||
[[package]]
|
||||
name = "bit-vec"
|
||||
version = "0.6.3"
|
||||
name = "bincode"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
@@ -41,6 +38,12 @@ version = "2.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
|
||||
|
||||
[[package]]
|
||||
name = "cactus"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acbc26382d871df4b7442e3df10a9402bf3cf5e55cbd66f12be38861425f0564"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.4"
|
||||
@@ -48,45 +51,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "crunchy"
|
||||
version = "0.2.4"
|
||||
name = "cfgrammar"
|
||||
version = "0.13.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
||||
|
||||
[[package]]
|
||||
name = "dirs-next"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
|
||||
checksum = "7fe45e18904af7af10e4312df7c97251e98af98c70f42f1f2587aecfcbee56bf"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"dirs-sys-next",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"num-traits",
|
||||
"regex",
|
||||
"serde",
|
||||
"vob",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys-next"
|
||||
version = "0.1.2"
|
||||
name = "deranged"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
|
||||
checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||
|
||||
[[package]]
|
||||
name = "ena"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"powerfmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -96,28 +80,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "fixedbitset"
|
||||
version = "0.4.2"
|
||||
name = "filetime"
|
||||
version = "0.2.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
|
||||
checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"libredox",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "fudgerust2"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"lalrpop",
|
||||
"lalrpop-util",
|
||||
"cfgrammar",
|
||||
"lrlex",
|
||||
"lrpar",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.16"
|
||||
name = "getopts"
|
||||
version = "0.2.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
||||
checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -137,44 +132,16 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.11.0"
|
||||
name = "itoa"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||
|
||||
[[package]]
|
||||
name = "lalrpop"
|
||||
version = "0.20.2"
|
||||
name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca"
|
||||
dependencies = [
|
||||
"ascii-canvas",
|
||||
"bit-set",
|
||||
"ena",
|
||||
"itertools",
|
||||
"lalrpop-util",
|
||||
"petgraph",
|
||||
"pico-args",
|
||||
"regex",
|
||||
"regex-syntax",
|
||||
"string_cache",
|
||||
"term",
|
||||
"tiny-keccak",
|
||||
"unicode-xid",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lalrpop-util"
|
||||
version = "0.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553"
|
||||
dependencies = [
|
||||
"regex-automata",
|
||||
]
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
@@ -190,22 +157,62 @@ checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.14"
|
||||
name = "lrlex"
|
||||
version = "0.13.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
|
||||
checksum = "c71364e868116ee891b0f93559eb9eca5675bec28b22d33c58481e66c3951d7e"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
"cfgrammar",
|
||||
"getopts",
|
||||
"lazy_static",
|
||||
"lrpar",
|
||||
"num-traits",
|
||||
"quote",
|
||||
"regex",
|
||||
"regex-syntax",
|
||||
"serde",
|
||||
"vergen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.28"
|
||||
name = "lrpar"
|
||||
version = "0.13.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
||||
checksum = "51b265a81193d94c92d1c9c715498d6fa505bce3f789ceecb24ab5d6fa2dbc71"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"cactus",
|
||||
"cfgrammar",
|
||||
"filetime",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"lrtable",
|
||||
"num-traits",
|
||||
"packedvec",
|
||||
"regex",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"vergen",
|
||||
"vob",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lrtable"
|
||||
version = "0.13.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc36d15214ca997a5097845be1f932b7ee6125c36f5c5e55f6c49e027ddeb6de"
|
||||
dependencies = [
|
||||
"cfgrammar",
|
||||
"fnv",
|
||||
"num-traits",
|
||||
"serde",
|
||||
"sparsevec",
|
||||
"vob",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
@@ -214,64 +221,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||
|
||||
[[package]]
|
||||
name = "new_debug_unreachable"
|
||||
version = "1.0.6"
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.5"
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.12"
|
||||
name = "num_threads"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
|
||||
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "petgraph"
|
||||
version = "0.6.5"
|
||||
name = "packedvec"
|
||||
version = "1.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
|
||||
checksum = "a69e0a534dd2e6aefce319af62a0aa0066a76bdfcec0201dfe02df226bc9ec70"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"indexmap",
|
||||
"num-traits",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.11.3"
|
||||
name = "powerfmt"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
|
||||
dependencies = [
|
||||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pico-args"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
|
||||
|
||||
[[package]]
|
||||
name = "precomputed-hash"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
@@ -300,17 +287,6 @@ dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.12.2"
|
||||
@@ -347,44 +323,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
name = "serde"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
name = "serde_core"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||
|
||||
[[package]]
|
||||
name = "string_cache"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f"
|
||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||
dependencies = [
|
||||
"new_debug_unreachable",
|
||||
"parking_lot",
|
||||
"phf_shared",
|
||||
"precomputed-hash",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sparsevec"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68b4a8ce3045f0fe173fb5ae3c6b7dcfbec02bfa650bb8618b2301f52af0134d"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"packedvec",
|
||||
"serde",
|
||||
"vob",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.106"
|
||||
@@ -397,43 +382,36 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "term"
|
||||
version = "0.7.0"
|
||||
name = "time"
|
||||
version = "0.3.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
|
||||
checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d"
|
||||
dependencies = [
|
||||
"dirs-next",
|
||||
"rustversion",
|
||||
"winapi",
|
||||
"deranged",
|
||||
"itoa",
|
||||
"libc",
|
||||
"num-conv",
|
||||
"num_threads",
|
||||
"powerfmt",
|
||||
"serde",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
name = "time-core"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
name = "time-macros"
|
||||
version = "0.2.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tiny-keccak"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
|
||||
dependencies = [
|
||||
"crunchy",
|
||||
"num-conv",
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -443,58 +421,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.6"
|
||||
name = "unicode-width"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
||||
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.5.0"
|
||||
name = "vergen"
|
||||
version = "8.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
checksum = "2990d9ea5967266ea0ccf413a4aa5c42a93dbcfda9cb49a97de6931726b12566"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
"anyhow",
|
||||
"rustversion",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.1+wasi-snapshot-preview1"
|
||||
name = "vob"
|
||||
version = "3.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
checksum = "bc936b5a7202a703aeaf7ce05e7931db2e0c8126813f97db3e9e06d867b0bb38"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
"num-traits",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[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.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[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 = "windows-link"
|
||||
version = "0.2.1"
|
||||
@@ -503,9 +455,74 @@ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
version = "0.60.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.53.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
|
||||
|
||||
10
Cargo.toml
10
Cargo.toml
@@ -2,11 +2,15 @@
|
||||
name = "fudgerust2"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
authors = ["Iwan Snel"]
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
lalrpop = "0.20.0"
|
||||
cfgrammar = "0.13.10"
|
||||
lrlex = "0.13.10"
|
||||
lrpar = "0.13.10"
|
||||
|
||||
[dependencies]
|
||||
lalrpop-util = { version = "0.20.0", features = ["lexer", "unicode"] }
|
||||
lalrpop = "0.20.0"
|
||||
cfgrammar = "0.13.10"
|
||||
lrlex = "0.13.10"
|
||||
lrpar = "0.13.10"
|
||||
|
||||
14
build.rs
14
build.rs
@@ -1,3 +1,15 @@
|
||||
use cfgrammar::yacc::YaccKind;
|
||||
use lrlex::CTLexerBuilder;
|
||||
|
||||
fn main() {
|
||||
lalrpop::Configuration::new().process_current_dir().unwrap();
|
||||
CTLexerBuilder::new()
|
||||
.lrpar_config(|ctp| {
|
||||
ctp.yacckind(YaccKind::Grmtools)
|
||||
.grammar_in_src_dir("grammar.y")
|
||||
.unwrap()
|
||||
})
|
||||
.lexer_in_src_dir("grammar.l")
|
||||
.unwrap()
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
pub trait ASTNode {
|
||||
fn repr_c(&self) -> String;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
use crate::ast::expression::Expression;
|
||||
@@ -1,6 +0,0 @@
|
||||
use crate::ast::literal::Literal;
|
||||
use crate::ast::ast_node::ASTNode;
|
||||
|
||||
pub enum Expression {
|
||||
Literal(Literal),
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#[derive(Debug)]
|
||||
pub enum Literal {
|
||||
Int(i64),
|
||||
Float(f64),
|
||||
Bool(bool),
|
||||
}
|
||||
|
||||
@@ -1,6 +1,49 @@
|
||||
mod ast_node;
|
||||
pub mod literal;
|
||||
pub mod expression;
|
||||
pub mod logical;
|
||||
mod comparison;
|
||||
mod operators;
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Literal {
|
||||
Int(i64),
|
||||
Float(f64),
|
||||
Bool(bool),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Expression {
|
||||
Lit(Literal),
|
||||
Ident(String),
|
||||
Add(Box<Expression>, Box<Expression>),
|
||||
Sub(Box<Expression>, Box<Expression>),
|
||||
Mul(Box<Expression>, Box<Expression>),
|
||||
Div(Box<Expression>, Box<Expression>),
|
||||
Mod(Box<Expression>, Box<Expression>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Definition {
|
||||
Binding {
|
||||
identifier_info: TypedIdentifier,
|
||||
value: Expression,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct TypedIdentifier {
|
||||
identifier_uuid: usize,
|
||||
|
||||
id: String,
|
||||
type_arg: TypeArg,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum TypeArg {
|
||||
Rank0(AST_TypeId),
|
||||
RankN {
|
||||
from: Box<TypeArg>,
|
||||
to: Box<TypeArg>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct AST_TypeId {
|
||||
type_uuid: usize,
|
||||
|
||||
string_repr: String,
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
use crate::ast::expression::Expression;
|
||||
|
||||
pub enum Operator {
|
||||
Unary(UnaryOperator),
|
||||
Binary(BinaryOperator),
|
||||
}
|
||||
|
||||
pub enum UnaryOperator {
|
||||
Minus,
|
||||
Not,
|
||||
Reference,
|
||||
Dereference,
|
||||
}
|
||||
|
||||
pub enum BinaryOperator {
|
||||
Plus,
|
||||
Minus,
|
||||
Multiply,
|
||||
Divide,
|
||||
Modulo,
|
||||
And,
|
||||
Or,
|
||||
Xor,
|
||||
Equal,
|
||||
NotEqual,
|
||||
Greater,
|
||||
GreaterEqual,
|
||||
Less,
|
||||
LessEqual,
|
||||
}
|
||||
19
src/errors.rs
Normal file
19
src/errors.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::error::Error;
|
||||
use std::fmt::{Debug, Display, Formatter, Pointer};
|
||||
|
||||
pub struct CLIArgumentError(pub &'static str);
|
||||
|
||||
|
||||
impl Display for CLIArgumentError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for CLIArgumentError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for CLIArgumentError {}
|
||||
9
src/grammar.l
Normal file
9
src/grammar.l
Normal file
@@ -0,0 +1,9 @@
|
||||
%%
|
||||
[1-9][0-9]* "LITINT"
|
||||
[-+]?([0-9]*[.][0-9]+|[0-9]*([.][0-9]+)?[Ee][-+]?[1-9][0-9]*) "LITFLOAT"
|
||||
[_a-zA-Z][_0-9a-zA-Z]* "IDENT"
|
||||
\+ "ADD"
|
||||
\* "MUL"
|
||||
\( "("
|
||||
\) ")"
|
||||
[\t ]+ ;
|
||||
52
src/grammar.y
Normal file
52
src/grammar.y
Normal file
@@ -0,0 +1,52 @@
|
||||
%start Expr
|
||||
%%
|
||||
Expr -> Result<Expression, () >:
|
||||
Expr "ADD" MulExpr { Ok(Expression::Add(Box::new( $1? ), Box::new( $3? ))) }
|
||||
| MulExpr { $1 }
|
||||
;
|
||||
|
||||
MulExpr -> Result<Expression, () >:
|
||||
MulExpr "MUL" ConstExpr { Ok( Expression::Mul(Box::new($1?), Box::new($3?)) ) }
|
||||
| ConstExpr { $1 }
|
||||
;
|
||||
|
||||
ConstExpr -> Result<Expression, () >:
|
||||
'(' Expr ')' { $2 }
|
||||
| 'LITINT' {
|
||||
let v = $1.map_err( | _| ())?;
|
||||
Ok(Expression::Lit(Literal::Int(parse_int( $lexer.span_str(v.span()))?)))
|
||||
}
|
||||
| "LITFLOAT" {
|
||||
let v = $1.map_err( | _| ())?;
|
||||
Ok(Expression::Lit(Literal::Float(parse_float( $lexer.span_str(v.span()))?)))
|
||||
}
|
||||
| "IDENT" {
|
||||
let v = $1.map_err( | _| ())?;
|
||||
Ok(Expression::Ident(String::from( $lexer.span_str(v.span()))))
|
||||
}
|
||||
;
|
||||
%%
|
||||
// Any functions here are in scope for all the grammar actions above.
|
||||
|
||||
fn parse_int(s: &str) -> Result<i64, ()> {
|
||||
match s.parse::<i64>() {
|
||||
Ok(val) => Ok(val),
|
||||
Err(_) => {
|
||||
eprintln!("{} cannot be represented as a i64", s);
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_float(s: &str) -> Result<f64, ()> {
|
||||
match s.parse::<f64>() {
|
||||
Ok(val) => Ok(val),
|
||||
Err(_) => {
|
||||
eprintln!("{} cannot be represented as a f64", s);
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
use crate::ast::{Literal, Expression};
|
||||
35
src/main.rs
35
src/main.rs
@@ -1,10 +1,37 @@
|
||||
use lalrpop_util::lalrpop_mod;
|
||||
use crate::errors::CLIArgumentError;
|
||||
use lrlex::lrlex_mod;
|
||||
use lrpar::lrpar_mod;
|
||||
use std::error::Error;
|
||||
use std::fmt::{Display, format};
|
||||
use std::io;
|
||||
use std::io::ErrorKind::InvalidInput;
|
||||
|
||||
mod ast;
|
||||
mod errors;
|
||||
mod optimising;
|
||||
mod tests;
|
||||
|
||||
lalrpop_mod!(pub expressions);
|
||||
lrlex_mod!("grammar.l");
|
||||
lrpar_mod!("grammar.y");
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let src_path = std::env::args()
|
||||
.nth(1)
|
||||
.ok_or(Box::new(CLIArgumentError("Source File Not Provided")))?;
|
||||
let src_string = std::fs::read_to_string(&src_path)?;
|
||||
|
||||
let lexerdef = grammar_l::lexerdef();
|
||||
|
||||
let lexer = lexerdef.lexer((src_string.as_str()));
|
||||
let (res, errs) = grammar_y::parse(&lexer);
|
||||
if let Some(Ok(res)) = res {
|
||||
println!("{:#?}", res);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// fn main() {
|
||||
// if let Err(ref e) = main_() {
|
||||
// return e.fmt()
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
mod constfolding;
|
||||
mod constfolding;
|
||||
|
||||
@@ -13,4 +13,4 @@
|
||||
// assert!(IdentParser::new().parse("0").is_err());
|
||||
// assert!(IdentParser::new().parse("0123456").is_err());
|
||||
// assert!(IdentParser::new().parse("0aaaa").is_err());
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1,80 +1,54 @@
|
||||
use crate::ast::literal::Literal;
|
||||
use crate::expressions::AtomParser as Parser;
|
||||
use lrlex::lrlex_mod;
|
||||
use lrpar::lrpar_mod;
|
||||
|
||||
#[test]
|
||||
fn int_literals() {
|
||||
let parser = Parser::new();
|
||||
let valid_ints = vec!["1234567890", "(1234567890)", "((((1))))"];
|
||||
let invalid_ints = vec!["01", "(1", "6543)", "((987652345)"];
|
||||
use crate::ast::{Expression, Literal};
|
||||
|
||||
assert!(valid_ints.into_iter().all(|s| parser.parse(s).is_ok()));
|
||||
assert!(invalid_ints.into_iter().all(|s| parser.parse(s).is_err()));
|
||||
lrlex_mod!("grammar.l");
|
||||
lrpar_mod!("grammar.y");
|
||||
|
||||
macro_rules! test_literal_list {
|
||||
|
||||
|
||||
($f:ident, $string:literal) => {
|
||||
assert!($f($string))
|
||||
};
|
||||
|
||||
($f:ident, $first:literal, $($rest:literal),*) => {
|
||||
test_literal_list!($f, $first);
|
||||
test_literal_list!($f, $($rest),*);
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_float_dots() {
|
||||
let valid_floats = vec![
|
||||
"0.0",
|
||||
"-0.0",
|
||||
"3.141592653589793",
|
||||
"-1.123456765432123456789",
|
||||
];
|
||||
assert!(Parser::new().parse("1.1").is_ok());
|
||||
assert!(Parser::new().parse("-1.1").is_ok());
|
||||
assert!(Parser::new().parse(".1").is_ok());
|
||||
assert!(Parser::new().parse("-.1").is_ok());
|
||||
fn parse_str(input: &str) -> Result<Expression, ()> {
|
||||
let lexerdef = grammar_l::lexerdef();
|
||||
let lexer = lexerdef.lexer(&input);
|
||||
let (res, errs) = grammar_y::parse(&lexer);
|
||||
if let Some(parsed_res) = res {
|
||||
parsed_res
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_float_exps() {
|
||||
let parser = crate::expressions::FloatParser::new();
|
||||
|
||||
let valid_float_exps: Vec<&str> = vec![
|
||||
"1e1", "-1e1", "1e-1", "-1e-1", "1.1e1", "1.1e-1", "-1.1e1", "-1.1e-1", ".1e1", "-.1e1",
|
||||
"-.1e-1", "1E1", "-1E1", "1E-1", "-1E-1", "1.1E1", "1.1E-1", "-1.1E1", "-1.1E-1", ".1E1",
|
||||
"-.1E1", "-.1E-1",
|
||||
];
|
||||
fn test_int_literal() {
|
||||
let lexer = grammar_l::lexerdef();
|
||||
let valid_ints = vec!["1", "1", "100000000000000000", "1234567890", "1234567890"];
|
||||
let invalid_ints = vec!["01", "AAAAAAAAAAAAAAA", "-1"];
|
||||
|
||||
let invalid_float_exps: Vec<&str> = vec![
|
||||
"AAAAAAAAAAAAAAA",
|
||||
"1.e1",
|
||||
"1e1.1",
|
||||
"1.1e1.1",
|
||||
"-1e1.1",
|
||||
"1e-1.1",
|
||||
];
|
||||
let matches_parsed_int = |s: &str| match parse_str(s) {
|
||||
Ok(i) => matches!(i, Expression::Lit(Literal::Int(_))),
|
||||
Err(_) => false,
|
||||
};
|
||||
|
||||
assert!(
|
||||
valid_float_exps
|
||||
.into_iter()
|
||||
.all(|s| parser.parse(s).is_ok())
|
||||
);
|
||||
assert!(
|
||||
invalid_float_exps
|
||||
.into_iter()
|
||||
.all(|s| parser.parse(s).is_err())
|
||||
test_literal_list!(
|
||||
matches_parsed_int,
|
||||
"1",
|
||||
"1",
|
||||
"100000000000000000",
|
||||
"1234567890",
|
||||
"1234567890"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_atom_parser() {
|
||||
use crate::ast::literal::Literal;
|
||||
let parser = crate::expressions::AtomParser::new();
|
||||
|
||||
let parsed_int_atom = parser.parse("123");
|
||||
assert!(matches!(parsed_int_atom, Ok(Literal::Int(_))));
|
||||
|
||||
let parsed_int_atom = parser.parse("-1.12345");
|
||||
assert!(matches!(parsed_int_atom, Ok(Literal::Float(_))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_expr_parser() {
|
||||
let parser = crate::expressions::ASTExpressionParser::new();
|
||||
|
||||
let parsed_int_expr = parser.parse("123");
|
||||
assert!(matches!(parsed_int_expr, Ok(Literal::Int(_))));
|
||||
|
||||
let parsed_int_expr = parser.parse("-4.20E-69");
|
||||
assert!(matches!(parsed_int_expr, Ok(Literal::Float(_))));
|
||||
|
||||
// test_literal_list!(parse_str, "01", "AAAAAAAAAAAAAAA", "-1");
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
mod literals;
|
||||
mod expressions;
|
||||
mod literals;
|
||||
|
||||
Reference in New Issue
Block a user