From c8c8d47ff08603e6078004e855fe7e3e35b621d3 Mon Sep 17 00:00:00 2001 From: Pierre Hong Date: Wed, 3 Jan 2024 11:44:59 +0800 Subject: [PATCH] ADD: support underscore in name --- assembler/test_data/asm/hash_asm.json | 2 +- interpreter/src/lexer/mod.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/assembler/test_data/asm/hash_asm.json b/assembler/test_data/asm/hash_asm.json index 0cbb1b37..dd06bd6a 100644 --- a/assembler/test_data/asm/hash_asm.json +++ b/assembler/test_data/asm/hash_asm.json @@ -1,5 +1,5 @@ { - "program": "heap_malloc:\n.LBL17_0:\n mov r3 18446744060824649731\n mload r0 [r3]\n add r2 r0 r1\n mov r1 18446744060824649731\n mstore [r1] r2\n ret\nvector_new:\n.LBL18_0:\n mov r4 18446744060824649731\n mload r0 [r4]\n add r2 r1 1\n add r3 r0 r2\n mov r2 18446744060824649731\n mstore [r2] r3\n mstore [r0] r1\n ret\nsplit_field:\n.LBL19_0:\n mov r6 r1\n mov r1 r6\n.PROPHET19_0:\n mov r0 psp\n mload r0 [r0]\n mov r7 r0\n range r7\n mov r1 r6\n.PROPHET19_1:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n range r1\n mul r4 r7 4294967296\n add r5 r4 r1\n eq r4 r6 r5\n assert r4\n mstore [r2] r7\n mstore [r3] r1\n ret\nmemcpy:\n.LBL20_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL20_1\n.LBL20_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL20_2\n jmp .LBL20_3\n.LBL20_2:\n mload r6 [r1,r4]\n mstore [r2,r4] r6\n add r5 r4 1\n mstore [r9,-1] r5\n jmp .LBL20_1\n.LBL20_3:\n add r9 r9 -1\n ret\nmemcmp_eq:\n.LBL21_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL21_1\n.LBL21_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL21_2\n mov r0 1\n jmp .LBL21_3\n.LBL21_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n eq r4 r6 r7\n cjmp r4 .LBL21_1\n mov r0 0\n jmp .LBL21_3\n.LBL21_3:\n add r9 r9 -1\n ret\nmemcmp_ne:\n.LBL22_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL22_1\n.LBL22_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL22_2\n mov r0 1\n jmp .LBL22_3\n.LBL22_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n eq r4 r6 r7\n cjmp r4 .LBL22_3\n mov r0 0\n jmp .LBL22_1\n.LBL22_3:\n add r9 r9 -1\n ret\nmemcmp_ugt:\n.LBL23_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL23_1\n.LBL23_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL23_2\n mov r0 1\n jmp .LBL23_3\n.LBL23_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n gte r4 r7 r6\n cjmp r4 .LBL23_3\n mov r0 0\n jmp .LBL23_1\n.LBL23_3:\n add r9 r9 -1\n ret\nmemcmp_uge:\n.LBL24_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL24_1\n.LBL24_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL24_2\n mov r0 1\n jmp .LBL24_3\n.LBL24_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n gte r4 r6 r7\n cjmp r4 .LBL24_1\n mov r0 0\n jmp .LBL24_3\n.LBL24_3:\n add r9 r9 -1\n ret\nmemcmp_ult:\n.LBL25_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL25_1\n.LBL25_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL25_2\n mov r0 1\n jmp .LBL25_3\n.LBL25_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n gte r4 r6 r7\n cjmp r4 .LBL25_3\n mov r0 0\n jmp .LBL25_1\n.LBL25_3:\n add r9 r9 -1\n ret\nmemcmp_ule:\n.LBL26_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL26_1\n.LBL26_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL26_2\n mov r0 1\n jmp .LBL26_3\n.LBL26_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n gte r4 r7 r6\n cjmp r4 .LBL26_1\n mov r0 0\n jmp .LBL26_3\n.LBL26_3:\n add r9 r9 -1\n ret\nfield_memcmp_ugt:\n.LBL27_0:\n add r9 r9 14\n mstore [r9,-2] r9\n mov r6 0\n mstore [r9,-7] r6\n jmp .LBL27_1\n.LBL27_1:\n mload r6 [r9,-7]\n mstore [r9,-11] r6\n mload r6 [r9,-11]\n gte r6 r3 r6\n mload r7 [r9,-11]\n neq r3 r7 r3\n and r6 r6 r3\n cjmp r6 .LBL27_2\n mov r0 1\n jmp .LBL27_4\n.LBL27_2:\n mload r3 [r9,-11]\n mload r1 [r1,r3]\n mload r3 [r9,-11]\n mload r2 [r2,r3]\n mstore [r9,-8] r2\n mov r3 r4\n mov r2 r5\n call split_field\n mload r3 [r9,-12]\n mload r2 [r9,-10]\n mload r1 [r9,-8]\n call split_field\n mload r1 [r9,-6]\n mload r2 [r9,-4]\n mload r3 [r9,-5]\n mload r4 [r9,-3]\n mload r5 [r9,-11]\n add r5 r5 1\n mstore [r9,-9] r5\n mload r5 [r9,-9]\n mstore [r9,-7] r5\n gte r1 r2 r1\n cjmp r1 .LBL27_4\n mov r0 0\n jmp .LBL27_3\n.LBL27_3:\n gte r1 r4 r3\n cjmp r1 .LBL27_4\n mov r0 0\n jmp .LBL27_3\n.LBL27_4:\n add r9 r9 -14\n ret\nfield_memcmp_uge:\n.LBL28_0:\n add r9 r9 26\n mstore [r9,-2] r9\n mstore [r9,-8] r1\n mov r1 r2\n mstore [r9,-15] r1\n mov r1 r3\n mstore [r9,-10] r1\n mov r1 0\n mstore [r9,-7] r1\n jmp .LBL28_1\n.LBL28_1:\n mload r1 [r9,-7]\n mstore [r9,-14] r1\n mload r1 [r9,-10]\n mload r2 [r9,-14]\n gte r1 r1 r2\n mload r2 [r9,-10]\n mload r3 [r9,-14]\n neq r2 r3 r2\n and r1 r1 r2\n cjmp r1 .LBL28_2\n mov r0 1\n jmp .LBL28_4\n.LBL28_2:\n mload r1 [r9,-8]\n mload r2 [r9,-14]\n mload r1 [r1,r2]\n mload r2 [r9,-14]\n mload r3 [r9,-15]\n mload r2 [r3,r2]\n mstore [r9,-9] r2\n mload r3 [r9,-17]\n mload r2 [r9,-13]\n call split_field\n mload r3 [r9,-16]\n mload r2 [r9,-12]\n mload r1 [r9,-9]\n call split_field\n mload r1 [r9,-6]\n mload r2 [r9,-4]\n mload r3 [r9,-5]\n mload r4 [r9,-3]\n mload r5 [r9,-14]\n add r5 r5 1\n mstore [r9,-11] r5\n mload r5 [r9,-11]\n mstore [r9,-7] r5\n gte r1 r1 r2\n cjmp r1 .LBL28_3\n mov r0 0\n jmp .LBL28_4\n.LBL28_3:\n gte r1 r3 r4\n cjmp r1 .LBL28_1\n mov r0 0\n jmp .LBL28_4\n.LBL28_4:\n add r9 r9 -26\n ret\nfield_memcmp_ule:\n.LBL29_0:\n add r9 r9 14\n mstore [r9,-2] r9\n mov r6 0\n mstore [r9,-7] r6\n jmp .LBL29_1\n.LBL29_1:\n mload r6 [r9,-7]\n mstore [r9,-11] r6\n mload r6 [r9,-11]\n gte r6 r3 r6\n mload r7 [r9,-11]\n neq r3 r7 r3\n and r6 r6 r3\n cjmp r6 .LBL29_2\n mov r0 1\n jmp .LBL29_4\n.LBL29_2:\n mload r3 [r9,-11]\n mload r1 [r1,r3]\n mload r3 [r9,-11]\n mload r2 [r2,r3]\n mstore [r9,-8] r2\n mov r3 r4\n mov r2 r5\n call split_field\n mload r3 [r9,-12]\n mload r2 [r9,-10]\n mload r1 [r9,-8]\n call split_field\n mload r1 [r9,-6]\n mload r2 [r9,-4]\n mload r3 [r9,-5]\n mload r4 [r9,-3]\n mload r5 [r9,-11]\n add r5 r5 1\n mstore [r9,-9] r5\n mload r5 [r9,-9]\n mstore [r9,-7] r5\n gte r1 r2 r1\n cjmp r1 .LBL29_3\n mov r0 0\n jmp .LBL29_4\n.LBL29_3:\n gte r1 r4 r3\n cjmp r1 .LBL29_3\n mov r0 0\n jmp .LBL29_4\n.LBL29_4:\n add r9 r9 -14\n ret\nfield_memcmp_ult:\n.LBL30_0:\n add r9 r9 14\n mstore [r9,-2] r9\n mov r6 0\n mstore [r9,-7] r6\n jmp .LBL30_1\n.LBL30_1:\n mload r6 [r9,-7]\n mstore [r9,-11] r6\n mload r6 [r9,-11]\n gte r6 r3 r6\n mload r7 [r9,-11]\n neq r3 r7 r3\n and r6 r6 r3\n cjmp r6 .LBL30_2\n mov r0 1\n jmp .LBL30_4\n.LBL30_2:\n mload r3 [r9,-11]\n mload r1 [r1,r3]\n mload r3 [r9,-11]\n mload r2 [r2,r3]\n mstore [r9,-8] r2\n mov r3 r4\n mov r2 r5\n call split_field\n mload r3 [r9,-12]\n mload r2 [r9,-10]\n mload r1 [r9,-8]\n call split_field\n mload r1 [r9,-6]\n mload r2 [r9,-4]\n mload r3 [r9,-5]\n mload r4 [r9,-3]\n mload r5 [r9,-11]\n add r5 r5 1\n mstore [r9,-9] r5\n mload r5 [r9,-9]\n mstore [r9,-7] r5\n gte r1 r1 r2\n cjmp r1 .LBL30_4\n mov r0 0\n jmp .LBL30_3\n.LBL30_3:\n gte r1 r3 r4\n cjmp r1 .LBL30_4\n mov r0 0\n jmp .LBL30_3\n.LBL30_4:\n add r9 r9 -14\n ret\nu32_div_mod:\n.LBL31_0:\n add r9 r9 5\n mstore [r9,-3] r1\n mov r1 r2\n mstore [r9,-4] r1\n mload r1 [r9,-4]\n mov r2 r1\n mload r1 [r9,-3]\n.PROPHET31_0:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n mstore [r9,-5] r1\n mload r1 [r9,-5]\n range r1\n mload r1 [r9,-5]\n add r5 r1 1\n not r7 r5\n add r7 r7 1\n mload r1 [r9,-4]\n add r6 r1 r7\n range r6\n mload r1 [r9,-4]\n mov r2 r1\n mload r1 [r9,-3]\n.PROPHET31_1:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n range r3\n mload r2 [r9,-4]\n mul r2 r1 r2\n mstore [r9,-1] r2\n mload r2 [r9,-1]\n mload r5 [r9,-5]\n add r2 r2 r5\n mstore [r9,-2] r2\n mload r2 [r9,-2]\n mload r5 [r9,-3]\n eq r2 r2 r5\n assert r2\n mstore [r3] r1\n mload r1 [r9,-5]\n mstore [r4] r1\n add r9 r9 -5\n ret\nu32_power:\n.LBL32_0:\n mov r0 1\n mov r3 0\n jmp .LBL32_1\n.LBL32_1:\n add r5 r3 1\n mul r4 r0 r1\n gte r3 r2 r5\n cjmp r3 .LBL32_1\n mov r0 r4\n mov r3 r5\n jmp .LBL32_2\n.LBL32_2:\n range r0\n ret\nhash_compare:\n.LBL33_0:\n add r9 r9 9\n mstore [r9,-2] r9\n mov r1 10\n call vector_new\n mov r5 r0\n mstore [r9,-6] r5\n mload r5 [r9,-6]\n add r5 r5 1\n mov r6 104\n mstore [r5] r6\n mov r6 101\n mstore [r5,+1] r6\n mov r6 108\n mstore [r5,+2] r6\n mov r6 108\n mstore [r5,+3] r6\n mov r6 111\n mstore [r5,+4] r6\n mov r6 119\n mstore [r5,+5] r6\n mov r6 111\n mstore [r5,+6] r6\n mov r6 114\n mstore [r5,+7] r6\n mov r6 108\n mstore [r5,+8] r6\n mov r6 100\n mstore [r5,+9] r6\n mload r5 [r9,-6]\n mload r5 [r5]\n mstore [r9,-7] r5\n mov r1 4\n call heap_malloc\n mov r5 r0\n mload r6 [r9,-6]\n add r6 r6 1\n mload r7 [r9,-7]\n poseidon r5 r6 r7\n mstore [r9,-5] r5\n mload r5 [r9,-6]\n mload r5 [r5]\n mstore [r9,-9] r5\n mov r1 4\n call heap_malloc\n mov r5 r0\n mload r6 [r9,-6]\n add r6 r6 1\n mload r7 [r9,-9]\n poseidon r5 r6 r7\n mstore [r9,-4] r5\n mov r1 4\n call heap_malloc\n mov r5 r0\n mov r6 1006966343754\n mstore [r5] r6\n mov r6 107395124437206779\n mstore [r5,+1] r6\n mov r6 10878087049651741602\n mstore [r5,+2] r6\n mov r6 1885151562297713155\n mstore [r5,+3] r6\n mstore [r9,-3] r5\n mload r1 [r9,-5]\n mload r2 [r9,-4]\n mov r3 4\n call memcmp_eq\n mov r5 r0\n assert r5\n mload r1 [r9,-5]\n mload r2 [r9,-3]\n mov r3 4\n call memcmp_ne\n mov r5 r0\n assert r5\n mload r1 [r9,-5]\n mload r2 [r9,-3]\n mov r3 4\n call field_memcmp_uge\n mov r5 r0\n assert r5\n mload r1 [r9,-5]\n mload r2 [r9,-4]\n mov r3 4\n call field_memcmp_ule\n mov r5 r0\n assert r5\n mload r1 [r9,-5]\n mload r2 [r9,-3]\n mov r3 4\n call field_memcmp_ugt\n mov r5 r0\n assert r5\n mload r1 [r9,-5]\n mload r2 [r9,-3]\n mov r3 4\n call field_memcmp_uge\n mov r5 r0\n assert r5\n mload r1 [r9,-3]\n mload r2 [r9,-5]\n mov r3 4\n call field_memcmp_ult\n mov r5 r0\n assert r5\n mload r1 [r9,-3]\n mload r2 [r9,-5]\n mov r3 4\n call field_memcmp_ule\n mov r5 r0\n assert r5\n add r9 r9 -9\n ret\nfunction_dispatch:\n.LBL34_0:\n add r9 r9 2\n mstore [r9,-2] r9\n mov r2 r3\n eq r8 r1 2051797338\n cjmp r8 .LBL34_2\n jmp .LBL34_1\n.LBL34_1:\n ret\n.LBL34_2:\n call hash_compare\n mov r1 1\n call heap_malloc\n mov r1 r0\n mov r2 0\n mstore [r1] r2\n tstore r1 1\n add r9 r9 -2\n ret\nmain:\n.LBL35_0:\n add r9 r9 8\n mstore [r9,-2] r9\n mov r1 13\n call heap_malloc\n mov r5 r0\n mov r6 1\n tload r5 r6 13\n mload r5 [r5]\n mstore [r9,-4] r5\n mov r1 14\n call heap_malloc\n mov r5 r0\n mov r6 1\n tload r5 r6 14\n mload r5 [r5]\n mstore [r9,-6] r5\n mload r5 [r9,-6]\n add r5 r5 14\n mstore [r9,-3] r5\n mload r1 [r9,-3]\n call heap_malloc\n mov r3 r0\n mov r5 1\n mload r6 [r9,-3]\n tload r3 r5 r6\n mload r2 [r9,-6]\n mload r1 [r9,-4]\n call function_dispatch\n add r9 r9 -8\n end\n", + "program": "heap_malloc:\n.LBL17_0:\n mov r3 18446744060824649731\n mload r0 [r3]\n add r2 r0 r1\n mov r1 18446744060824649731\n mstore [r1] r2\n ret\nvector_new:\n.LBL18_0:\n mov r4 18446744060824649731\n mload r0 [r4]\n add r2 r1 1\n add r3 r0 r2\n mov r2 18446744060824649731\n mstore [r2] r3\n mstore [r0] r1\n ret\nsplit_field:\n.LBL19_0:\n mov r6 r1\n mov r1 r6\n.PROPHET19_0:\n mov r0 psp\n mload r0 [r0]\n mov r7 r0\n range r7\n mov r1 r6\n.PROPHET19_1:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n range r1\n mul r4 r7 4294967296\n add r5 r4 r1\n eq r4 r6 r5\n assert r4\n mstore [r2] r7\n mstore [r3] r1\n ret\nmemcpy:\n.LBL20_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL20_1\n.LBL20_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL20_2\n jmp .LBL20_3\n.LBL20_2:\n mload r6 [r1,r4]\n mstore [r2,r4] r6\n add r5 r4 1\n mstore [r9,-1] r5\n jmp .LBL20_1\n.LBL20_3:\n add r9 r9 -1\n ret\nmemcmp_eq:\n.LBL21_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL21_1\n.LBL21_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL21_2\n mov r0 1\n jmp .LBL21_3\n.LBL21_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n eq r4 r6 r7\n cjmp r4 .LBL21_1\n mov r0 0\n jmp .LBL21_3\n.LBL21_3:\n add r9 r9 -1\n ret\nmemcmp_ne:\n.LBL22_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL22_1\n.LBL22_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL22_2\n mov r0 1\n jmp .LBL22_3\n.LBL22_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n eq r4 r6 r7\n cjmp r4 .LBL22_3\n mov r0 0\n jmp .LBL22_1\n.LBL22_3:\n add r9 r9 -1\n ret\nmemcmp_ugt:\n.LBL23_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL23_1\n.LBL23_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL23_2\n mov r0 1\n jmp .LBL23_3\n.LBL23_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n gte r4 r7 r6\n cjmp r4 .LBL23_3\n mov r0 0\n jmp .LBL23_1\n.LBL23_3:\n add r9 r9 -1\n ret\nmemcmp_uge:\n.LBL24_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL24_1\n.LBL24_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL24_2\n mov r0 1\n jmp .LBL24_3\n.LBL24_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n gte r4 r6 r7\n cjmp r4 .LBL24_1\n mov r0 0\n jmp .LBL24_3\n.LBL24_3:\n add r9 r9 -1\n ret\nmemcmp_ult:\n.LBL25_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL25_1\n.LBL25_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL25_2\n mov r0 1\n jmp .LBL25_3\n.LBL25_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n gte r4 r6 r7\n cjmp r4 .LBL25_3\n mov r0 0\n jmp .LBL25_1\n.LBL25_3:\n add r9 r9 -1\n ret\nmemcmp_ule:\n.LBL26_0:\n add r9 r9 1\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL26_1\n.LBL26_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL26_2\n mov r0 1\n jmp .LBL26_3\n.LBL26_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n add r5 r4 1\n mstore [r9,-1] r5\n gte r4 r7 r6\n cjmp r4 .LBL26_1\n mov r0 0\n jmp .LBL26_3\n.LBL26_3:\n add r9 r9 -1\n ret\nfield_memcmp_ugt:\n.LBL27_0:\n add r9 r9 14\n mstore [r9,-2] r9\n mov r6 0\n mstore [r9,-7] r6\n jmp .LBL27_1\n.LBL27_1:\n mload r6 [r9,-7]\n mstore [r9,-11] r6\n mload r6 [r9,-11]\n gte r6 r3 r6\n mload r7 [r9,-11]\n neq r3 r7 r3\n and r6 r6 r3\n cjmp r6 .LBL27_2\n mov r0 1\n jmp .LBL27_4\n.LBL27_2:\n mload r3 [r9,-11]\n mload r1 [r1,r3]\n mload r3 [r9,-11]\n mload r2 [r2,r3]\n mstore [r9,-8] r2\n mov r3 r4\n mov r2 r5\n call split_field\n mload r3 [r9,-12]\n mload r2 [r9,-10]\n mload r1 [r9,-8]\n call split_field\n mload r1 [r9,-6]\n mload r2 [r9,-4]\n mload r3 [r9,-5]\n mload r4 [r9,-3]\n mload r5 [r9,-11]\n add r5 r5 1\n mstore [r9,-9] r5\n mload r5 [r9,-9]\n mstore [r9,-7] r5\n gte r1 r2 r1\n cjmp r1 .LBL27_4\n mov r0 0\n jmp .LBL27_3\n.LBL27_3:\n gte r1 r4 r3\n cjmp r1 .LBL27_4\n mov r0 0\n jmp .LBL27_3\n.LBL27_4:\n add r9 r9 -14\n ret\nfield_memcmp_uge:\n.LBL28_0:\n add r9 r9 26\n mstore [r9,-2] r9\n mstore [r9,-8] r1\n mov r1 r2\n mstore [r9,-15] r1\n mov r1 r3\n mstore [r9,-10] r1\n mov r1 0\n mstore [r9,-7] r1\n jmp .LBL28_1\n.LBL28_1:\n mload r1 [r9,-7]\n mstore [r9,-14] r1\n mload r1 [r9,-10]\n mload r2 [r9,-14]\n gte r1 r1 r2\n mload r2 [r9,-10]\n mload r3 [r9,-14]\n neq r2 r3 r2\n and r1 r1 r2\n cjmp r1 .LBL28_2\n mov r0 1\n jmp .LBL28_4\n.LBL28_2:\n mload r1 [r9,-8]\n mload r2 [r9,-14]\n mload r1 [r1,r2]\n mload r2 [r9,-14]\n mload r3 [r9,-15]\n mload r2 [r3,r2]\n mstore [r9,-9] r2\n mload r3 [r9,-17]\n mload r2 [r9,-13]\n call split_field\n mload r3 [r9,-16]\n mload r2 [r9,-12]\n mload r1 [r9,-9]\n call split_field\n mload r1 [r9,-6]\n mload r2 [r9,-4]\n mload r3 [r9,-5]\n mload r4 [r9,-3]\n mload r5 [r9,-14]\n add r5 r5 1\n mstore [r9,-11] r5\n mload r5 [r9,-11]\n mstore [r9,-7] r5\n gte r1 r1 r2\n cjmp r1 .LBL28_3\n mov r0 0\n jmp .LBL28_4\n.LBL28_3:\n gte r1 r3 r4\n cjmp r1 .LBL28_1\n mov r0 0\n jmp .LBL28_4\n.LBL28_4:\n add r9 r9 -26\n ret\nfield_memcmp_ule:\n.LBL29_0:\n add r9 r9 14\n mstore [r9,-2] r9\n mov r6 0\n mstore [r9,-7] r6\n jmp .LBL29_1\n.LBL29_1:\n mload r6 [r9,-7]\n mstore [r9,-11] r6\n mload r6 [r9,-11]\n gte r6 r3 r6\n mload r7 [r9,-11]\n neq r3 r7 r3\n and r6 r6 r3\n cjmp r6 .LBL29_2\n mov r0 1\n jmp .LBL29_4\n.LBL29_2:\n mload r3 [r9,-11]\n mload r1 [r1,r3]\n mload r3 [r9,-11]\n mload r2 [r2,r3]\n mstore [r9,-8] r2\n mov r3 r4\n mov r2 r5\n call split_field\n mload r3 [r9,-12]\n mload r2 [r9,-10]\n mload r1 [r9,-8]\n call split_field\n mload r1 [r9,-6]\n mload r2 [r9,-4]\n mload r3 [r9,-5]\n mload r4 [r9,-3]\n mload r5 [r9,-11]\n add r5 r5 1\n mstore [r9,-9] r5\n mload r5 [r9,-9]\n mstore [r9,-7] r5\n gte r1 r2 r1\n cjmp r1 .LBL29_3\n mov r0 0\n jmp .LBL29_4\n.LBL29_3:\n gte r1 r4 r3\n cjmp r1 .LBL29_3\n mov r0 0\n jmp .LBL29_4\n.LBL29_4:\n add r9 r9 -14\n ret\nfield_memcmp_ult:\n.LBL30_0:\n add r9 r9 14\n mstore [r9,-2] r9\n mov r6 0\n mstore [r9,-7] r6\n jmp .LBL30_1\n.LBL30_1:\n mload r6 [r9,-7]\n mstore [r9,-11] r6\n mload r6 [r9,-11]\n gte r6 r3 r6\n mload r7 [r9,-11]\n neq r3 r7 r3\n and r6 r6 r3\n cjmp r6 .LBL30_2\n mov r0 1\n jmp .LBL30_4\n.LBL30_2:\n mload r3 [r9,-11]\n mload r1 [r1,r3]\n mload r3 [r9,-11]\n mload r2 [r2,r3]\n mstore [r9,-8] r2\n mov r3 r4\n mov r2 r5\n call split_field\n mload r3 [r9,-12]\n mload r2 [r9,-10]\n mload r1 [r9,-8]\n call split_field\n mload r1 [r9,-6]\n mload r2 [r9,-4]\n mload r3 [r9,-5]\n mload r4 [r9,-3]\n mload r5 [r9,-11]\n add r5 r5 1\n mstore [r9,-9] r5\n mload r5 [r9,-9]\n mstore [r9,-7] r5\n gte r1 r1 r2\n cjmp r1 .LBL30_4\n mov r0 0\n jmp .LBL30_3\n.LBL30_3:\n gte r1 r3 r4\n cjmp r1 .LBL30_4\n mov r0 0\n jmp .LBL30_3\n.LBL30_4:\n add r9 r9 -14\n ret\nu32_div_mod:\n.LBL31_0:\n add r9 r9 5\n mstore [r9,-3] r1\n mov r1 r2\n mstore [r9,-4] r1\n mload r1 [r9,-4]\n mov r2 r1\n mload r1 [r9,-3]\n.PROPHET31_0:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n mstore [r9,-5] r1\n mload r1 [r9,-5]\n range r1\n mload r1 [r9,-5]\n add r5 r1 1\n not r7 r5\n add r7 r7 1\n mload r1 [r9,-4]\n add r6 r1 r7\n range r6\n mload r1 [r9,-4]\n mov r2 r1\n mload r1 [r9,-3]\n.PROPHET31_1:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n range r3\n mload r2 [r9,-4]\n mul r2 r1 r2\n mstore [r9,-1] r2\n mload r2 [r9,-1]\n mload r5 [r9,-5]\n add r2 r2 r5\n mstore [r9,-2] r2\n mload r2 [r9,-2]\n mload r5 [r9,-3]\n eq r2 r2 r5\n assert r2\n mstore [r3] r1\n mload r1 [r9,-5]\n mstore [r4] r1\n add r9 r9 -5\n ret\nu32_power:\n.LBL32_0:\n mov r0 1\n mov r3 0\n jmp .LBL32_1\n.LBL32_1:\n add r5 r3 1\n mul r4 r0 r1\n gte r3 r2 r5\n cjmp r3 .LBL32_1\n mov r0 r4\n mov r3 r5\n jmp .LBL32_2\n.LBL32_2:\n range r0\n ret\nhash_compare:\n.LBL33_0:\n add r9 r9 9\n mstore [r9,-2] r9\n mov r1 10\n call vector_new\n mov r5 r0\n mstore [r9,-6] r5\n mload r5 [r9,-6]\n add r5 r5 1\n mov r6 104\n mstore [r5] r6\n mov r6 101\n mstore [r5,+1] r6\n mov r6 108\n mstore [r5,+2] r6\n mov r6 108\n mstore [r5,+3] r6\n mov r6 111\n mstore [r5,+4] r6\n mov r6 119\n mstore [r5,+5] r6\n mov r6 111\n mstore [r5,+6] r6\n mov r6 114\n mstore [r5,+7] r6\n mov r6 108\n mstore [r5,+8] r6\n mov r6 100\n mstore [r5,+9] r6\n mload r5 [r9,-6]\n mload r5 [r5]\n mstore [r9,-7] r5\n mov r1 4\n call heap_malloc\n mov r5 r0\n mload r6 [r9,-6]\n add r6 r6 1\n mload r7 [r9,-7]\n poseidon r5 r6 r7\n mstore [r9,-5] r5\n mload r5 [r9,-6]\n mload r5 [r5]\n mstore [r9,-9] r5\n mov r1 4\n call heap_malloc\n mov r5 r0\n mload r6 [r9,-6]\n add r6 r6 1\n mload r7 [r9,-9]\n poseidon r5 r6 r7\n mstore [r9,-4] r5\n mov r1 4\n call heap_malloc\n mov r5 r0\n mov r6 1006966343754\n mstore [r5] r6\n mov r6 107395124437206779\n mstore [r5,+1] r6\n mov r6 10878087049651741602\n mstore [r5,+2] r6\n mov r6 1885151562297713155\n mstore [r5,+3] r6\n mstore [r9,-3] r5\n mload r1 [r9,-5]\n mload r2 [r9,-3]\n mov r3 4\n call field_memcmp_ugt\n mov r5 r0\n assert r5\n add r9 r9 -9\n ret\nfunction_dispatch:\n.LBL34_0:\n add r9 r9 2\n mstore [r9,-2] r9\n mov r2 r3\n eq r8 r1 2051797338\n cjmp r8 .LBL34_2\n jmp .LBL34_1\n.LBL34_1:\n ret\n.LBL34_2:\n call hash_compare\n mov r1 1\n call heap_malloc\n mov r1 r0\n mov r2 0\n mstore [r1] r2\n tstore r1 1\n add r9 r9 -2\n ret\nmain:\n.LBL35_0:\n add r9 r9 8\n mstore [r9,-2] r9\n mov r1 13\n call heap_malloc\n mov r5 r0\n mov r6 1\n tload r5 r6 13\n mload r5 [r5]\n mstore [r9,-4] r5\n mov r1 14\n call heap_malloc\n mov r5 r0\n mov r6 1\n tload r5 r6 14\n mload r5 [r5]\n mstore [r9,-6] r5\n mload r5 [r9,-6]\n add r5 r5 14\n mstore [r9,-3] r5\n mload r1 [r9,-3]\n call heap_malloc\n mov r3 r0\n mov r5 1\n mload r6 [r9,-3]\n tload r3 r5 r6\n mload r2 [r9,-6]\n mload r1 [r9,-4]\n call function_dispatch\n add r9 r9 -8\n end\n", "prophets": [ { "label": ".PROPHET19_0", diff --git a/interpreter/src/lexer/mod.rs b/interpreter/src/lexer/mod.rs index f223f057..b786a6bc 100644 --- a/interpreter/src/lexer/mod.rs +++ b/interpreter/src/lexer/mod.rs @@ -78,6 +78,7 @@ impl Lexer { let mut result = String::new(); while self.current_char != None && self.current_char.unwrap().is_alphanumeric() || self.current_char.unwrap() == '.' + || self.current_char.unwrap() == '_' { result.push(self.current_char.unwrap()); self.advance();