├── .gitattributes ├── .gitignore ├── .metadata ├── .lock ├── .log ├── .mylyn │ ├── .tasks.xml.zip │ ├── repositories.xml.zip │ └── tasks.xml.zip ├── .plugins │ ├── org.eclipse.core.resources │ │ ├── .history │ │ │ ├── 1 │ │ │ │ └── 305f3dd1928d00151e65b0172a36f2e7 │ │ │ ├── 2 │ │ │ │ └── 10613dc2ce8d00151e65b0172a36f2e7 │ │ │ ├── 3 │ │ │ │ └── 002bf17e2c8d00151ff98b6ccdcce79a │ │ │ ├── 4 │ │ │ │ ├── 206d4eaa818e00151eb8dfb136779953 │ │ │ │ ├── b02d1ec7808e00151eb8dfb136779953 │ │ │ │ ├── c0ec76ccae8d00151e65b0172a36f2e7 │ │ │ │ ├── d04e2e84e68d0015152eb56ce1e9b342 │ │ │ │ └── d074191c018e00151110fe7eb07a71f2 │ │ │ ├── 5 │ │ │ │ └── c027c2d5058e00151110fe7eb07a71f2 │ │ │ ├── 6 │ │ │ │ └── 40db664d988d00151e65b0172a36f2e7 │ │ │ ├── 9 │ │ │ │ ├── 60cc3b77008e00151110fe7eb07a71f2 │ │ │ │ └── e0253095f68d00151110fe7eb07a71f2 │ │ │ ├── 11 │ │ │ │ └── 40896976f58d00151110fe7eb07a71f2 │ │ │ ├── 12 │ │ │ │ └── 50fe8ca7308d00151ff98b6ccdcce79a │ │ │ ├── 13 │ │ │ │ └── f05e739ebb8d00151e65b0172a36f2e7 │ │ │ ├── 14 │ │ │ │ └── c0b4916ee88d0015152eb56ce1e9b342 │ │ │ ├── 15 │ │ │ │ ├── 30d89bc3958e00151eb8dfb136779953 │ │ │ │ ├── d17a27cf7f8e00151eb8dfb136779953 │ │ │ │ └── f05aa283c48d00151e65b0172a36f2e7 │ │ │ ├── 16 │ │ │ │ └── 1095e0e6f58d00151110fe7eb07a71f2 │ │ │ ├── 17 │ │ │ │ └── 1021aad7968d00151e65b0172a36f2e7 │ │ │ ├── 20 │ │ │ │ ├── 80fc96d9108e00151110fe7eb07a71f2 │ │ │ │ ├── a0b44e6dc08d00151e65b0172a36f2e7 │ │ │ │ └── f00bc7c5ed8d0015152eb56ce1e9b342 │ │ │ ├── 23 │ │ │ │ └── 709b63a48b8d00151e65b0172a36f2e7 │ │ │ ├── 24 │ │ │ │ └── 200dbc2cca8d00151e65b0172a36f2e7 │ │ │ ├── 30 │ │ │ │ └── 30cec119ca8d00151e65b0172a36f2e7 │ │ │ ├── 32 │ │ │ │ └── 80a5fec08c8d00151e65b0172a36f2e7 │ │ │ ├── 34 │ │ │ │ ├── c0707aacc48d00151e65b0172a36f2e7 │ │ │ │ └── e07d6d03c18d00151e65b0172a36f2e7 │ │ │ ├── 35 │ │ │ │ ├── 508c5fbdb98d00151e65b0172a36f2e7 │ │ │ │ └── e0830960128e00151110fe7eb07a71f2 │ │ │ ├── 36 │ │ │ │ └── 4062f12cfc8d00151110fe7eb07a71f2 │ │ │ ├── 37 │ │ │ │ ├── 509e569dfd8d00151110fe7eb07a71f2 │ │ │ │ └── 71884c53c08d00151e65b0172a36f2e7 │ │ │ ├── 38 │ │ │ │ └── b0e253c1928d00151e65b0172a36f2e7 │ │ │ ├── 41 │ │ │ │ ├── 006b3eaae68d0015152eb56ce1e9b342 │ │ │ │ ├── 60f1091ae38d0015152eb56ce1e9b342 │ │ │ │ └── c0db852ce78d0015152eb56ce1e9b342 │ │ │ ├── 42 │ │ │ │ └── b1059077e68d0015152eb56ce1e9b342 │ │ │ ├── 43 │ │ │ │ └── 5010eb9b118e00151110fe7eb07a71f2 │ │ │ ├── 45 │ │ │ │ └── a0f36235e68d0015152eb56ce1e9b342 │ │ │ ├── 46 │ │ │ │ └── d00656b90d8e00151110fe7eb07a71f2 │ │ │ ├── 49 │ │ │ │ └── 20db4916ee8d0015152eb56ce1e9b342 │ │ │ ├── 51 │ │ │ │ ├── 500b90a0e58d0015152eb56ce1e9b342 │ │ │ │ └── 800de5befe8d00151110fe7eb07a71f2 │ │ │ ├── 52 │ │ │ │ ├── 302b8f4a8d8d00151e65b0172a36f2e7 │ │ │ │ └── 4074baacf68d00151110fe7eb07a71f2 │ │ │ ├── 53 │ │ │ │ ├── 50690751928d00151e65b0172a36f2e7 │ │ │ │ └── c0dfd985958d00151e65b0172a36f2e7 │ │ │ ├── 57 │ │ │ │ ├── 10e1c533c88d00151e65b0172a36f2e7 │ │ │ │ ├── 20dd7e32ff8d00151110fe7eb07a71f2 │ │ │ │ ├── 909c7c75c68d00151e65b0172a36f2e7 │ │ │ │ └── f0ce6876928d00151e65b0172a36f2e7 │ │ │ ├── 58 │ │ │ │ └── 40b13bfd008e00151110fe7eb07a71f2 │ │ │ ├── 60 │ │ │ │ └── 507d6a3be58d0015152eb56ce1e9b342 │ │ │ ├── 61 │ │ │ │ └── c0568362c08d00151e65b0172a36f2e7 │ │ │ ├── 62 │ │ │ │ └── 60c04254a18d00151e65b0172a36f2e7 │ │ │ ├── 63 │ │ │ │ └── 00ba304dee8d0015152eb56ce1e9b342 │ │ │ ├── 64 │ │ │ │ └── 403b92c3958e00151eb8dfb136779953 │ │ │ ├── 68 │ │ │ │ └── 40cfcbeac48d00151e65b0172a36f2e7 │ │ │ ├── 70 │ │ │ │ └── 706003c18c8d00151e65b0172a36f2e7 │ │ │ ├── 71 │ │ │ │ └── c0430b01e98d0015152eb56ce1e9b342 │ │ │ ├── 73 │ │ │ │ ├── 10e65cd5308d00151ff98b6ccdcce79a │ │ │ │ └── 60b5ee9efb8d00151110fe7eb07a71f2 │ │ │ ├── 74 │ │ │ │ └── 20f7d37bc98d00151e65b0172a36f2e7 │ │ │ ├── 75 │ │ │ │ └── 30c97f48fb8d00151110fe7eb07a71f2 │ │ │ ├── 77 │ │ │ │ ├── 9016dcd3ed8d0015152eb56ce1e9b342 │ │ │ │ ├── 90de755f928d00151e65b0172a36f2e7 │ │ │ │ └── c05d79ccae8d00151e65b0172a36f2e7 │ │ │ ├── 78 │ │ │ │ └── 201a981c928d00151e65b0172a36f2e7 │ │ │ ├── 81 │ │ │ │ └── 90840a14118e00151110fe7eb07a71f2 │ │ │ ├── 82 │ │ │ │ ├── 9075eed8128e00151110fe7eb07a71f2 │ │ │ │ └── e0fd73cd108e00151110fe7eb07a71f2 │ │ │ ├── 84 │ │ │ │ ├── 2050cdd0128e00151110fe7eb07a71f2 │ │ │ │ ├── 805a8d62108e00151110fe7eb07a71f2 │ │ │ │ ├── 90e335a9058e00151110fe7eb07a71f2 │ │ │ │ └── b0867100e78d0015152eb56ce1e9b342 │ │ │ ├── 87 │ │ │ │ ├── 4020579d0d8e00151110fe7eb07a71f2 │ │ │ │ └── c0214a41e68d0015152eb56ce1e9b342 │ │ │ ├── 88 │ │ │ │ ├── 21d7a7d7968d00151e65b0172a36f2e7 │ │ │ │ └── 306fda30ef8d0015152eb56ce1e9b342 │ │ │ ├── 91 │ │ │ │ └── f0fbc062848e00151eb8dfb136779953 │ │ │ ├── 92 │ │ │ │ ├── 80fcb088018e00151110fe7eb07a71f2 │ │ │ │ └── c05580f2fc8d00151110fe7eb07a71f2 │ │ │ ├── 94 │ │ │ │ └── d0bf890cfb8d00151110fe7eb07a71f2 │ │ │ ├── 96 │ │ │ │ ├── 003992c2e88d0015152eb56ce1e9b342 │ │ │ │ └── 10ed3f04958d00151e65b0172a36f2e7 │ │ │ ├── 99 │ │ │ │ └── 719b63a48b8d00151e65b0172a36f2e7 │ │ │ ├── 1a │ │ │ │ └── 301e2a13e68d0015152eb56ce1e9b342 │ │ │ ├── 1f │ │ │ │ └── 309c42cde58d0015152eb56ce1e9b342 │ │ │ ├── 2a │ │ │ │ ├── 6069bc3d318d00151ff98b6ccdcce79a │ │ │ │ └── f08f98b6ca8d00151e65b0172a36f2e7 │ │ │ ├── 2b │ │ │ │ ├── 906a72acfd8d00151110fe7eb07a71f2 │ │ │ │ └── b0052157e48d0015152eb56ce1e9b342 │ │ │ ├── 2d │ │ │ │ └── a0313e0a898e00151eb8dfb136779953 │ │ │ ├── 2f │ │ │ │ ├── 10c0830b808e00151eb8dfb136779953 │ │ │ │ ├── 806848fe0f8e00151110fe7eb07a71f2 │ │ │ │ ├── 90556a53008e00151110fe7eb07a71f2 │ │ │ │ └── f04a8f70138e00151110fe7eb07a71f2 │ │ │ ├── 3a │ │ │ │ ├── 30b73e57318d00151ff98b6ccdcce79a │ │ │ │ └── f0e87ec3a68d00151e65b0172a36f2e7 │ │ │ ├── 3b │ │ │ │ ├── 10a46304c98d00151e65b0172a36f2e7 │ │ │ │ ├── 50488ce5f88d00151110fe7eb07a71f2 │ │ │ │ └── f01ee6befe8d00151110fe7eb07a71f2 │ │ │ ├── 3c │ │ │ │ ├── 608c89bb808e00151eb8dfb136779953 │ │ │ │ └── c04e14f6f88d00151110fe7eb07a71f2 │ │ │ ├── 3d │ │ │ │ ├── 804bb218318d00151ff98b6ccdcce79a │ │ │ │ └── b00ad4fee38d0015152eb56ce1e9b342 │ │ │ ├── 3e │ │ │ │ └── e0d1e620318d00151ff98b6ccdcce79a │ │ │ ├── 3f │ │ │ │ └── 90e10e1cc18d00151e65b0172a36f2e7 │ │ │ ├── 4b │ │ │ │ └── 1088d8058d8d00151e65b0172a36f2e7 │ │ │ ├── 4e │ │ │ │ └── 80412025108e00151110fe7eb07a71f2 │ │ │ ├── 5b │ │ │ │ └── 50ee6c3be58d0015152eb56ce1e9b342 │ │ │ ├── 5c │ │ │ │ └── 909355fd8c8d00151e65b0172a36f2e7 │ │ │ ├── 5d │ │ │ │ ├── f05981c3a68d00151e65b0172a36f2e7 │ │ │ │ └── f0c12d2f318d00151ff98b6ccdcce79a │ │ │ ├── 5e │ │ │ │ ├── 0095f5a0138e00151110fe7eb07a71f2 │ │ │ │ └── f0bbf5bbe18d0015152eb56ce1e9b342 │ │ │ ├── 5f │ │ │ │ ├── 0069622dfb8d00151110fe7eb07a71f2 │ │ │ │ └── b0dd7645f58d00151110fe7eb07a71f2 │ │ │ ├── 6b │ │ │ │ └── 00ffe949e48d0015152eb56ce1e9b342 │ │ │ ├── 6c │ │ │ │ └── 41973ca3f18d0015152eb56ce1e9b342 │ │ │ ├── 6e │ │ │ │ └── 60e2602dfb8d00151110fe7eb07a71f2 │ │ │ ├── 6f │ │ │ │ ├── 40edc436e98d0015152eb56ce1e9b342 │ │ │ │ ├── c0e93cfd008e00151110fe7eb07a71f2 │ │ │ │ └── d081efc8fd8d00151110fe7eb07a71f2 │ │ │ ├── 7a │ │ │ │ ├── 2073330fe78d0015152eb56ce1e9b342 │ │ │ │ └── 507b4754a18d00151e65b0172a36f2e7 │ │ │ ├── 7b │ │ │ │ └── 60b3e586f68d00151110fe7eb07a71f2 │ │ │ ├── 7c │ │ │ │ ├── 309d41c5ca8d00151e65b0172a36f2e7 │ │ │ │ ├── c0d20801e98d0015152eb56ce1e9b342 │ │ │ │ └── e0a87f8d808e00151eb8dfb136779953 │ │ │ ├── 7d │ │ │ │ └── b04c3d56f58d00151110fe7eb07a71f2 │ │ │ ├── 7f │ │ │ │ ├── 30048205fc8d00151110fe7eb07a71f2 │ │ │ │ ├── 306c4ebaef8d0015152eb56ce1e9b342 │ │ │ │ └── 5009e7befe8d00151110fe7eb07a71f2 │ │ │ ├── 8d │ │ │ │ ├── 20d7a7d7968d00151e65b0172a36f2e7 │ │ │ │ ├── 3065c8318d8d00151e65b0172a36f2e7 │ │ │ │ └── 70884c53c08d00151e65b0172a36f2e7 │ │ │ ├── 8e │ │ │ │ ├── 30991171358d00151ff98b6ccdcce79a │ │ │ │ └── 603b5515c18d00151e65b0172a36f2e7 │ │ │ ├── a │ │ │ │ ├── 50a676edf88d00151110fe7eb07a71f2 │ │ │ │ └── 70ea51f9308d00151ff98b6ccdcce79a │ │ │ ├── a0 │ │ │ │ ├── 5191644d988d00151e65b0172a36f2e7 │ │ │ │ └── d0387203c18d00151e65b0172a36f2e7 │ │ │ ├── a1 │ │ │ │ └── 10ebc5b2308d00151ff98b6ccdcce79a │ │ │ ├── a2 │ │ │ │ ├── 0051c2c5ed8d0015152eb56ce1e9b342 │ │ │ │ ├── 70a47b950f8e00151110fe7eb07a71f2 │ │ │ │ └── f00951a4f08d0015152eb56ce1e9b342 │ │ │ ├── a3 │ │ │ │ └── d0838756ef8d0015152eb56ce1e9b342 │ │ │ ├── a5 │ │ │ │ └── 702d454e818e00151eb8dfb136779953 │ │ │ ├── aa │ │ │ │ └── a0bb0e89fb8d00151110fe7eb07a71f2 │ │ │ ├── ab │ │ │ │ ├── d0724104898e00151eb8dfb136779953 │ │ │ │ └── f0c84238108e00151110fe7eb07a71f2 │ │ │ ├── ac │ │ │ │ └── e090d5b0ed8d0015152eb56ce1e9b342 │ │ │ ├── ad │ │ │ │ └── a0cd0193c98d00151e65b0172a36f2e7 │ │ │ ├── b0 │ │ │ │ └── 4044f7f37e8e00151eb8dfb136779953 │ │ │ ├── b4 │ │ │ │ └── 70de8dc3e58d0015152eb56ce1e9b342 │ │ │ ├── b5 │ │ │ │ └── d0c04e68ca8d00151e65b0172a36f2e7 │ │ │ ├── b6 │ │ │ │ ├── 50089d09c88d00151e65b0172a36f2e7 │ │ │ │ └── e0f7f328e68d0015152eb56ce1e9b342 │ │ │ ├── b8 │ │ │ │ ├── 5009deb4b78d00151e65b0172a36f2e7 │ │ │ │ └── b0bb042ad28d00151e65b0172a36f2e7 │ │ │ ├── b9 │ │ │ │ └── 50d12684818e00151eb8dfb136779953 │ │ │ ├── bc │ │ │ │ ├── 002a69b4108e00151110fe7eb07a71f2 │ │ │ │ ├── 60750053ee8d0015152eb56ce1e9b342 │ │ │ │ └── e01f15d5fa8d00151110fe7eb07a71f2 │ │ │ ├── bd │ │ │ │ └── b0818d45ef8d0015152eb56ce1e9b342 │ │ │ ├── c │ │ │ │ └── 104fdabd108e00151110fe7eb07a71f2 │ │ │ ├── c1 │ │ │ │ ├── 408c6a7ee48d0015152eb56ce1e9b342 │ │ │ │ └── c0f055c4e28d0015152eb56ce1e9b342 │ │ │ ├── c2 │ │ │ │ └── 30d423ace38d0015152eb56ce1e9b342 │ │ │ ├── c3 │ │ │ │ ├── 10ef4c39968e00151eb8dfb136779953 │ │ │ │ └── 51981870e78d0015152eb56ce1e9b342 │ │ │ ├── c6 │ │ │ │ └── 308f2c13e68d0015152eb56ce1e9b342 │ │ │ ├── c7 │ │ │ │ └── 70b322e77f8e00151eb8dfb136779953 │ │ │ ├── c8 │ │ │ │ ├── 1036f329ff8d00151110fe7eb07a71f2 │ │ │ │ └── f095861e8d8d00151e65b0172a36f2e7 │ │ │ ├── c9 │ │ │ │ ├── 31991171358d00151ff98b6ccdcce79a │ │ │ │ └── f0beda7eff8d00151110fe7eb07a71f2 │ │ │ ├── ca │ │ │ │ └── 716003c18c8d00151e65b0172a36f2e7 │ │ │ ├── cc │ │ │ │ └── d07a27cf7f8e00151eb8dfb136779953 │ │ │ ├── cd │ │ │ │ ├── 20a4288d108e00151110fe7eb07a71f2 │ │ │ │ ├── b000baaee98d0015152eb56ce1e9b342 │ │ │ │ ├── b0a28a27cc8d00151e65b0172a36f2e7 │ │ │ │ └── f01961c1128e00151110fe7eb07a71f2 │ │ │ ├── cf │ │ │ │ └── d053edaa928d00151e65b0172a36f2e7 │ │ │ ├── d │ │ │ │ └── 70e5fe99c98d00151e65b0172a36f2e7 │ │ │ ├── d1 │ │ │ │ └── 9072b88a808e00151eb8dfb136779953 │ │ │ ├── d3 │ │ │ │ ├── 00d2ff0e818e00151eb8dfb136779953 │ │ │ │ ├── 50e3f34be58d0015152eb56ce1e9b342 │ │ │ │ └── c0e806a4c88d00151e65b0172a36f2e7 │ │ │ ├── d4 │ │ │ │ └── c00f481f128e00151110fe7eb07a71f2 │ │ │ ├── d8 │ │ │ │ ├── 80cd4753c08d00151e65b0172a36f2e7 │ │ │ │ └── 90e5c108ff8d00151110fe7eb07a71f2 │ │ │ ├── d9 │ │ │ │ ├── 30841287008e00151110fe7eb07a71f2 │ │ │ │ ├── 702df21df68d00151110fe7eb07a71f2 │ │ │ │ └── b0059077e68d0015152eb56ce1e9b342 │ │ │ ├── dc │ │ │ │ ├── 20d4bb07e78d0015152eb56ce1e9b342 │ │ │ │ ├── 5091644d988d00151e65b0172a36f2e7 │ │ │ │ ├── 707f16d5fa8d00151110fe7eb07a71f2 │ │ │ │ └── d097732a8a8d00151e65b0172a36f2e7 │ │ │ ├── de │ │ │ │ ├── 2059cc67c48d00151e65b0172a36f2e7 │ │ │ │ └── c02d4604898e00151eb8dfb136779953 │ │ │ ├── df │ │ │ │ ├── 204bef6ff78d00151110fe7eb07a71f2 │ │ │ │ ├── 30560ea5928d00151e65b0172a36f2e7 │ │ │ │ └── 31280f71358d00151ff98b6ccdcce79a │ │ │ ├── e0 │ │ │ │ └── f015fbd4ff8d00151110fe7eb07a71f2 │ │ │ ├── e1 │ │ │ │ ├── 4038c3a4e68d0015152eb56ce1e9b342 │ │ │ │ └── c0058127cc8d00151e65b0172a36f2e7 │ │ │ ├── e4 │ │ │ │ └── 208b9a1c928d00151e65b0172a36f2e7 │ │ │ ├── e6 │ │ │ │ └── 7003f46bbc8d00151e65b0172a36f2e7 │ │ │ ├── e7 │ │ │ │ └── 30605a93118e00151110fe7eb07a71f2 │ │ │ ├── e8 │ │ │ │ └── 6080e608068e00151110fe7eb07a71f2 │ │ │ ├── e9 │ │ │ │ └── 80b2b88be68d0015152eb56ce1e9b342 │ │ │ ├── ea │ │ │ │ ├── 418c6a7ee48d0015152eb56ce1e9b342 │ │ │ │ └── c0126c03cb8d00151e65b0172a36f2e7 │ │ │ ├── eb │ │ │ │ ├── 1080ee78ed8d0015152eb56ce1e9b342 │ │ │ │ └── 50d02f81f08d0015152eb56ce1e9b342 │ │ │ ├── ed │ │ │ │ ├── 10289fd3028e00151110fe7eb07a71f2 │ │ │ │ └── 6026a6248a8d00151e65b0172a36f2e7 │ │ │ ├── ee │ │ │ │ └── d0046b85f78d00151110fe7eb07a71f2 │ │ │ ├── ef │ │ │ │ ├── 706eacafd28d00151e65b0172a36f2e7 │ │ │ │ └── b0913677ff8d00151110fe7eb07a71f2 │ │ │ ├── f │ │ │ │ └── f059c38a7e8e00151eb8dfb136779953 │ │ │ ├── f0 │ │ │ │ ├── 104cc0c90d8e00151110fe7eb07a71f2 │ │ │ │ └── b04d3172bc8d00151e65b0172a36f2e7 │ │ │ ├── f2 │ │ │ │ └── 104988ace88d0015152eb56ce1e9b342 │ │ │ ├── f3 │ │ │ │ └── 1047a21ff98d00151110fe7eb07a71f2 │ │ │ ├── f4 │ │ │ │ └── b0bccbc3e38d0015152eb56ce1e9b342 │ │ │ ├── f5 │ │ │ │ ├── 419740f6ea8d0015152eb56ce1e9b342 │ │ │ │ └── 50f9abffd18d00151e65b0172a36f2e7 │ │ │ ├── f6 │ │ │ │ └── e037c008ff8d00151110fe7eb07a71f2 │ │ │ ├── f8 │ │ │ │ ├── 0151c2c5ed8d0015152eb56ce1e9b342 │ │ │ │ ├── 2094f9e4ca8d00151e65b0172a36f2e7 │ │ │ │ ├── 50eec0a4e68d0015152eb56ce1e9b342 │ │ │ │ └── e0763567f18d0015152eb56ce1e9b342 │ │ │ ├── fa │ │ │ │ └── 704c65b7e38d0015152eb56ce1e9b342 │ │ │ ├── fb │ │ │ │ ├── 20f5982ac18d00151e65b0172a36f2e7 │ │ │ │ ├── 601932b0f78d00151110fe7eb07a71f2 │ │ │ │ └── 70ef00c18c8d00151e65b0172a36f2e7 │ │ │ └── fe │ │ │ │ └── f0777cc3a68d00151e65b0172a36f2e7 │ │ ├── .projects │ │ │ ├── LexicalAnalyzer │ │ │ │ ├── .indexes │ │ │ │ │ └── properties.index │ │ │ │ ├── .markers │ │ │ │ ├── org.eclipse.egit.core │ │ │ │ │ └── GitProjectData.properties │ │ │ │ └── org.eclipse.jdt.core │ │ │ │ │ └── state.dat │ │ │ └── SyntaxParser │ │ │ │ ├── .indexes │ │ │ │ ├── aa │ │ │ │ │ └── history.index │ │ │ │ ├── e4 │ │ │ │ │ ├── 1f │ │ │ │ │ │ └── history.index │ │ │ │ │ ├── b9 │ │ │ │ │ │ └── history.index │ │ │ │ │ ├── e1 │ │ │ │ │ │ └── history.index │ │ │ │ │ └── history.index │ │ │ │ └── properties.index │ │ │ │ ├── .markers │ │ │ │ ├── org.eclipse.egit.core │ │ │ │ └── GitProjectData.properties │ │ │ │ └── org.eclipse.jdt.core │ │ │ │ └── state.dat │ │ ├── .root │ │ │ ├── .indexes │ │ │ │ ├── history.version │ │ │ │ ├── properties.index │ │ │ │ └── properties.version │ │ │ └── 14.tree │ │ └── .safetable │ │ │ └── org.eclipse.core.resources │ ├── org.eclipse.core.runtime │ │ └── .settings │ │ │ ├── com.collabnet.subversion.merge.prefs │ │ │ ├── org.eclipse.core.resources.prefs │ │ │ ├── org.eclipse.debug.ui.prefs │ │ │ ├── org.eclipse.egit.core.prefs │ │ │ ├── org.eclipse.jdt.core.prefs │ │ │ ├── org.eclipse.jdt.launching.prefs │ │ │ ├── org.eclipse.jdt.ui.prefs │ │ │ ├── org.eclipse.mylyn.context.core.prefs │ │ │ ├── org.eclipse.mylyn.monitor.ui.prefs │ │ │ ├── org.eclipse.mylyn.tasks.ui.prefs │ │ │ ├── org.eclipse.pde.api.tools.prefs │ │ │ ├── org.eclipse.team.ui.prefs │ │ │ ├── org.eclipse.ui.editors.prefs │ │ │ ├── org.eclipse.ui.ide.prefs │ │ │ ├── org.eclipse.ui.prefs │ │ │ └── org.tigris.subversion.subclipse.ui.prefs │ ├── org.eclipse.debug.core │ │ └── .launches │ │ │ ├── AnalyzeTable.launch │ │ │ ├── Buffer.launch │ │ │ ├── CFG.launch │ │ │ ├── Derivation.launch │ │ │ ├── LexicalAnalyzer (1).launch │ │ │ ├── LexicalAnalyzer.launch │ │ │ ├── Scan.launch │ │ │ └── SyntaxParser.launch │ ├── org.eclipse.debug.ui │ │ ├── dialog_settings.xml │ │ └── launchConfigurationHistory.xml │ ├── org.eclipse.e4.workbench │ │ └── workbench.xmi │ ├── org.eclipse.egit.ui │ │ └── dialog_settings.xml │ ├── org.eclipse.jdt.core │ │ ├── 1017853417.index │ │ ├── 1045485630.index │ │ ├── 115418958.index │ │ ├── 1337478678.index │ │ ├── 1425820041.index │ │ ├── 1787405673.index │ │ ├── 1790300951.index │ │ ├── 2535676096.index │ │ ├── 2674037006.index │ │ ├── 3045053200.index │ │ ├── 323251068.index │ │ ├── 355369697.index │ │ ├── 3604769962.index │ │ ├── 3656756579.index │ │ ├── 3716007315.index │ │ ├── 3723539909.index │ │ ├── 3954291735.index │ │ ├── 4187470955.index │ │ ├── 533208796.index │ │ ├── 605290374.index │ │ ├── 994834796.index │ │ ├── externalFilesCache │ │ ├── externalLibsTimeStamps │ │ ├── invalidArchivesCache │ │ ├── javaLikeNames.txt │ │ ├── nonChainingJarsCache │ │ ├── savedIndexNames.txt │ │ └── variablesAndContainers.dat │ ├── org.eclipse.jdt.launching │ │ ├── .install.xml │ │ └── libraryInfos.xml │ ├── org.eclipse.jdt.ui │ │ ├── OpenTypeHistory.xml │ │ ├── QualifiedTypeNameHistory.xml │ │ └── dialog_settings.xml │ ├── org.eclipse.ltk.core.refactoring │ │ └── .refactorings │ │ │ ├── LexicalAnalyzer │ │ │ └── 2015 │ │ │ │ ├── 10 │ │ │ │ ├── 43 │ │ │ │ │ ├── refactorings.history │ │ │ │ │ └── refactorings.index │ │ │ │ └── 44 │ │ │ │ │ ├── refactorings.history │ │ │ │ │ └── refactorings.index │ │ │ │ └── 11 │ │ │ │ └── 47 │ │ │ │ ├── refactorings.history │ │ │ │ └── refactorings.index │ │ │ └── SyntaxParser │ │ │ └── 2015 │ │ │ └── 11 │ │ │ └── 47 │ │ │ ├── refactorings.history │ │ │ └── refactorings.index │ ├── org.eclipse.ltk.ui.refactoring │ │ └── dialog_settings.xml │ ├── org.eclipse.pde.core │ │ └── .cache │ │ │ └── clean-cache.properties │ ├── org.eclipse.ui.editors │ │ └── dialog_settings.xml │ ├── org.eclipse.ui.ide │ │ └── dialog_settings.xml │ ├── org.eclipse.ui.workbench.texteditor │ │ └── dialog_settings.xml │ ├── org.eclipse.ui.workbench │ │ ├── dialog_settings.xml │ │ └── workingsets.xml │ └── org.tigris.subversion.subclipse.ui │ │ └── dialog_settings.xml └── version.ini ├── LexicalAnalyzer ├── .classpath ├── .gitignore ├── .project ├── .settings │ └── org.eclipse.jdt.core.prefs ├── Input │ └── source1.c ├── Output │ └── result.c ├── Report │ └── 实验报告.docx └── src │ ├── lex │ ├── LexicalAnalyzer.java │ ├── Scan.java │ ├── Token.java │ └── Type.java │ └── test │ └── Main.java ├── MiniC-Compiler.zip ├── SyntaxParser ├── .classpath ├── .gitignore ├── .project ├── .settings │ └── org.eclipse.jdt.core.prefs ├── Input │ ├── cfg.txt │ └── source.c ├── Output │ └── result.c └── src │ ├── lex │ ├── LexicalAnalyzer.java │ ├── Scan.java │ ├── Token.java │ └── Type.java │ ├── main │ └── Test.java │ └── parser │ ├── AnalyzeTable.java │ ├── CFG.java │ ├── DFA.java │ ├── DFAState.java │ ├── Derivation.java │ ├── LRDerivation.java │ └── SyntaxParser.java ├── readme.txt ├── 《编译原理》实验报告——词法分析.docx ├── 《编译原理》实验报告——词法分析.pdf ├── 《编译原理》实验报告——语法分析.docx └── 《编译原理》实验报告——语法分析.pdf /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /.metadata/.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.lock -------------------------------------------------------------------------------- /.metadata/.mylyn/.tasks.xml.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.mylyn/.tasks.xml.zip -------------------------------------------------------------------------------- /.metadata/.mylyn/repositories.xml.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.mylyn/repositories.xml.zip -------------------------------------------------------------------------------- /.metadata/.mylyn/tasks.xml.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.mylyn/tasks.xml.zip -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/1/305f3dd1928d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/1/305f3dd1928d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/11/40896976f58d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/11/40896976f58d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/12/50fe8ca7308d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/12/50fe8ca7308d00151ff98b6ccdcce79a -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/13/f05e739ebb8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/13/f05e739ebb8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/14/c0b4916ee88d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/14/c0b4916ee88d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/15/30d89bc3958e00151eb8dfb136779953: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class DFA { 6 | 7 | public ArrayList states = new ArrayList(); 8 | 9 | public DFA(){ 10 | 11 | } 12 | 13 | public DFAState get(int i){ 14 | return states.get(i); 15 | } 16 | 17 | public int size(){ 18 | return states.size(); 19 | } 20 | 21 | public int contains(DFAState state){ 22 | for(int i = 0;i set = new HashSet(); 9 | 10 | public DFAState(int id){ 11 | this.id = id; 12 | } 13 | 14 | public boolean addNewDerivation(Derivation d){ 15 | if(set.contains(d)){ 16 | return false; 17 | } else { 18 | set.add(d); 19 | return true; 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/1a/301e2a13e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/1a/301e2a13e68d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/1f/309c42cde58d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(contains(set,state.set)&&contains(state.set,set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | private boolean contains(ArrayList set1,ArrayList set2){ 45 | for(int i = 0;i < set2.size();i++){ 46 | if(!set1.contains(set2.get(i))){ 47 | return false; 48 | } 49 | } 50 | return true; 51 | } 52 | 53 | public ArrayList getGotoPath(){ 54 | ArrayList result = new ArrayList(); 55 | for(LRDerivation lrd:set){ 56 | if(lrd.d.list.size()==lrd.index){ 57 | continue; 58 | } 59 | String s = lrd.d.list.get(lrd.index); 60 | if(!result.contains(s)){ 61 | result.add(s); 62 | } 63 | } 64 | return result; 65 | } 66 | 67 | public ArrayList getLRDs(String s){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size() != lrd.index){ 71 | String s1 = lrd.d.list.get(lrd.index); 72 | if(s1.equals(s)){ 73 | result.add(lrd); 74 | } 75 | } 76 | } 77 | return result; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2/10613dc2ce8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public HashSet set = new HashSet(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(set.equals(state.set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | public ArrayList getGotoPath(){ 45 | ArrayList result = new ArrayList(); 46 | for(LRDerivation lrd:set){ 47 | String s = lrd.d.list.get(lrd.index); 48 | if(!result.contains(s)){ 49 | result.add(s); 50 | } 51 | } 52 | return result; 53 | } 54 | 55 | public ArrayList getLRDs(String s){ 56 | ArrayList result = new ArrayList(); 57 | for(LRDerivation lrd:set){ 58 | String s1 = lrd.d.list.get(lrd.index); 59 | if(s1.equals(s)){ 60 | result.add(lrd); 61 | } 62 | } 63 | return result; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/20/80fc96d9108e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/20/80fc96d9108e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/20/a0b44e6dc08d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/20/a0b44e6dc08d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/20/f00bc7c5ed8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(left.equals(d.left)){ 31 | if(list.size() == d.list.size()){ 32 | int size = list.size(); 33 | for(int i = 0;i < size;i++){ 34 | if(!d.list.get(i).equals(list.get(i))){ 35 | return false; 36 | } 37 | } 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } else { 43 | return false; 44 | } 45 | } 46 | 47 | public void print(){ 48 | System.out.println(this.toString()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/23/709b63a48b8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class CFGAnalysis { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/24/200dbc2cca8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/24/200dbc2cca8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2a/6069bc3d318d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class Derivation { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2a/f08f98b6ca8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | E->T E' 2 | E'->+ T E' 3 | T->F T' 4 | T'->* F T' 5 | F->( E )|id -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2b/906a72acfd8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/2b/906a72acfd8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2b/b0052157e48d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(left.equals(d.left)){ 31 | if(list.size() == d.list.size()){ 32 | int size = list.size(); 33 | for(int i = 0;i < size;i++){ 34 | if(!d.list.get(i).equals(list.get(i))){ 35 | return false; 36 | } 37 | } 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } else { 43 | return false; 44 | } 45 | } 46 | 47 | public void print(){ 48 | System.out.println(this.toString()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2d/a0313e0a898e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/2d/a0313e0a898e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2f/10c0830b808e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/2f/10c0830b808e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2f/806848fe0f8e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/2f/806848fe0f8e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2f/90556a53008e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/2f/90556a53008e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/2f/f04a8f70138e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/2f/f04a8f70138e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3/002bf17e2c8d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3/002bf17e2c8d00151ff98b6ccdcce79a -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/30/30cec119ca8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/30/30cec119ca8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/32/80a5fec08c8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class Derivation { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/34/c0707aacc48d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/34/c0707aacc48d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/34/e07d6d03c18d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | S'->S 2 | S->C C 3 | C->c C|d -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/35/508c5fbdb98d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/35/508c5fbdb98d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/35/e0830960128e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/35/e0830960128e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/36/4062f12cfc8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/36/4062f12cfc8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/37/509e569dfd8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/37/509e569dfd8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/37/71884c53c08d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/37/71884c53c08d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/38/b0e253c1928d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/38/b0e253c1928d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3a/30b73e57318d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3a/30b73e57318d00151ff98b6ccdcce79a -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3a/f0e87ec3a68d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3a/f0e87ec3a68d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3b/10a46304c98d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3b/10a46304c98d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3b/50488ce5f88d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3b/50488ce5f88d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3b/f01ee6befe8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3b/f01ee6befe8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3c/608c89bb808e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3c/608c89bb808e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3c/c04e14f6f88d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3c/c04e14f6f88d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3d/804bb218318d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3d/804bb218318d00151ff98b6ccdcce79a -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3d/b00ad4fee38d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(left.equals(d.left)&&contain(list,d.list)&&contain(d.list,list)){ 31 | System.out.println(true); 32 | return true; 33 | } else { 34 | return false; 35 | } 36 | } 37 | 38 | private boolean contain(ArrayList list1,ArrayList list2){ 39 | for(String e:list2){ 40 | if(!list1.contains(e)){ 41 | return false; 42 | } 43 | } 44 | return true; 45 | } 46 | 47 | public void print(){ 48 | System.out.println(this.toString()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3e/e0d1e620318d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- 1 | 2 | public class test { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/3f/90e10e1cc18d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/3f/90e10e1cc18d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/4/206d4eaa818e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/4/206d4eaa818e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/4/b02d1ec7808e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/4/b02d1ec7808e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/4/c0ec76ccae8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.HashSet; 4 | import java.util.Iterator; 5 | 6 | public class DFAState { 7 | 8 | public int id ; 9 | public HashSet set = new HashSet(); 10 | 11 | public DFAState(int id){ 12 | this.id = id; 13 | } 14 | 15 | public boolean addNewDerivation(LRDerivation d){ 16 | if(set.contains(d)){ 17 | return false; 18 | } else { 19 | set.add(d); 20 | return true; 21 | } 22 | } 23 | 24 | public void print(){ 25 | Iterator iter = set.iterator(); 26 | while(iter.hasNext()){ 27 | iter.next().print(); 28 | } 29 | } 30 | 31 | public boolean contains(LRDerivation lrd){ 32 | return set.contains(lrd); 33 | } 34 | 35 | public boolean equals(DFAState state){ 36 | if(id==state.id&&set.equals(state.set)){ 37 | return true; 38 | } else { 39 | return false; 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/4/d04e2e84e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/4/d04e2e84e68d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/4/d074191c018e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/4/d074191c018e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/41/006b3eaae68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/41/006b3eaae68d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/41/60f1091ae38d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(list.equals(d.list)&&left.equals(d.left)){ 31 | return true; 32 | } else { 33 | return false; 34 | } 35 | } 36 | 37 | public void print(){ 38 | System.out.println(this.toString()); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/41/c0db852ce78d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/41/c0db852ce78d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/42/b1059077e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/42/b1059077e68d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/43/5010eb9b118e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/43/5010eb9b118e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/45/a0f36235e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/45/a0f36235e68d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/46/d00656b90d8e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/46/d00656b90d8e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/49/20db4916ee8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | for(LRDerivation l:set){ 34 | if(l.equals(lrd)){ 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | public boolean equalTo(DFAState state){ 42 | if(contains(set,state.set)&&contains(state.set,set)){ 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | private boolean contains(ArrayList set1,ArrayList set2){ 50 | for(int i = 0;i < set2.size();i++){ 51 | if(!contain(set1,set2.get(i))){ 52 | return false; 53 | } 54 | } 55 | return true; 56 | } 57 | 58 | private boolean contain(ArrayList set,LRDerivation lrd){ 59 | for(LRDerivation l:set){ 60 | if(l.equalTo(lrd)){ 61 | return true; 62 | } 63 | } 64 | return false; 65 | } 66 | 67 | public ArrayList getGotoPath(){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size()==lrd.index){ 71 | continue; 72 | } 73 | String s = lrd.d.list.get(lrd.index); 74 | if(!result.contains(s)){ 75 | result.add(s); 76 | } 77 | } 78 | return result; 79 | } 80 | 81 | public ArrayList getLRDs(String s){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size() != lrd.index){ 85 | String s1 = lrd.d.list.get(lrd.index); 86 | if(s1.equals(s)){ 87 | result.add(lrd); 88 | } 89 | } 90 | } 91 | return result; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/4b/1088d8058d8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/4b/1088d8058d8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/4e/80412025108e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/4e/80412025108e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/5/c027c2d5058e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/5/c027c2d5058e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/51/500b90a0e58d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(set.contains(state.set)&&state.set.contains(set)){ 38 | System.out.println("hehda"); 39 | return true; 40 | } else { 41 | return false; 42 | } 43 | } 44 | 45 | public ArrayList getGotoPath(){ 46 | ArrayList result = new ArrayList(); 47 | for(LRDerivation lrd:set){ 48 | if(lrd.d.list.size()==lrd.index){ 49 | continue; 50 | } 51 | String s = lrd.d.list.get(lrd.index); 52 | if(!result.contains(s)){ 53 | result.add(s); 54 | } 55 | } 56 | return result; 57 | } 58 | 59 | public ArrayList getLRDs(String s){ 60 | ArrayList result = new ArrayList(); 61 | for(LRDerivation lrd:set){ 62 | if(lrd.d.list.size() != lrd.index){ 63 | String s1 = lrd.d.list.get(lrd.index); 64 | if(s1.equals(s)){ 65 | result.add(lrd); 66 | } 67 | } 68 | } 69 | return result; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/51/800de5befe8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/51/800de5befe8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/52/302b8f4a8d8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | } 25 | return result; 26 | } 27 | 28 | public void print(){ 29 | System.out.println(this.toString()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/52/4074baacf68d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/52/4074baacf68d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/53/50690751928d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/53/50690751928d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/53/c0dfd985958d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/53/c0dfd985958d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/57/10e1c533c88d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/57/10e1c533c88d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/57/20dd7e32ff8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/57/20dd7e32ff8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/57/909c7c75c68d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/57/909c7c75c68d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/57/f0ce6876928d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/57/f0ce6876928d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/58/40b13bfd008e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- 1 | S'->S 2 | S->C C 3 | C->c C|d -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/5b/50ee6c3be58d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(set.contains(state.set)&&state.set.contains(set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | public ArrayList getGotoPath(){ 45 | ArrayList result = new ArrayList(); 46 | for(LRDerivation lrd:set){ 47 | if(lrd.d.list.size()==lrd.index){ 48 | continue; 49 | } 50 | String s = lrd.d.list.get(lrd.index); 51 | if(!result.contains(s)){ 52 | result.add(s); 53 | } 54 | } 55 | return result; 56 | } 57 | 58 | public ArrayList getLRDs(String s){ 59 | ArrayList result = new ArrayList(); 60 | for(LRDerivation lrd:set){ 61 | if(lrd.d.list.size() != lrd.index){ 62 | String s1 = lrd.d.list.get(lrd.index); 63 | if(s1.equals(s)){ 64 | result.add(lrd); 65 | } 66 | } 67 | } 68 | return result; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/5c/909355fd8c8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/5c/909355fd8c8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/5d/f05981c3a68d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public void print(){ 30 | System.out.println(this.toString()); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/5d/f0c12d2f318d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/5d/f0c12d2f318d00151ff98b6ccdcce79a -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/5e/0095f5a0138e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/5e/0095f5a0138e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/5e/f0bbf5bbe18d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(set.equals(state.set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | public ArrayList getGotoPath(){ 45 | ArrayList result = new ArrayList(); 46 | for(LRDerivation lrd:set){ 47 | if(lrd.d.list.size()==lrd.index){ 48 | continue; 49 | } 50 | String s = lrd.d.list.get(lrd.index); 51 | if(!result.contains(s)){ 52 | result.add(s); 53 | } 54 | } 55 | return result; 56 | } 57 | 58 | public ArrayList getLRDs(String s){ 59 | ArrayList result = new ArrayList(); 60 | for(LRDerivation lrd:set){ 61 | String s1 = lrd.d.list.get(lrd.index); 62 | if(s1.equals(s)){ 63 | result.add(lrd); 64 | } 65 | } 66 | return result; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/5f/0069622dfb8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class DFA { 6 | 7 | public ArrayList states = new ArrayList(); 8 | 9 | public DFA(ArrayList states){ 10 | this.states = states; 11 | } 12 | 13 | public DFAState get(int i){ 14 | return states.get(i); 15 | } 16 | 17 | public int size(){ 18 | return states.size(); 19 | } 20 | 21 | public int contains(DFAState state){ 22 | for(int i = 0;i states = new ArrayList(); 8 | 9 | public DFA(ArrayList states){ 10 | this.states = states; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/60/507d6a3be58d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/60/507d6a3be58d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/61/c0568362c08d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/61/c0568362c08d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/62/60c04254a18d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | S->if B S ;|if B S ; else S ;| = E|S ; S 2 | B->B >= B|| 3 | E->E + E|E * E|| -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/63/00ba304dee8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | for(LRDerivation l:set){ 34 | if(l.equalTo(lrd)){ 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | public boolean equalTo(DFAState state){ 42 | if(contains(set,state.set)&&contains(state.set,set)){ 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | private boolean contains(ArrayList set1,ArrayList set2){ 50 | for(int i = 0;i < set2.size();i++){ 51 | if(!contain(set1,set2.get(i))){ 52 | return false; 53 | } 54 | } 55 | return true; 56 | } 57 | 58 | private boolean contain(ArrayList set,LRDerivation lrd){ 59 | for(LRDerivation l:set){ 60 | if(l.equalTo(lrd)){ 61 | return true; 62 | } 63 | } 64 | return false; 65 | } 66 | 67 | public ArrayList getGotoPath(){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size()==lrd.index){ 71 | continue; 72 | } 73 | String s = lrd.d.list.get(lrd.index); 74 | if(!result.contains(s)){ 75 | result.add(s); 76 | } 77 | } 78 | return result; 79 | } 80 | 81 | public ArrayList getLRDs(String s){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size() != lrd.index){ 85 | String s1 = lrd.d.list.get(lrd.index); 86 | if(s1.equals(s)){ 87 | result.add(lrd); 88 | } 89 | } 90 | } 91 | return result; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/64/403b92c3958e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/64/403b92c3958e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/68/40cfcbeac48d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/68/40cfcbeac48d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/6b/00ffe949e48d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(left.equals(d.left)&&contain(list,d.list)&&contain(d.list,list)){ 31 | System.out.println(true); 32 | return true; 33 | } else { 34 | return false; 35 | } 36 | } 37 | 38 | public void print(){ 39 | System.out.println(this.toString()); 40 | } 41 | 42 | public static void main(String[] args){ 43 | ArrayList list = new ArrayList(); 44 | list.add("a");list.add("b"); 45 | String a = "a"; 46 | System.out.println(list.contains(a)); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/6c/41973ca3f18d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.HashSet; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | public class DFAState { 10 | 11 | public int id ; 12 | public ArrayList set = new ArrayList(); 13 | 14 | public DFAState(int id){ 15 | this.id = id; 16 | } 17 | 18 | public boolean addNewDerivation(LRDerivation d){ 19 | if(contains(d)){ 20 | return false; 21 | } else { 22 | set.add(d); 23 | return true; 24 | } 25 | } 26 | 27 | public void print(){ 28 | Iterator iter = set.iterator(); 29 | while(iter.hasNext()){ 30 | iter.next().print(); 31 | } 32 | } 33 | 34 | public boolean contains(LRDerivation lrd){ 35 | for(LRDerivation l:set){ 36 | if(l.equalTo(lrd)){ 37 | return true; 38 | } 39 | } 40 | return false; 41 | } 42 | 43 | public boolean equalTo(DFAState state){ 44 | if(this.toString().equals(state.toString())){ 45 | // if(contains(set,state.set)&&contains(state.set,set)){ 46 | return true; 47 | } else { 48 | return false; 49 | } 50 | } 51 | 52 | public String toString(){ 53 | String result = ""; 54 | for(int i = 0;i < set.size();i++){ 55 | result += set.get(i); 56 | if(i < set.size()-1){ 57 | result += "|"; 58 | } 59 | } 60 | return result; 61 | } 62 | 63 | // private boolean contains(ArrayList set1,ArrayList set2){ 64 | // for(int i = 0;i < set2.size();i++){ 65 | // if(!contain(set1,set2.get(i))){ 66 | // return false; 67 | // } 68 | // } 69 | // return true; 70 | // } 71 | 72 | private boolean contain(ArrayList set,LRDerivation lrd){ 73 | for(LRDerivation l:set){ 74 | if(l.equalTo(lrd)){ 75 | return true; 76 | } 77 | } 78 | return false; 79 | } 80 | 81 | public ArrayList getGotoPath(){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size()==lrd.index){ 85 | continue; 86 | } 87 | String s = lrd.d.list.get(lrd.index); 88 | if(!result.contains(s)){ 89 | result.add(s); 90 | } 91 | } 92 | return result; 93 | } 94 | 95 | public ArrayList getLRDs(String s){ 96 | ArrayList result = new ArrayList(); 97 | for(LRDerivation lrd:set){ 98 | if(lrd.d.list.size() != lrd.index){ 99 | String s1 = lrd.d.list.get(lrd.index); 100 | if(s1.equals(s)){ 101 | result.add(lrd); 102 | } 103 | } 104 | } 105 | return result; 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/6e/60e2602dfb8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/6e/60e2602dfb8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/6f/40edc436e98d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(contains(set,state.set)&&contains(state.set,set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | private boolean contains(ArrayList set1,ArrayList set2){ 45 | for(int i = 0;i < set2.size();i++){ 46 | if(!contain(set1,set2.get(i))){ 47 | return false; 48 | } 49 | } 50 | return true; 51 | } 52 | 53 | private boolean contain(ArrayList set,LRDerivation lrd){ 54 | for(LRDerivation l:set){ 55 | if(l.equals(lrd)){ 56 | System.out.println("hehehheheh"); 57 | return true; 58 | } 59 | } 60 | return false; 61 | } 62 | 63 | public ArrayList getGotoPath(){ 64 | ArrayList result = new ArrayList(); 65 | for(LRDerivation lrd:set){ 66 | if(lrd.d.list.size()==lrd.index){ 67 | continue; 68 | } 69 | String s = lrd.d.list.get(lrd.index); 70 | if(!result.contains(s)){ 71 | result.add(s); 72 | } 73 | } 74 | return result; 75 | } 76 | 77 | public ArrayList getLRDs(String s){ 78 | ArrayList result = new ArrayList(); 79 | for(LRDerivation lrd:set){ 80 | if(lrd.d.list.size() != lrd.index){ 81 | String s1 = lrd.d.list.get(lrd.index); 82 | if(s1.equals(s)){ 83 | result.add(lrd); 84 | } 85 | } 86 | } 87 | return result; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/6f/c0e93cfd008e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/6f/c0e93cfd008e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/6f/d081efc8fd8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/6f/d081efc8fd8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/70/706003c18c8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/70/706003c18c8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/71/c0430b01e98d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/71/c0430b01e98d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/73/10e65cd5308d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/73/10e65cd5308d00151ff98b6ccdcce79a -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/73/60b5ee9efb8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/73/60b5ee9efb8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/74/20f7d37bc98d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/74/20f7d37bc98d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/75/30c97f48fb8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/75/30c97f48fb8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/77/9016dcd3ed8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/77/9016dcd3ed8d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/77/90de755f928d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/77/90de755f928d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/77/c05d79ccae8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class DFA { 6 | 7 | private ArrayList states = new ArrayList(); 8 | 9 | public DFA(ArrayList states){ 10 | this.states = states; 11 | } 12 | 13 | public DFAState get(int i){ 14 | return states.get(i); 15 | } 16 | 17 | public int size(){ 18 | return states.size(); 19 | } 20 | 21 | public void printAllStates(){ 22 | int size = states.size(); 23 | for(int i = 0;i < size;i++){ 24 | System.out.println("I"+i+":"); 25 | states.get(i).print(); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/78/201a981c928d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | S->if B S;|if B S ; else S ;| = E|S ; S 2 | B->B >= B|| 3 | E->E + E|E * E|| -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7a/2073330fe78d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/7a/2073330fe78d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7a/507b4754a18d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class DFA { 6 | 7 | private ArrayList states = new ArrayList(); 8 | 9 | public DFA(ArrayList states){ 10 | this.states = states; 11 | } 12 | 13 | public DFAState get(int i){ 14 | return states.get(i); 15 | } 16 | 17 | public void printAllStates(){ 18 | int size = states.size(); 19 | for(int i = 0;i < size;i++){ 20 | System.out.println("I"+i+":"); 21 | states.get(i).print(); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7b/60b3e586f68d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/7b/60b3e586f68d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7c/309d41c5ca8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/7c/309d41c5ca8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7c/c0d20801e98d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(contains(set,state.set)&&contains(state.set,set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | private boolean contains(ArrayList set1,ArrayList set2){ 45 | for(int i = 0;i < set2.size();i++){ 46 | if(!contain(set1,set2.get(i))){ 47 | return false; 48 | } 49 | } 50 | return true; 51 | } 52 | 53 | private boolean contain(ArrayList set,LRDerivation lrd){ 54 | for(LRDerivation l:set){ 55 | if(l.equals(lrd)){ 56 | return true; 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | public ArrayList getGotoPath(){ 63 | ArrayList result = new ArrayList(); 64 | for(LRDerivation lrd:set){ 65 | if(lrd.d.list.size()==lrd.index){ 66 | continue; 67 | } 68 | String s = lrd.d.list.get(lrd.index); 69 | if(!result.contains(s)){ 70 | result.add(s); 71 | } 72 | } 73 | return result; 74 | } 75 | 76 | public ArrayList getLRDs(String s){ 77 | ArrayList result = new ArrayList(); 78 | for(LRDerivation lrd:set){ 79 | if(lrd.d.list.size() != lrd.index){ 80 | String s1 = lrd.d.list.get(lrd.index); 81 | if(s1.equals(s)){ 82 | result.add(lrd); 83 | } 84 | } 85 | } 86 | return result; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7c/e0a87f8d808e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/7c/e0a87f8d808e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7d/b04c3d56f58d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/7d/b04c3d56f58d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7f/30048205fc8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/7f/30048205fc8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7f/306c4ebaef8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equalTo(Derivation d){ 30 | if(left.hashCode()==d.left.hashCode()){ 31 | if(list.size() == d.list.size()){ 32 | int size = list.size(); 33 | for(int i = 0;i < size;i++){ 34 | if(d.list.get(i).hashCode()!=list.get(i).hashCode()){ 35 | return false; 36 | } 37 | } 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } else { 43 | return false; 44 | } 45 | } 46 | 47 | public void print(){ 48 | System.out.println(this.toString()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/7f/5009e7befe8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.HashSet; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | public class DFAState { 10 | 11 | public int id ; 12 | public ArrayList set = new ArrayList(); 13 | 14 | public DFAState(int id){ 15 | this.id = id; 16 | } 17 | 18 | public boolean addNewDerivation(LRDerivation d){ 19 | if(contains(d)){ 20 | return false; 21 | } else { 22 | set.add(d); 23 | return true; 24 | } 25 | } 26 | 27 | public void print(){ 28 | Iterator iter = set.iterator(); 29 | while(iter.hasNext()){ 30 | iter.next().print(); 31 | } 32 | } 33 | 34 | public boolean contains(LRDerivation lrd){ 35 | for(LRDerivation l:set){ 36 | if(l.equalTo(lrd)){ 37 | return true; 38 | } 39 | } 40 | return false; 41 | } 42 | 43 | public boolean equalTo(DFAState state){ 44 | if(this.toString().hashCode()==state.toString().hashCode()){ 45 | // if(contains(set,state.set)&&contains(state.set,set)){ 46 | return true; 47 | } else { 48 | return false; 49 | } 50 | } 51 | 52 | public String toString(){ 53 | String result = ""; 54 | for(int i = 0;i < set.size();i++){ 55 | result += set.get(i); 56 | if(i < set.size()-1){ 57 | result += "|"; 58 | } 59 | } 60 | return result; 61 | } 62 | 63 | // private boolean contains(ArrayList set1,ArrayList set2){ 64 | // for(int i = 0;i < set2.size();i++){ 65 | // if(!contain(set1,set2.get(i))){ 66 | // return false; 67 | // } 68 | // } 69 | // return true; 70 | // } 71 | 72 | private boolean contain(ArrayList set,LRDerivation lrd){ 73 | for(LRDerivation l:set){ 74 | if(l.equalTo(lrd)){ 75 | return true; 76 | } 77 | } 78 | return false; 79 | } 80 | 81 | public ArrayList getGotoPath(){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size()==lrd.index){ 85 | continue; 86 | } 87 | String s = lrd.d.list.get(lrd.index); 88 | if(!result.contains(s)){ 89 | result.add(s); 90 | } 91 | } 92 | return result; 93 | } 94 | 95 | public ArrayList getLRDs(String s){ 96 | ArrayList result = new ArrayList(); 97 | for(LRDerivation lrd:set){ 98 | if(lrd.d.list.size() != lrd.index){ 99 | String s1 = lrd.d.list.get(lrd.index); 100 | if(s1.equals(s)){ 101 | result.add(lrd); 102 | } 103 | } 104 | } 105 | return result; 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/81/90840a14118e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/81/90840a14118e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/82/9075eed8128e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/82/9075eed8128e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/82/e0fd73cd108e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/82/e0fd73cd108e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/84/2050cdd0128e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/84/2050cdd0128e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/84/805a8d62108e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/84/805a8d62108e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/84/90e335a9058e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/84/90e335a9058e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/84/b0867100e78d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/84/b0867100e78d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/87/4020579d0d8e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/87/4020579d0d8e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/87/c0214a41e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/87/c0214a41e68d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/88/21d7a7d7968d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class LRDerivation { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/88/306fda30ef8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equalTo(Derivation d){ 30 | if(left.equals(d.left)){ 31 | if(list.size() == d.list.size()){ 32 | int size = list.size(); 33 | for(int i = 0;i < size;i++){ 34 | if(!d.list.get(i).equals(list.get(i))){ 35 | return false; 36 | } 37 | } 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } else { 43 | return false; 44 | } 45 | } 46 | 47 | public void print(){ 48 | System.out.println(this.toString()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/8d/20d7a7d7968d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class DFA { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/8d/3065c8318d8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/8d/3065c8318d8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/8d/70884c53c08d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/8d/70884c53c08d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/8e/30991171358d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class SyntaxParser { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/8e/603b5515c18d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/8e/603b5515c18d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/9/60cc3b77008e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/9/60cc3b77008e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/9/e0253095f68d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/9/e0253095f68d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/91/f0fbc062848e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/91/f0fbc062848e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/92/80fcb088018e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/92/80fcb088018e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/92/c05580f2fc8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/92/c05580f2fc8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/94/d0bf890cfb8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/94/d0bf890cfb8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/96/003992c2e88d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/96/003992c2e88d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/96/10ed3f04958d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/96/10ed3f04958d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/99/719b63a48b8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.util.Scanner; 6 | 7 | public class CFGAnalysis { 8 | 9 | public read(String filename) throws FileNotFoundException{ 10 | File file = new File("Input/"+filename); 11 | Scanner scanner = new Scanner(file); 12 | while 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a/50a676edf88d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/a/50a676edf88d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a/70ea51f9308d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/a/70ea51f9308d00151ff98b6ccdcce79a -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a0/5191644d988d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.HashSet; 4 | 5 | public class DFAState { 6 | 7 | public int id ; 8 | public HashSet set = new HashSet(); 9 | 10 | public DFAState(int id){ 11 | this.id = id; 12 | } 13 | 14 | public boolean addNewDerivation(LRDerivation d){ 15 | if(set.contains(d)){ 16 | return false; 17 | } else { 18 | set.add(d); 19 | return true; 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a0/d0387203c18d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/a0/d0387203c18d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a1/10ebc5b2308d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/a1/10ebc5b2308d00151ff98b6ccdcce79a -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a2/0051c2c5ed8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/a2/0051c2c5ed8d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a2/70a47b950f8e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/a2/70a47b950f8e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a2/f00951a4f08d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | for(LRDerivation l:set){ 34 | if(l.equalTo(lrd)){ 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | public boolean equalTo(DFAState state){ 42 | if(contains(set,state.set)&&contains(state.set,set)){ 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | private boolean contains(ArrayList set1,ArrayList set2){ 50 | for(int i = 0;i < set2.size();i++){ 51 | if(!contain(set1,set2.get(i))){ 52 | return false; 53 | } 54 | } 55 | return true; 56 | } 57 | 58 | private boolean contain(ArrayList set,LRDerivation lrd){ 59 | for(LRDerivation l:set){ 60 | if(l.equalTo(lrd)){ 61 | return true; 62 | } 63 | } 64 | return false; 65 | } 66 | 67 | public ArrayList getGotoPath(){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size()==lrd.index){ 71 | continue; 72 | } 73 | String s = lrd.d.list.get(lrd.index); 74 | if(!result.contains(s)){ 75 | result.add(s); 76 | } 77 | } 78 | return result; 79 | } 80 | 81 | public ArrayList getLRDs(String s){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size() != lrd.index){ 85 | String s1 = lrd.d.list.get(lrd.index); 86 | if(s1.equals(s)){ 87 | result.add(lrd); 88 | } 89 | } 90 | } 91 | return result; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a3/d0838756ef8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/a3/d0838756ef8d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/a5/702d454e818e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/a5/702d454e818e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/aa/a0bb0e89fb8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/aa/a0bb0e89fb8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ab/d0724104898e00151eb8dfb136779953: -------------------------------------------------------------------------------- 1 | package lex; 2 | 3 | public class Token { 4 | public int type; 5 | public String value; 6 | public Token(int type,String value){ 7 | this.type = type; 8 | this.value = value; 9 | } 10 | 11 | public String toString(){ 12 | return "<"+this.type+","+this.value+">"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ab/f0c84238108e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/ab/f0c84238108e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ac/e090d5b0ed8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | for(LRDerivation l:set){ 34 | if(l.equals(lrd)){ 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | public boolean equals(DFAState state){ 42 | if(contains(set,state.set)&&contains(state.set,set)){ 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | private boolean contains(ArrayList set1,ArrayList set2){ 50 | for(int i = 0;i < set2.size();i++){ 51 | if(!contain(set1,set2.get(i))){ 52 | return false; 53 | } 54 | } 55 | return true; 56 | } 57 | 58 | private boolean contain(ArrayList set,LRDerivation lrd){ 59 | for(LRDerivation l:set){ 60 | if(l.equals(lrd)){ 61 | return true; 62 | } 63 | } 64 | return false; 65 | } 66 | 67 | public ArrayList getGotoPath(){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size()==lrd.index){ 71 | continue; 72 | } 73 | String s = lrd.d.list.get(lrd.index); 74 | if(!result.contains(s)){ 75 | result.add(s); 76 | } 77 | } 78 | return result; 79 | } 80 | 81 | public ArrayList getLRDs(String s){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size() != lrd.index){ 85 | String s1 = lrd.d.list.get(lrd.index); 86 | if(s1.equals(s)){ 87 | result.add(lrd); 88 | } 89 | } 90 | } 91 | return result; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ad/a0cd0193c98d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/ad/a0cd0193c98d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/b0/4044f7f37e8e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/b0/4044f7f37e8e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/b4/70de8dc3e58d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(contains(set,state.set)&&contains(state.set,set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | private boolean contains(ArrayList set1,ArrayList set2){ 45 | if(set1.contains(set2.get(0))){ 46 | System.out.println("hehehhehheh"); 47 | } 48 | return false; 49 | } 50 | 51 | public ArrayList getGotoPath(){ 52 | ArrayList result = new ArrayList(); 53 | for(LRDerivation lrd:set){ 54 | if(lrd.d.list.size()==lrd.index){ 55 | continue; 56 | } 57 | String s = lrd.d.list.get(lrd.index); 58 | if(!result.contains(s)){ 59 | result.add(s); 60 | } 61 | } 62 | return result; 63 | } 64 | 65 | public ArrayList getLRDs(String s){ 66 | ArrayList result = new ArrayList(); 67 | for(LRDerivation lrd:set){ 68 | if(lrd.d.list.size() != lrd.index){ 69 | String s1 = lrd.d.list.get(lrd.index); 70 | if(s1.equals(s)){ 71 | result.add(lrd); 72 | } 73 | } 74 | } 75 | return result; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/b5/d0c04e68ca8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/b5/d0c04e68ca8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/b6/50089d09c88d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/b6/50089d09c88d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/b6/e0f7f328e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(left.equals(d.left)){ 31 | if(list.size() == d.list.size()){ 32 | int size = list.size(); 33 | for(int i = 0;i < size;i++){ 34 | if(!d.list.get(i).equals(list.get(i))){ 35 | return false; 36 | } 37 | } 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } else { 43 | return false; 44 | } 45 | } 46 | 47 | public void print(){ 48 | System.out.println(this.toString()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/b8/5009deb4b78d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class DFA { 6 | 7 | private ArrayList states = new ArrayList(); 8 | 9 | public DFA(ArrayList states){ 10 | this.states = states; 11 | } 12 | 13 | public DFAState get(int i){ 14 | return states.get(i); 15 | } 16 | 17 | public int size(){ 18 | return states.size(); 19 | } 20 | 21 | public int contains(DFAState state){ 22 | if(states.contains(state)){ 23 | return states.indexOf(state); 24 | } else { 25 | return -1; 26 | } 27 | } 28 | 29 | public void printAllStates(){ 30 | int size = states.size(); 31 | for(int i = 0;i < size;i++){ 32 | System.out.println("I"+i+":"); 33 | states.get(i).print(); 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/b8/b0bb042ad28d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(set.equals(state.set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | public ArrayList getGotoPath(){ 45 | ArrayList result = new ArrayList(); 46 | for(LRDerivation lrd:set){ 47 | System.out.println(lrd.d.list); 48 | String s = lrd.d.list.get(lrd.index); 49 | if(!result.contains(s)){ 50 | result.add(s); 51 | } 52 | } 53 | return result; 54 | } 55 | 56 | public ArrayList getLRDs(String s){ 57 | ArrayList result = new ArrayList(); 58 | for(LRDerivation lrd:set){ 59 | String s1 = lrd.d.list.get(lrd.index); 60 | if(s1.equals(s)){ 61 | result.add(lrd); 62 | } 63 | } 64 | return result; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/b9/50d12684818e00151eb8dfb136779953: -------------------------------------------------------------------------------- 1 | S'->S 2 | S->if B S ;|if B S ; else S ;| = E|S ; S 3 | B->B >= B|| 4 | E->E + E|E * E|| -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/bc/002a69b4108e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/bc/002a69b4108e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/bc/60750053ee8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | 33 | 34 | public boolean equalTo(DFAState state){ 35 | if(contains(set,state.set)&&contains(state.set,set)){ 36 | return true; 37 | } else { 38 | return false; 39 | } 40 | } 41 | 42 | private boolean contains(ArrayList set1,ArrayList set2){ 43 | for(int i = 0;i < set2.size();i++){ 44 | if(!contain(set1,set2.get(i))){ 45 | return false; 46 | } 47 | } 48 | return true; 49 | } 50 | 51 | private boolean contain(ArrayList set,LRDerivation lrd){ 52 | for(LRDerivation l:set){ 53 | if(l.equalTo(lrd)){ 54 | return true; 55 | } 56 | } 57 | return false; 58 | } 59 | 60 | public ArrayList getGotoPath(){ 61 | ArrayList result = new ArrayList(); 62 | for(LRDerivation lrd:set){ 63 | if(lrd.d.list.size()==lrd.index){ 64 | continue; 65 | } 66 | String s = lrd.d.list.get(lrd.index); 67 | if(!result.contains(s)){ 68 | result.add(s); 69 | } 70 | } 71 | return result; 72 | } 73 | 74 | public ArrayList getLRDs(String s){ 75 | ArrayList result = new ArrayList(); 76 | for(LRDerivation lrd:set){ 77 | if(lrd.d.list.size() != lrd.index){ 78 | String s1 = lrd.d.list.get(lrd.index); 79 | if(s1.equals(s)){ 80 | result.add(lrd); 81 | } 82 | } 83 | } 84 | return result; 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/bc/e01f15d5fa8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/bc/e01f15d5fa8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/bd/b0818d45ef8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equalTo(Derivation d){ 30 | if(left.equals(d.left)){ 31 | if(list.size() == d.list.size()){ 32 | int size = list.size(); 33 | for(int i = 0;i < size;i++){ 34 | if(d.list.get(i).hashCode()!=list.get(i).hashCode()){ 35 | return false; 36 | } 37 | } 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } else { 43 | return false; 44 | } 45 | } 46 | 47 | public void print(){ 48 | System.out.println(this.toString()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c/104fdabd108e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/c/104fdabd108e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c1/408c6a7ee48d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(left.equals(d.left)){ 31 | if(list.size() == d.list.size()){ 32 | int size = list.size(); 33 | for(int i = 0;i < size;i++){ 34 | if(!d.list.get(i).equals(list.get(i))){ 35 | return false; 36 | } 37 | } 38 | System.out.println("hahahh"); 39 | return true; 40 | } else { 41 | return false; 42 | } 43 | } else { 44 | return false; 45 | } 46 | } 47 | 48 | public void print(){ 49 | System.out.println(this.toString()); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c1/c0f055c4e28d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(set.equals(state.set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | public ArrayList getGotoPath(){ 45 | ArrayList result = new ArrayList(); 46 | for(LRDerivation lrd:set){ 47 | if(lrd.d.list.size()==lrd.index){ 48 | continue; 49 | } 50 | String s = lrd.d.list.get(lrd.index); 51 | if(!result.contains(s)){ 52 | result.add(s); 53 | } 54 | } 55 | return result; 56 | } 57 | 58 | public ArrayList getLRDs(String s){ 59 | ArrayList result = new ArrayList(); 60 | for(LRDerivation lrd:set){ 61 | if(lrd.d.list.size() != lrd.index){ 62 | String s1 = lrd.d.list.get(lrd.index); 63 | if(s1.equals(s)){ 64 | result.add(lrd); 65 | } 66 | } 67 | } 68 | return result; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c2/30d423ace38d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(list.equals(d.list)&&left.equals(d.left)){ 31 | System.out.println(true); 32 | return true; 33 | } else { 34 | return false; 35 | } 36 | } 37 | 38 | public void print(){ 39 | System.out.println(this.toString()); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c3/10ef4c39968e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/c3/10ef4c39968e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c3/51981870e78d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/c3/51981870e78d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c6/308f2c13e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(contains(set,state.set)&&contains(state.set,set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | private boolean contains(ArrayList set1,ArrayList set2){ 45 | for(int i = 0;i < set2.size();i++){ 46 | if(!set1.contains(set2.get(i))){ 47 | return false; 48 | } 49 | } 50 | System.out.println("hehehehheh"); 51 | return true; 52 | } 53 | 54 | public ArrayList getGotoPath(){ 55 | ArrayList result = new ArrayList(); 56 | for(LRDerivation lrd:set){ 57 | if(lrd.d.list.size()==lrd.index){ 58 | continue; 59 | } 60 | String s = lrd.d.list.get(lrd.index); 61 | if(!result.contains(s)){ 62 | result.add(s); 63 | } 64 | } 65 | return result; 66 | } 67 | 68 | public ArrayList getLRDs(String s){ 69 | ArrayList result = new ArrayList(); 70 | for(LRDerivation lrd:set){ 71 | if(lrd.d.list.size() != lrd.index){ 72 | String s1 = lrd.d.list.get(lrd.index); 73 | if(s1.equals(s)){ 74 | result.add(lrd); 75 | } 76 | } 77 | } 78 | return result; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c7/70b322e77f8e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/c7/70b322e77f8e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c8/1036f329ff8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/c8/1036f329ff8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c8/f095861e8d8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/c8/f095861e8d8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c9/31991171358d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/c9/31991171358d00151ff98b6ccdcce79a -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/c9/f0beda7eff8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/c9/f0beda7eff8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ca/716003c18c8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class DFAState { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/cc/d07a27cf7f8e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/cc/d07a27cf7f8e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/cd/20a4288d108e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- 1 | S'->L 2 | L->E 3 | E->E + T 4 | E->T 5 | T->T * F 6 | T->F 7 | F->( E ) 8 | F->i -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/cd/b000baaee98d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | for(LRDerivation l:set){ 34 | if(l.equals(lrd)){ 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | public boolean equals(DFAState state){ 42 | if(contains(set,state.set)&&contains(state.set,set)){ 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | private boolean contains(ArrayList set1,ArrayList set2){ 50 | for(int i = 0;i < set2.size();i++){ 51 | if(!contain(set1,set2.get(i))){ 52 | return false; 53 | } 54 | } 55 | return true; 56 | } 57 | 58 | private boolean contain(ArrayList set,LRDerivation lrd){ 59 | for(LRDerivation l:set){ 60 | if(l.equals(lrd)){ 61 | return true; 62 | } 63 | } 64 | return false; 65 | } 66 | 67 | public ArrayList getGotoPath(){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size()==lrd.index){ 71 | continue; 72 | } 73 | String s = lrd.d.list.get(lrd.index); 74 | if(!result.contains(s)){ 75 | result.add(s); 76 | } 77 | } 78 | return result; 79 | } 80 | 81 | public ArrayList getLRDs(String s){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size() != lrd.index){ 85 | String s1 = lrd.d.list.get(lrd.index); 86 | if(s1.equals(s)){ 87 | result.add(lrd); 88 | } 89 | } 90 | } 91 | return result; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/cd/b0a28a27cc8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/cd/b0a28a27cc8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/cd/f01961c1128e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/cd/f01961c1128e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/cf/d053edaa928d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/cf/d053edaa928d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d/70e5fe99c98d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/d/70e5fe99c98d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d1/9072b88a808e00151eb8dfb136779953: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class Error { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d3/00d2ff0e818e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/d3/00d2ff0e818e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d3/50e3f34be58d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | System.out.println("heheda"); 38 | if(set.contains(state.set)&&state.set.contains(set)){ 39 | return true; 40 | } else { 41 | return false; 42 | } 43 | } 44 | 45 | public ArrayList getGotoPath(){ 46 | ArrayList result = new ArrayList(); 47 | for(LRDerivation lrd:set){ 48 | if(lrd.d.list.size()==lrd.index){ 49 | continue; 50 | } 51 | String s = lrd.d.list.get(lrd.index); 52 | if(!result.contains(s)){ 53 | result.add(s); 54 | } 55 | } 56 | return result; 57 | } 58 | 59 | public ArrayList getLRDs(String s){ 60 | ArrayList result = new ArrayList(); 61 | for(LRDerivation lrd:set){ 62 | if(lrd.d.list.size() != lrd.index){ 63 | String s1 = lrd.d.list.get(lrd.index); 64 | if(s1.equals(s)){ 65 | result.add(lrd); 66 | } 67 | } 68 | } 69 | return result; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d3/c0e806a4c88d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/d3/c0e806a4c88d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d4/c00f481f128e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/d4/c00f481f128e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d8/80cd4753c08d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | S'->S 2 | S->if B S ;|if B S ; else S ;| = E|S ; S 3 | B->B >= B|| 4 | E->E + E|E * E|| -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d9/30841287008e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/d9/30841287008e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d9/702df21df68d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/d9/702df21df68d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/d9/b0059077e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/d9/b0059077e68d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/dc/20d4bb07e78d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(contains(set,state.set)&&contains(state.set,set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | private boolean contains(ArrayList set1,ArrayList set2){ 45 | for(int i = 0;i < set2.size();i++){ 46 | if(!contain(set1,set2.get(i))){ 47 | return false; 48 | } 49 | } 50 | return true; 51 | } 52 | 53 | private boolean contain(ArrayList set,LRDerivation lrd){ 54 | for(LRDerivation l:set){ 55 | if(l.equals(lrd)){ 56 | return true; 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | public ArrayList getGotoPath(){ 63 | ArrayList result = new ArrayList(); 64 | for(LRDerivation lrd:set){ 65 | if(lrd.d.list.size()==lrd.index){ 66 | continue; 67 | } 68 | String s = lrd.d.list.get(lrd.index); 69 | if(!result.contains(s)){ 70 | result.add(s); 71 | } 72 | } 73 | return result; 74 | } 75 | 76 | public ArrayList getLRDs(String s){ 77 | ArrayList result = new ArrayList(); 78 | for(LRDerivation lrd:set){ 79 | if(lrd.d.list.size() != lrd.index){ 80 | String s1 = lrd.d.list.get(lrd.index); 81 | if(s1.equals(s)){ 82 | result.add(lrd); 83 | } 84 | } 85 | } 86 | return result; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/dc/5091644d988d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class LRDerivation { 4 | 5 | public Derivation d; 6 | public String lr; 7 | public int index; 8 | 9 | public LRDerivation(Derivation d,String lr,int index){ 10 | this.d = d; 11 | this.lr = lr; 12 | this.index = index; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/dc/707f16d5fa8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class DFA { 6 | 7 | public ArrayList states = new ArrayList(); 8 | 9 | public DFA(ArrayList states){ 10 | this.states = states; 11 | } 12 | 13 | public DFAState get(int i){ 14 | return states.get(i); 15 | } 16 | 17 | public int size(){ 18 | return states.size(); 19 | } 20 | 21 | public int contains(DFAState state){ 22 | if(states.contains(state)){ 23 | return states.indexOf(state); 24 | } else { 25 | return -1; 26 | } 27 | } 28 | 29 | public void printAllStates(){ 30 | int size = states.size(); 31 | for(int i = 0;i < size;i++){ 32 | System.out.println("I"+i+":"); 33 | states.get(i).print(); 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/dc/d097732a8a8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/dc/d097732a8a8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/de/2059cc67c48d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/de/2059cc67c48d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/de/c02d4604898e00151eb8dfb136779953: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/de/c02d4604898e00151eb8dfb136779953 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/df/204bef6ff78d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/df/204bef6ff78d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/df/30560ea5928d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/df/30560ea5928d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/df/31280f71358d00151ff98b6ccdcce79a: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class CFG { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/e0/f015fbd4ff8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/e0/f015fbd4ff8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/e1/4038c3a4e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(contains(set,state.set)&&contains(state.set,set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | private boolean contains(ArrayList set1,ArrayList set2){ 45 | for(int i = 0;i < set2.size();i++){ 46 | if(!set1.contains(set2.get(i))){ 47 | return false; 48 | } 49 | } 50 | return true; 51 | } 52 | 53 | public ArrayList getGotoPath(){ 54 | ArrayList result = new ArrayList(); 55 | for(LRDerivation lrd:set){ 56 | if(lrd.d.list.size()==lrd.index){ 57 | continue; 58 | } 59 | String s = lrd.d.list.get(lrd.index); 60 | if(!result.contains(s)){ 61 | result.add(s); 62 | } 63 | } 64 | return result; 65 | } 66 | 67 | public ArrayList getLRDs(String s){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size() != lrd.index){ 71 | String s1 = lrd.d.list.get(lrd.index); 72 | if(s1.equals(s)){ 73 | result.add(lrd); 74 | } 75 | } 76 | } 77 | return result; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/e1/c0058127cc8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | S'->E 2 | E->T E' 3 | E'->+ T E' 4 | T->F T' 5 | T'->* F T' 6 | F->( E )|id -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/e4/208b9a1c928d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/e4/208b9a1c928d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/e6/7003f46bbc8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/e6/7003f46bbc8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/e7/30605a93118e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/e7/30605a93118e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/e8/6080e608068e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/e8/6080e608068e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/e9/80b2b88be68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/e9/80b2b88be68d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ea/418c6a7ee48d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/ea/418c6a7ee48d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ea/c0126c03cb8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/ea/c0126c03cb8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/eb/1080ee78ed8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | for(LRDerivation l:set){ 34 | if(l.equals(lrd)){ 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | public boolean equals(DFAState state){ 42 | if(contains(set,state.set)&&contains(state.set,set)){ 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | private boolean contains(ArrayList set1,ArrayList set2){ 50 | for(int i = 0;i < set2.size();i++){ 51 | if(!contain(set1,set2.get(i))){ 52 | return false; 53 | } 54 | } 55 | return true; 56 | } 57 | 58 | private boolean contain(ArrayList set,LRDerivation lrd){ 59 | for(LRDerivation l:set){ 60 | if(l.equals(lrd)){ 61 | return true; 62 | } 63 | } 64 | return false; 65 | } 66 | 67 | public ArrayList getGotoPath(){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size()==lrd.index){ 71 | continue; 72 | } 73 | String s = lrd.d.list.get(lrd.index); 74 | if(!result.contains(s)){ 75 | result.add(s); 76 | } 77 | } 78 | return result; 79 | } 80 | 81 | public void printPath(){ 82 | for(String s:this.getGotoPath()){ 83 | System.out.print(s+" "); 84 | } 85 | System.out.println(); 86 | } 87 | 88 | public ArrayList getLRDs(String s){ 89 | ArrayList result = new ArrayList(); 90 | for(LRDerivation lrd:set){ 91 | if(lrd.d.list.size() != lrd.index){ 92 | String s1 = lrd.d.list.get(lrd.index); 93 | if(s1.equals(s)){ 94 | result.add(lrd); 95 | } 96 | } 97 | } 98 | return result; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/eb/50d02f81f08d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equalTo(Derivation d){ 30 | if(left.hashCode()==d.left.hashCode()){ 31 | if(list.size() == d.list.size()){ 32 | int size = list.size(); 33 | for(int i = 0;i < size;i++){ 34 | if(d.list.get(i).hashCode()!=list.get(i).hashCode()){ 35 | return false; 36 | } 37 | } 38 | System.out.println("aaaaaaaaaaa"); 39 | return true; 40 | } else { 41 | return false; 42 | } 43 | } else { 44 | return false; 45 | } 46 | } 47 | 48 | public void print(){ 49 | System.out.println(this.toString()); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ed/10289fd3028e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/ed/10289fd3028e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ed/6026a6248a8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | public class LRCFG { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ee/d0046b85f78d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/ee/d0046b85f78d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ef/706eacafd28d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/ef/706eacafd28d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/ef/b0913677ff8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/ef/b0913677ff8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f/f059c38a7e8e00151eb8dfb136779953: -------------------------------------------------------------------------------- 1 | S'->L 2 | L->E 3 | E->E + T 4 | E->T 5 | T->T * F 6 | T->F 7 | F->( E ) 8 | F-> -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f0/104cc0c90d8e00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/f0/104cc0c90d8e00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f0/b04d3172bc8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/f0/b04d3172bc8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f2/104988ace88d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/f2/104988ace88d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f3/1047a21ff98d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/f3/1047a21ff98d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f4/b0bccbc3e38d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(left.equals(d.left)&&contain(list,d.list)&&contain(d.list,list)){ 31 | return true; 32 | } else { 33 | return false; 34 | } 35 | } 36 | 37 | private boolean contain(ArrayList list1,ArrayList list2){ 38 | for(String e:list2){ 39 | if(!list1.contains(e)){ 40 | return false; 41 | } 42 | } 43 | return true; 44 | } 45 | 46 | public void print(){ 47 | System.out.println(this.toString()); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f5/419740f6ea8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | for(LRDerivation l:set){ 34 | if(l.equals(lrd)){ 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | public boolean equals(DFAState state){ 42 | if(contains(set,state.set)&&contains(state.set,set)){ 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | private boolean contains(ArrayList set1,ArrayList set2){ 50 | for(int i = 0;i < set2.size();i++){ 51 | if(!contain(set1,set2.get(i))){ 52 | return false; 53 | } 54 | } 55 | return true; 56 | } 57 | 58 | private boolean contain(ArrayList set,LRDerivation lrd){ 59 | for(LRDerivation l:set){ 60 | if(l.equals(lrd)){ 61 | return true; 62 | } 63 | } 64 | return false; 65 | } 66 | 67 | public ArrayList getGotoPath(){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size()==lrd.index){ 71 | continue; 72 | } 73 | String s = lrd.d.list.get(lrd.index); 74 | if(!result.contains(s)){ 75 | result.add(s); 76 | } 77 | } 78 | return result; 79 | } 80 | 81 | public ArrayList getLRDs(String s){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size() != lrd.index){ 85 | String s1 = lrd.d.list.get(lrd.index); 86 | if(s1.equals(s)){ 87 | result.add(lrd); 88 | } 89 | } 90 | } 91 | return result; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f5/50f9abffd18d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(set.contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | return set.contains(lrd); 34 | } 35 | 36 | public boolean equals(DFAState state){ 37 | if(set.equals(state.set)){ 38 | return true; 39 | } else { 40 | return false; 41 | } 42 | } 43 | 44 | public ArrayList getGotoPath(){ 45 | ArrayList result = new ArrayList(); 46 | for(LRDerivation lrd:set){ 47 | String s = lrd.d.list.get(lrd.index); 48 | if(!result.contains(s)){ 49 | result.add(s); 50 | } 51 | } 52 | return result; 53 | } 54 | 55 | public ArrayList getLRDs(String s){ 56 | ArrayList result = new ArrayList(); 57 | for(LRDerivation lrd:set){ 58 | String s1 = lrd.d.list.get(lrd.index); 59 | if(s1.equals(s)){ 60 | result.add(lrd); 61 | } 62 | } 63 | return result; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f6/e037c008ff8d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/f6/e037c008ff8d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f8/0151c2c5ed8d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | for(LRDerivation l:set){ 34 | if(l.equals(lrd)){ 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | public boolean equalTo(DFAState state){ 42 | if(contains(set,state.set)&&contains(state.set,set)){ 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | private boolean contains(ArrayList set1,ArrayList set2){ 50 | for(int i = 0;i < set2.size();i++){ 51 | if(!contain(set1,set2.get(i))){ 52 | return false; 53 | } 54 | } 55 | return true; 56 | } 57 | 58 | private boolean contain(ArrayList set,LRDerivation lrd){ 59 | for(LRDerivation l:set){ 60 | if(l.equals(lrd)){ 61 | return true; 62 | } 63 | } 64 | return false; 65 | } 66 | 67 | public ArrayList getGotoPath(){ 68 | ArrayList result = new ArrayList(); 69 | for(LRDerivation lrd:set){ 70 | if(lrd.d.list.size()==lrd.index){ 71 | continue; 72 | } 73 | String s = lrd.d.list.get(lrd.index); 74 | if(!result.contains(s)){ 75 | result.add(s); 76 | } 77 | } 78 | return result; 79 | } 80 | 81 | public ArrayList getLRDs(String s){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size() != lrd.index){ 85 | String s1 = lrd.d.list.get(lrd.index); 86 | if(s1.equals(s)){ 87 | result.add(lrd); 88 | } 89 | } 90 | } 91 | return result; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f8/2094f9e4ca8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/f8/2094f9e4ca8d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f8/50eec0a4e68d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/f8/50eec0a4e68d0015152eb56ce1e9b342 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/f8/e0763567f18d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Iterator; 6 | 7 | public class DFAState { 8 | 9 | public int id ; 10 | public ArrayList set = new ArrayList(); 11 | 12 | public DFAState(int id){ 13 | this.id = id; 14 | } 15 | 16 | public boolean addNewDerivation(LRDerivation d){ 17 | if(contains(d)){ 18 | return false; 19 | } else { 20 | set.add(d); 21 | return true; 22 | } 23 | } 24 | 25 | public void print(){ 26 | Iterator iter = set.iterator(); 27 | while(iter.hasNext()){ 28 | iter.next().print(); 29 | } 30 | } 31 | 32 | public boolean contains(LRDerivation lrd){ 33 | for(LRDerivation l:set){ 34 | if(l.equalTo(lrd)){ 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | 41 | public boolean equalTo(DFAState state){ 42 | if(this.toString().equals(state.toString())){ 43 | // if(contains(set,state.set)&&contains(state.set,set)){ 44 | return true; 45 | } else { 46 | return false; 47 | } 48 | } 49 | 50 | private boolean contains(ArrayList set1,ArrayList set2){ 51 | for(int i = 0;i < set2.size();i++){ 52 | if(!contain(set1,set2.get(i))){ 53 | return false; 54 | } 55 | } 56 | return true; 57 | } 58 | 59 | private boolean contain(ArrayList set,LRDerivation lrd){ 60 | for(LRDerivation l:set){ 61 | if(l.equalTo(lrd)){ 62 | return true; 63 | } 64 | } 65 | return false; 66 | } 67 | 68 | public ArrayList getGotoPath(){ 69 | ArrayList result = new ArrayList(); 70 | for(LRDerivation lrd:set){ 71 | if(lrd.d.list.size()==lrd.index){ 72 | continue; 73 | } 74 | String s = lrd.d.list.get(lrd.index); 75 | if(!result.contains(s)){ 76 | result.add(s); 77 | } 78 | } 79 | return result; 80 | } 81 | 82 | public ArrayList getLRDs(String s){ 83 | ArrayList result = new ArrayList(); 84 | for(LRDerivation lrd:set){ 85 | if(lrd.d.list.size() != lrd.index){ 86 | String s1 = lrd.d.list.get(lrd.index); 87 | if(s1.equals(s)){ 88 | result.add(lrd); 89 | } 90 | } 91 | } 92 | return result; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/fa/704c65b7e38d0015152eb56ce1e9b342: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equals(Derivation d){ 30 | if(left.equals(d.left)&&contain(list,d.list)&&contain(d.list,list)){ 31 | 32 | } else { 33 | return false; 34 | } 35 | } 36 | 37 | private boolean contain(ArrayList list1,ArrayList list2){ 38 | for(String e:list2){ 39 | if(!list1.contains(e)){ 40 | return false; 41 | } 42 | } 43 | return true; 44 | } 45 | 46 | public void print(){ 47 | System.out.println(this.toString()); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/fb/20f5982ac18d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/fb/20f5982ac18d00151e65b0172a36f2e7 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/fb/601932b0f78d00151110fe7eb07a71f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.history/fb/601932b0f78d00151110fe7eb07a71f2 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/fb/70ef00c18c8d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | S->if B S;|if B S; else S;|=E|S;S 2 | B->B >= B|| 3 | E->E+E|E*E|| -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.history/fe/f0777cc3a68d00151e65b0172a36f2e7: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.HashSet; 4 | import java.util.Iterator; 5 | 6 | public class DFAState { 7 | 8 | public int id ; 9 | public HashSet set = new HashSet(); 10 | 11 | public DFAState(int id){ 12 | this.id = id; 13 | } 14 | 15 | public boolean addNewDerivation(LRDerivation d){ 16 | if(set.contains(d)){ 17 | return false; 18 | } else { 19 | set.add(d); 20 | return true; 21 | } 22 | } 23 | 24 | public void print(){ 25 | Iterator iter = set.iterator(); 26 | while(iter.hasNext()){ 27 | iter.next().print(); 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/LexicalAnalyzer/.indexes/properties.index: -------------------------------------------------------------------------------- 1 | org.eclipse.team.core 2 | repository!org.eclipse.egit.core.GitProvider -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/LexicalAnalyzer/.markers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.projects/LexicalAnalyzer/.markers -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/LexicalAnalyzer/org.eclipse.egit.core/GitProjectData.properties: -------------------------------------------------------------------------------- 1 | #GitProjectData 2 | #Mon Oct 12 19:46:14 CST 2015 3 | .gitdir=../.git 4 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/LexicalAnalyzer/org.eclipse.jdt.core/state.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.projects/LexicalAnalyzer/org.eclipse.jdt.core/state.dat -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/aa/history.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/aa/history.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/e4/1f/history.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/e4/1f/history.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/e4/b9/history.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/e4/b9/history.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/e4/e1/history.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/e4/e1/history.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/e4/history.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/e4/history.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.indexes/properties.index: -------------------------------------------------------------------------------- 1 | org.eclipse.team.core 2 | repository!org.eclipse.egit.core.GitProvider -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.markers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/.markers -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/org.eclipse.egit.core/GitProjectData.properties: -------------------------------------------------------------------------------- 1 | #GitProjectData 2 | #Sat Oct 17 20:05:21 CST 2015 3 | .gitdir=../.git 4 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/org.eclipse.jdt.core/state.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.projects/SyntaxParser/org.eclipse.jdt.core/state.dat -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index: -------------------------------------------------------------------------------- 1 | /org.eclipse.core.resourcescontentCacheState2contentCacheTimestamp 1427212872608org.eclipse.jdt.corestateVersionNumber27 -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.root/14.tree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.root/14.tree -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/com.collabnet.subversion.merge.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | merge_provider_set=true 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | version=1 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=\r\n\r\n 3 | preferredTargets=default\:default| 4 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.egit.core.prefs: -------------------------------------------------------------------------------- 1 | GitRepositoriesView.GitDirectories=F\:\\15-16-1st-Course-Lab\\Compiler\\.git; 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled 3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.source=1.8 9 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.launching.PREF_VM_XML=\r\n\r\n\r\n\r\n\r\n\r\n 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | content_assist_lru_history= 2 | content_assist_number_of_computers=13 3 | content_assist_proposals_background=255,255,255 4 | content_assist_proposals_foreground=0,0,0 5 | eclipse.preferences.version=1 6 | fontPropagated=true 7 | org.eclipse.jdt.internal.ui.navigator.layout=2 8 | org.eclipse.jdt.ui.editor.tab.width= 9 | org.eclipse.jdt.ui.formatterprofiles.version=12 10 | org.eclipse.jdt.ui.javadoclocations.migrated=true 11 | org.eclipse.jdt.ui.text.code_templates_migrated=true 12 | org.eclipse.jdt.ui.text.custom_code_templates= 13 | org.eclipse.jdt.ui.text.custom_templates= 14 | org.eclipse.jdt.ui.text.templates_migrated=true 15 | org.eclipse.jface.textfont=1|Consolas|10.0|0|WINDOWS|1|0|0|0|0|0|0|0|0|1|0|0|0|0|Consolas; 16 | proposalOrderMigrated=true 17 | spelling_locale_initialized=true 18 | tabWidthPropagated=true 19 | useAnnotationsPrefPage=true 20 | useQuickDiffPrefPage=true 21 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | mylyn.attention.migrated=true 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.mylyn.monitor.activity.tracking.enabled.checked=true 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.tasks.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.mylyn.tasks.ui.filters.nonmatching=true 3 | org.eclipse.mylyn.tasks.ui.filters.nonmatching.encouraged=true 4 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.api.tools.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | knownEEFragments= 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.team.ui.first_time=false 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | overviewRuler_migration=migrated_3.1 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs: -------------------------------------------------------------------------------- 1 | PROBLEMS_FILTERS_MIGRATE=true 2 | SWITCH_PERSPECTIVE_ON_PROJECT_CREATION=always 3 | TASKS_FILTERS_MIGRATE=true 4 | eclipse.preferences.version=1 5 | platformState=1427212872608 6 | quickStart=false 7 | tipsAndTricks=true 8 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | showIntro=false 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.core.runtime/.settings/org.tigris.subversion.subclipse.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | pref_merge_provider=CollabNet Desktop 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.core/.launches/AnalyzeTable.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.core/.launches/Buffer.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.core/.launches/CFG.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.core/.launches/Derivation.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.core/.launches/LexicalAnalyzer (1).launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.core/.launches/LexicalAnalyzer.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.core/.launches/Scan.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.core/.launches/SyntaxParser.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 |
8 |
9 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.egit.ui/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/1017853417.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/1017853417.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/1045485630.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/1045485630.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/115418958.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/115418958.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/1337478678.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/1337478678.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/1425820041.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/1425820041.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/1787405673.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/1787405673.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/1790300951.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/1790300951.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/2535676096.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/2535676096.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/2674037006.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/2674037006.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/3045053200.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/3045053200.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/323251068.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/323251068.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/355369697.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/355369697.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/3604769962.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/3604769962.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/3656756579.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/3656756579.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/3716007315.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/3716007315.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/3723539909.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/3723539909.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/3954291735.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/3954291735.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/4187470955.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/4187470955.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/533208796.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/533208796.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/605290374.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/605290374.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/994834796.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/994834796.index -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache: -------------------------------------------------------------------------------- 1 | 3C:/Program Files/Java/jre1.8.0_45/lib/ext/jfxrt.jar4C:/Program Files/Java/jre1.8.0_45/lib/ext/dns_sd.jar7C:/Program Files/Java/jre1.8.0_45/lib/ext/sunmscapi.jar3C:/Program Files/Java/jre1.8.0_45/lib/resources.jar7C:/Program Files/Java/jre1.8.0_45/lib/ext/sunpkcs11.jar3C:/Program Files/Java/jre1.8.0_45/lib/ext/zipfs.jar3C:/Program Files/Java/jre1.8.0_45/lib/ext/sunec.jar>C:/Program Files/Java/jre1.8.0_45/lib/ext/access-bridge-64.jar2C:/Program Files/Java/jre1.8.0_45/lib/charsets.jar8C:/Program Files/Java/jre1.8.0_45/lib/ext/localedata.jar5C:/Program Files/Java/jre1.8.0_45/lib/ext/nashorn.jar-C:/Program Files/Java/jre1.8.0_45/lib/jfr.jar5C:/Program Files/Java/jre1.8.0_45/lib/ext/jaccess.jar-C:/Program Files/Java/jre1.8.0_45/lib/jce.jar3C:/Program Files/Java/jre1.8.0_45/lib/ext/dnsns.jar=C:/Program Files/Java/jre1.8.0_45/lib/ext/sunjce_provider.jar.C:/Program Files/Java/jre1.8.0_45/lib/jsse.jar,C:/Program Files/Java/jre1.8.0_45/lib/rt.jar6C:/Program Files/Java/jre1.8.0_45/lib/ext/cldrdata.jar -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/invalidArchivesCache: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt: -------------------------------------------------------------------------------- 1 | java -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache: -------------------------------------------------------------------------------- 1 | 3C:/Program Files/Java/jre1.8.0_45/lib/ext/jfxrt.jar4C:/Program Files/Java/jre1.8.0_45/lib/ext/dns_sd.jar7C:/Program Files/Java/jre1.8.0_45/lib/ext/sunmscapi.jar3C:/Program Files/Java/jre1.8.0_45/lib/resources.jar7C:/Program Files/Java/jre1.8.0_45/lib/ext/sunpkcs11.jar3C:/Program Files/Java/jre1.8.0_45/lib/ext/zipfs.jar3C:/Program Files/Java/jre1.8.0_45/lib/ext/sunec.jar>C:/Program Files/Java/jre1.8.0_45/lib/ext/access-bridge-64.jar2C:/Program Files/Java/jre1.8.0_45/lib/charsets.jar8C:/Program Files/Java/jre1.8.0_45/lib/ext/localedata.jar5C:/Program Files/Java/jre1.8.0_45/lib/ext/nashorn.jar-C:/Program Files/Java/jre1.8.0_45/lib/jfr.jar5C:/Program Files/Java/jre1.8.0_45/lib/ext/jaccess.jar-C:/Program Files/Java/jre1.8.0_45/lib/jce.jar3C:/Program Files/Java/jre1.8.0_45/lib/ext/dnsns.jar=C:/Program Files/Java/jre1.8.0_45/lib/ext/sunjce_provider.jar.C:/Program Files/Java/jre1.8.0_45/lib/jsse.jar,C:/Program Files/Java/jre1.8.0_45/lib/rt.jar6C:/Program Files/Java/jre1.8.0_45/lib/ext/cldrdata.jar -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt: -------------------------------------------------------------------------------- 1 | INDEX VERSION 1.127+F:\15-16-1st-Course-Lab\MiniC-Compiler\.metadata\.plugins\org.eclipse.jdt.core 2 | 2535676096.index 3 | 3604769962.index 4 | 3045053200.index 5 | 533208796.index 6 | 1017853417.index 7 | 3716007315.index 8 | 3954291735.index 9 | 355369697.index 10 | 2674037006.index 11 | 323251068.index 12 | 1337478678.index 13 | 605290374.index 14 | 3656756579.index 15 | 1045485630.index 16 | 1787405673.index 17 | 115418958.index 18 | 1425820041.index 19 | 3723539909.index 20 | 4187470955.index 21 | 1790300951.index 22 | 994834796.index 23 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.launching/.install.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/LexicalAnalyzer/2015/10/43/refactorings.index: -------------------------------------------------------------------------------- 1 | 1445427064562 Rename resource 'source1.txt' 2 | 1445427310966 Delete element 3 | 1445432483973 Copy compilation unit 4 | 1445432488981 Copy compilation unit 5 | 1445432494388 Delete element 6 | 1445432503466 Delete element 7 | 1445433296399 Delete element 8 | 1445433318509 Delete element 9 | 1445671024006 Delete element 10 | 1445671027181 Delete element 11 | 1445671030081 Delete element 12 | 1445671033613 Delete element 13 | 1445671070506 Delete element 14 | 1445671116381 Delete element 15 | 1445671119813 Delete element 16 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/LexicalAnalyzer/2015/10/44/refactorings.index: -------------------------------------------------------------------------------- 1 | 1445839739950 Delete element 2 | 1445839742231 Delete element 3 | 1445839745512 Delete element 4 | 1445840228533 Rename compilation unit 'Scanner.java' 5 | 1445846364792 Delete element 6 | 1445846446652 Move compilation unit 7 | 1445846454324 Delete element 8 | 1445852678111 Delete element 9 | 1445852680751 Delete element 10 | 1445852684220 Delete element 11 | 1445853583527 Delete element 12 | 1445854125583 Delete element 13 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/LexicalAnalyzer/2015/11/47/refactorings.history: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/LexicalAnalyzer/2015/11/47/refactorings.index: -------------------------------------------------------------------------------- 1 | 1447765716669 Copy package 2 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/SyntaxParser/2015/11/47/refactorings.index: -------------------------------------------------------------------------------- 1 | 1447765693981 Delete element 2 | 1447765702715 Delete element 3 | 1447767784989 Delete element 4 | 1447767797286 Delete element 5 | 1447767833334 Delete element 6 | 1447806016595 Delete element 7 | 1447806660310 Delete element 8 | 1447911843913 Delete element 9 | 1447912459290 Delete element 10 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 |
7 |
8 | 9 | 10 |
11 |
12 | 13 | 14 | 15 |
16 |
17 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties: -------------------------------------------------------------------------------- 1 | #Cached timestamps 2 | #Thu Nov 19 16:34:27 CST 2015 3 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ui.editors/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 |
9 |
10 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ui.workbench.texteditor/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.metadata/.plugins/org.tigris.subversion.subclipse.ui/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /.metadata/version.ini: -------------------------------------------------------------------------------- 1 | org.eclipse.core.runtime=1 -------------------------------------------------------------------------------- /LexicalAnalyzer/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /LexicalAnalyzer/.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | -------------------------------------------------------------------------------- /LexicalAnalyzer/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | LexicalAnalyzer 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /LexicalAnalyzer/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /LexicalAnalyzer/Input/source1.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | printf("hello world"); 4 | return 0; 5 | } -------------------------------------------------------------------------------- /LexicalAnalyzer/Output/result.c: -------------------------------------------------------------------------------- 1 | <58,#> 2 | <66,include> 3 | <36,<> 4 | <59,stdio.h> 5 | <38,>> 6 | <2,int> 7 | <59,main> 8 | <56,(> 9 | <57,)> 10 | <52,{> 11 | <59,printf> 12 | <56,(> 13 | <68,"> 14 | <59,hello world> 15 | <68,"> 16 | <57,)> 17 | <51,;> 18 | <13,return> 19 | <60,0> 20 | <51,;> 21 | <53,}> 22 | -------------------------------------------------------------------------------- /LexicalAnalyzer/Report/实验报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/LexicalAnalyzer/Report/实验报告.docx -------------------------------------------------------------------------------- /LexicalAnalyzer/src/lex/LexicalAnalyzer.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/LexicalAnalyzer/src/lex/LexicalAnalyzer.java -------------------------------------------------------------------------------- /LexicalAnalyzer/src/lex/Scan.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/LexicalAnalyzer/src/lex/Scan.java -------------------------------------------------------------------------------- /LexicalAnalyzer/src/lex/Token.java: -------------------------------------------------------------------------------- 1 | package lex; 2 | 3 | public class Token { 4 | public int type; 5 | public String value; 6 | public Token(int type,String value){ 7 | this.type = type; 8 | this.value = value; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /LexicalAnalyzer/src/lex/Type.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/LexicalAnalyzer/src/lex/Type.java -------------------------------------------------------------------------------- /LexicalAnalyzer/src/test/Main.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | public class Main { 4 | public static void main(String[] args){ 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /MiniC-Compiler.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/MiniC-Compiler.zip -------------------------------------------------------------------------------- /SyntaxParser/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SyntaxParser/.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | -------------------------------------------------------------------------------- /SyntaxParser/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SyntaxParser 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /SyntaxParser/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /SyntaxParser/Input/cfg.txt: -------------------------------------------------------------------------------- 1 | S'->S 2 | S->if ( B ) S ;|if ( B ) S ; else S ;| = E|S ; S 3 | B->B >= B|| 4 | E->E + E|E * E|| -------------------------------------------------------------------------------- /SyntaxParser/Input/source.c: -------------------------------------------------------------------------------- 1 | x=y+2; 2 | if (x>=) z=1; 3 | else z=0; 4 | -------------------------------------------------------------------------------- /SyntaxParser/Output/result.c: -------------------------------------------------------------------------------- 1 | <59,x> 2 | <32,=> 3 | <59,y> 4 | <33,+> 5 | <60,2> 6 | <51,;> 7 | <29,if> 8 | <56,(> 9 | <59,x> 10 | <39,>=> 11 | <60,0> 12 | <57,)> 13 | <59,z> 14 | <32,=> 15 | <60,1> 16 | <51,;> 17 | <5,else> 18 | <59,z> 19 | <32,=> 20 | <60,0> 21 | <51,;> 22 | -------------------------------------------------------------------------------- /SyntaxParser/src/lex/LexicalAnalyzer.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/SyntaxParser/src/lex/LexicalAnalyzer.java -------------------------------------------------------------------------------- /SyntaxParser/src/lex/Scan.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/SyntaxParser/src/lex/Scan.java -------------------------------------------------------------------------------- /SyntaxParser/src/lex/Token.java: -------------------------------------------------------------------------------- 1 | package lex; 2 | 3 | public class Token { 4 | public int type; 5 | public String value; 6 | public Token(int type,String value){ 7 | this.type = type; 8 | this.value = value; 9 | } 10 | public String toString(){ 11 | return "<"+this.type+","+this.value+">"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SyntaxParser/src/lex/Type.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/SyntaxParser/src/lex/Type.java -------------------------------------------------------------------------------- /SyntaxParser/src/main/Test.java: -------------------------------------------------------------------------------- 1 | package main; 2 | 3 | public class Test { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /SyntaxParser/src/parser/AnalyzeTable.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/SyntaxParser/src/parser/AnalyzeTable.java -------------------------------------------------------------------------------- /SyntaxParser/src/parser/CFG.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/SyntaxParser/src/parser/CFG.java -------------------------------------------------------------------------------- /SyntaxParser/src/parser/DFA.java: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class DFA { 6 | 7 | public ArrayList states = new ArrayList(); 8 | 9 | public DFAState get(int i){ 10 | return states.get(i); 11 | } 12 | 13 | public int size(){ 14 | return states.size(); 15 | } 16 | 17 | public int contains(DFAState state){ 18 | for(int i = 0;i set = new ArrayList(); 13 | 14 | public DFAState(int id){ 15 | this.id = id; 16 | } 17 | 18 | public boolean addNewDerivation(LRDerivation d){ 19 | if(contains(d)){ 20 | return false; 21 | } else { 22 | set.add(d); 23 | return true; 24 | } 25 | } 26 | 27 | public void print(){ 28 | Iterator iter = set.iterator(); 29 | while(iter.hasNext()){ 30 | iter.next().print(); 31 | } 32 | } 33 | 34 | public boolean contains(LRDerivation lrd){ 35 | for(LRDerivation l:set){ 36 | if(l.equalTo(lrd)){ 37 | return true; 38 | } 39 | } 40 | return false; 41 | } 42 | 43 | public boolean equalTo(DFAState state){ 44 | if(this.toString().hashCode()==state.toString().hashCode()){ 45 | // if(contains(set,state.set)&&contains(state.set,set)){ 46 | return true; 47 | } else { 48 | return false; 49 | } 50 | } 51 | 52 | public String toString(){ 53 | String result = ""; 54 | for(int i = 0;i < set.size();i++){ 55 | result += set.get(i); 56 | if(i < set.size()-1){ 57 | result += "|"; 58 | } 59 | } 60 | return result; 61 | } 62 | 63 | // private boolean contains(ArrayList set1,ArrayList set2){ 64 | // for(int i = 0;i < set2.size();i++){ 65 | // if(!contain(set1,set2.get(i))){ 66 | // return false; 67 | // } 68 | // } 69 | // return true; 70 | // } 71 | 72 | private boolean contain(ArrayList set,LRDerivation lrd){ 73 | for(LRDerivation l:set){ 74 | if(l.equalTo(lrd)){ 75 | return true; 76 | } 77 | } 78 | return false; 79 | } 80 | 81 | public ArrayList getGotoPath(){ 82 | ArrayList result = new ArrayList(); 83 | for(LRDerivation lrd:set){ 84 | if(lrd.d.list.size()==lrd.index){ 85 | continue; 86 | } 87 | String s = lrd.d.list.get(lrd.index); 88 | if(!result.contains(s)){ 89 | result.add(s); 90 | } 91 | } 92 | return result; 93 | } 94 | 95 | public ArrayList getLRDs(String s){ 96 | ArrayList result = new ArrayList(); 97 | for(LRDerivation lrd:set){ 98 | if(lrd.d.list.size() != lrd.index){ 99 | String s1 = lrd.d.list.get(lrd.index); 100 | if(s1.equals(s)){ 101 | result.add((LRDerivation)lrd.clone()); 102 | } 103 | } 104 | } 105 | return result; 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /SyntaxParser/src/parser/Derivation.java: -------------------------------------------------------------------------------- 1 | package parser; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | 6 | public class Derivation { 7 | 8 | public String left; 9 | public ArrayList list = new ArrayList(); 10 | 11 | public Derivation(String s){ 12 | String[] div = s.split("->"); 13 | this.left = div[0]; 14 | String[] v = div[1].split(" "); 15 | for(int i = 0;i < v.length;i++){ 16 | list.add(v[i]); 17 | } 18 | } 19 | 20 | public String toString(){ 21 | String result = left+"->"; 22 | for(String r:list){ 23 | result += r; 24 | result += " "; 25 | } 26 | return result.trim(); 27 | } 28 | 29 | public boolean equalTo(Derivation d){ 30 | if(this.toString().equals(d.toString())){ 31 | return true; 32 | } else { 33 | return false; 34 | } 35 | // if(left.hashCode()==d.left.hashCode()){ 36 | // if(list.size() == d.list.size()){ 37 | // int size = list.size(); 38 | // for(int i = 0;i < size;i++){ 39 | // if(d.list.get(i).hashCode()!=list.get(i).hashCode()){ 40 | // return false; 41 | // } 42 | // } 43 | // return true; 44 | // } else { 45 | // return false; 46 | // } 47 | // } else { 48 | // return false; 49 | // } 50 | } 51 | 52 | public void print(){ 53 | System.out.println(this.toString()); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /SyntaxParser/src/parser/LRDerivation.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/SyntaxParser/src/parser/LRDerivation.java -------------------------------------------------------------------------------- /SyntaxParser/src/parser/SyntaxParser.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/SyntaxParser/src/parser/SyntaxParser.java -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/readme.txt -------------------------------------------------------------------------------- /《编译原理》实验报告——词法分析.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/《编译原理》实验报告——词法分析.docx -------------------------------------------------------------------------------- /《编译原理》实验报告——词法分析.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/《编译原理》实验报告——词法分析.pdf -------------------------------------------------------------------------------- /《编译原理》实验报告——语法分析.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/《编译原理》实验报告——语法分析.docx -------------------------------------------------------------------------------- /《编译原理》实验报告——语法分析.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingchen1984/MiniC-Compiler/5544fd3c9ca63b195bb980e35b998a59128784c6/《编译原理》实验报告——语法分析.pdf --------------------------------------------------------------------------------