compiler/ lib/ scripts/ seed/ test/ tests/ abi.sizes.rad 3.4 KiB addfn.rad 52 B addfn.ril 76 B aggregate.return.rad 4.1 KiB arith.assignment.rad 595 B arith.basic.rad 191 B arith.modulo.rad 111 B arith.subword.rad 3.9 KiB arith.subword.ril 4.3 KiB arith.sum.rad 192 B arith.w64.rad 4.1 KiB arith.w64.ril 5.2 KiB array.aggregate.stride.rad 753 B array.aggregate.stride.ril 1.1 KiB array.assign.rad 221 B array.assign.ril 526 B array.bounds.check.rad 321 B array.index.assign.rad 382 B array.index.rad 264 B array.index.ril 496 B array.len.const.rad 348 B array.len.const.ril 200 B array.length.rad 277 B array.literal.rad 136 B array.literal.ril 329 B array.math.rad 1.2 KiB array.nested.assign.rad 319 B array.nested.rad 325 B array.nested.ril 922 B array.record.elements.rad 1.7 KiB array.repeat.edge.rad 548 B array.repeat.rad 828 B array.repeat.ril 3.0 KiB array.return.rad 345 B array.slice.empty.rad 123 B array.slice.full.rad 110 B array.slice.full.ril 168 B array.slice.gen.end.rad 141 B array.slice.gen.index.rad 154 B array.slice.gen.open.rad 140 B array.slice.gen.start.end.rad 142 B array.slice.gen.start.rad 141 B array.slice.openend.rad 134 B array.slice.openend.ril 245 B array.slice.openstart.rad 134 B array.slice.openstart.ril 183 B array.slice.rad 774 B as.precedence.rad 226 B assert.basic.rad 402 B assert.basic.ril 624 B assert.fail.rad 138 B assert.false.rad 140 B assert.message.rad 123 B assert.message.ril 141 B assert.true.rad 115 B assign.loop.rad 205 B assign.loop.ril 242 B assign.multi.var.rad 182 B assign.multi.var.ril 73 B assign.mutable.rad 6.1 KiB assign.param.rad 142 B assign.param.ril 96 B assign.rad 144 B assign.self.ref.rad 153 B assign.self.ref.ril 92 B assign.sequential.rad 155 B assign.sequential.ril 52 B assign.shadow.mutable.rad 461 B assign.use.intermediate.rad 187 B assign.use.intermediate.ril 99 B average.rad 185 B average.ril 378 B binop.arith.rad 479 B binop.arith.ril 389 B binop.bitwise.rad 1.2 KiB binop.bitwise.ril 1.2 KiB binop.cmp.rad 441 B binop.logical.rad 216 B binop.logical.ril 373 B binop.shift.rad 197 B binop.shift.ril 149 B binop.unsigned.rad 317 B binop.unsigned.ril 236 B bool.comparison.array.rad 688 B bool.comparison.nested.gen.rad 1.0 KiB bool.comparison.opt.rad 905 B bool.comparison.record.gen.rad 1.0 KiB bool.comparison.record.rad 1.1 KiB bool.comparison.slice.gen.rad 157 B bool.comparison.slice.rad 4.1 KiB bool.comparison.slice.record.gen.rad 2.0 KiB bool.comparison.slice.union.gen.rad 2.5 KiB bool.comparison.union.ctor.rad 705 B bool.comparison.union.gen.rad 1.2 KiB bool.comparison.union.record.gen.rad 1.5 KiB bool.comparison.union.simple.gen.rad 296 B bool.operators.complex.rad 384 B bool.operators.rad 831 B bool.short.circuit.rad 2.3 KiB bool.simple.rad 209 B bool.values.rad 787 B builtin.alignof.rad 692 B builtin.alignof.ril 287 B builtin.size.align.rad 1.2 KiB builtin.sizeof.rad 650 B builtin.sizeof.ril 282 B builtin.sliceof.mut.rad 621 B builtin.sliceof.rad 505 B byte.load.store.rad 372 B byte.load.store.ril 730 B call.arg.clobber.rad 732 B call.basic.rad 256 B call.clobber.rad 477 B call.tests.rad 764 B call.tests.ril 603 B cast.basic.rad 848 B cast.basic.ril 594 B cast.narrow.rad 583 B cast.narrow.ril 557 B cast.same.size.rad 1.0 KiB cast.same.size.ril 1.1 KiB casting.numbers.rad 1.5 KiB char.literal.rad 180 B cmp.rel.rad 733 B cmp.rel.ril 467 B cmp.unsigned.rad 733 B cmp.unsigned.ril 467 B coercion.implicit.rad 917 B coercion.implicit.ril 1.0 KiB compound.assign.field.rad 300 B compound.assign.rad 1.1 KiB compound.assign.ril 2.0 KiB cond.assign.merge.basic.rad 213 B cond.assign.merge.basic.ril 172 B cond.assign.merge.rad 206 B cond.assign.merge.ril 169 B cond.assign.rad 738 B cond.elseif.rad 204 B cond.elseif.ril 181 B cond.expr.aggregate.rad 1.2 KiB cond.expr.rad 1.9 KiB cond.expr.ril 3.5 KiB cond.for.else.break.rad 341 B cond.for.indexed.rad 253 B cond.for.rad 180 B cond.for.range.indexed.rad 541 B cond.for.range.rad 186 B cond.for.unsigned.range.rad 659 B cond.forever.break.continue.rad 197 B cond.forever.break.rad 247 B cond.fused.rad 941 B cond.if.case.rad 2.2 KiB cond.if.else.min.rad 158 B cond.if.else.rad 240 B cond.if.elseif.rad 435 B cond.if.noelse.rad 135 B cond.if.rad 880 B cond.ifelse.rad 104 B cond.ifelse.ril 117 B cond.iflet.case.rad 170 B cond.iflet.case.ril 114 B cond.iflet.guard.rad 182 B cond.iflet.guard.ril 165 B cond.iflet.mut.rad 191 B cond.iflet.mut.ril 217 B cond.iflet.noelse.rad 156 B cond.iflet.noelse.ril 225 B cond.iflet.optional.rad 184 B cond.iflet.optional.ril 118 B cond.iflet.optional.value.rad 194 B cond.iflet.optional.value.ril 206 B cond.letelse.case.rad 146 B cond.letelse.case.ril 118 B cond.letelse.guard.rad 160 B cond.letelse.guard.ril 169 B cond.letelse.mut.rad 181 B cond.letelse.mut.ril 221 B cond.letelse.optional.rad 160 B cond.letelse.optional.ril 122 B cond.match.fallthrough.rad 384 B cond.match.guard.rad 1.4 KiB cond.match.guard.regalloc.rad 1.3 KiB cond.nested.rad 138 B cond.nested.ril 185 B cond.simple.rad 86 B cond.simple.ril 118 B cond.while.else.break.rad 297 B cond.while.rad 134 B const-expr-array-size.rad 356 B const-expr-cast.rad 1.0 KiB const-expr-literal.rad 628 B const-expr-refs.rad 716 B const.array.copy.mutate.rad 386 B const.array.ident.rad 238 B const.array.ident.ril 146 B const.array.rad 210 B const.array.record.ident.rad 378 B const.array.record.ident.ril 353 B const.array.repeat.record.rad 216 B const.array.repeat.record.ril 399 B const.array.ril 392 B const.array.strings.slice.rad 271 B const.array.strings.slice.ril 539 B const.basic.rad 340 B const.char.rad 174 B const.fn.array.rad 664 B const.negative.rad 322 B const.negative.ril 338 B const.record.array.rad 1.2 KiB const.record.array.simple.rad 538 B const.record.ctor.rad 185 B const.record.ctor.ril 415 B const.record.fn.rad 353 B const.record.mutcopy.rad 450 B const.record.mutcopy.ril 385 B const.record.nested.rad 393 B const.record.nested.ril 474 B const.record.packed.rad 266 B const.record.packed.ril 284 B const.record.padded.rad 266 B const.record.padded.ril 318 B const.record.rad 197 B const.record.ril 221 B const.record.union.rad 593 B const.record.union.ril 625 B const.scalar.rad 102 B const.scalar.ril 82 B const.slice.of.slices.rad 232 B const.slice.of.slices.ril 876 B const.slice.param.rad 333 B const.string.rad 111 B const.string.ril 285 B const.string.scoped.names.rad 254 B const.string.scoped.names.ril 840 B const.union.payload.ctor.rad 364 B const.union.payload.ctor.ril 507 B const.union.record.literal.rad 374 B const.union.record.literal.ril 506 B data.array.rad 782 B data.bool.rad 231 B data.i16.rad 276 B data.i32.rad 296 B data.i8.rad 263 B data.record.rad 576 B data.simple.rad 451 B data.u16.rad 235 B data.u32.rad 255 B data.u8.rad 223 B data.union.rad 901 B debug.tag.rad 557 B ecall.i64.rad 497 B edge.cases.2.rad 352 B edge.cases.3.rad 594 B edge.cases.4.rad 1.2 KiB edge.cases.5.rad 1.1 KiB edge.cases.6.rad 2.6 KiB edge.cases.7.addr.bug.rad 224 B edge.cases.8.bug.rad 523 B edge.cases.rad 238 B error.basic.rad 174 B error.catch.rad 1.6 KiB error.catch.return.rad 403 B error.catch.return.ril 634 B error.division.zero.rad 164 B error.modulo.zero.rad 162 B error.multi.basic.rad 687 B error.multi.catch.rad 787 B error.multi.catch.typed.binding.rad 806 B error.multi.catch.typed.catchall.rad 1.0 KiB error.multi.catch.typed.rad 1.1 KiB error.multi.propagate.multi.rad 968 B error.multi.propagate.rad 840 B error.multi.try.optional.rad 522 B error.slice.bounds.rad 219 B error.try.bang.success.rad 370 B error.try.catch.binding.rad 2.0 KiB error.try.optional.rad 1.9 KiB error.try.rad 4.0 KiB externfn.rad 39 B externfn.ril 37 B fibonacci.rad 122 B fibonacci.ril 247 B field.aggregate.rad 793 B field.aggregate.ril 782 B fn.block.scope.rad 508 B fn.callback.nested.rad 1.2 KiB fn.default.rad 146 B fn.local.rad 155 B fn.ptr.assign.rad 277 B fn.ptr.assign.ril 143 B fn.ptr.call.rad 258 B fn.ptr.call.ril 183 B fn.ptr.param.rad 356 B fn.ptr.param.ril 282 B fn.recursion.2.rad 239 B fn.void.rad 165 B for.else.continue.rad 1.1 KiB frame.large.rad 582 B if-let-mut.rad 1.2 KiB iflet.shadow.leak.rad 317 B index.u8.rad 594 B int.default.i64.rad 1.1 KiB integer.bitwise.basic.rad 708 B integer.overflow.rad 1.8 KiB intrinsic.ebreak.rad 97 B intrinsic.ebreak.ril 76 B intrinsic.ecall.rad 175 B intrinsic.ecall.ril 131 B large.blit.store.rad 2.1 KiB let.copy.semantics.rad 871 B let.copy.semantics.ril 879 B let.guard.rad 1.9 KiB let.placeholder.rad 291 B let.placeholder.ril 220 B literal.char.rad 209 B literal.char.ril 127 B literal.slice.bytes.rad 124 B literal.slice.bytes.ril 245 B literal.slice.dedup.rad 199 B literal.slice.dedup.ril 407 B literal.slice.empty.rad 100 B literal.slice.empty.ril 157 B literal.slice.multi.rad 170 B literal.slice.multi.ril 460 B literal.slice.rad 123 B literal.slice.record.rad 211 B literal.slice.record.ril 676 B literal.slice.ril 254 B literal.string.dedup.rad 179 B literal.string.dedup.ril 395 B literal.string.empty.rad 93 B literal.string.empty.ril 230 B literal.string.fns.rad 180 B literal.string.fns.ril 434 B literal.string.multi.rad 153 B literal.string.multi.ril 444 B literal.string.rad 108 B literal.string.ril 229 B literal.w64.rad 1.7 KiB load.u32.high.rad 1.8 KiB loc.addr.offset.bug.rad 425 B loc.addr.opt.to.opt.rad 448 B loc.addr.optional.assign.rad 423 B loc.addr.record.assign.rad 458 B local.multi.rad 85 B local.multi.ril 67 B local.mut.rad 75 B local.mut.ril 45 B local.simple.rad 60 B local.simple.ril 45 B loop.break.rad 152 B loop.break.ril 228 B loop.complex.flow.rad 1022 B loop.continue.rad 211 B loop.continue.ril 327 B loop.for.array.rad 219 B loop.for.array.ril 315 B loop.for.break.bound.rad 161 B loop.for.break.bound.ril 264 B loop.for.continue.rad 395 B loop.for.continue.ril 741 B loop.for.indexed.rad 145 B loop.for.indexed.ril 285 B loop.for.placeholder.rad 313 B loop.for.placeholder.ril 457 B loop.for.rad 116 B loop.for.ril 220 B loop.for.slice.rad 212 B loop.for.slice.ril 362 B loop.for.unsigned.range.rad 309 B loop.for.unsigned.range.ril 481 B loop.infinite.rad 41 B loop.infinite.ril 78 B loop.mutable.rad 371 B loop.mutable.ril 617 B loop.nested.break.rad 380 B loop.nested.break.ril 461 B loop.nested.continue.rad 406 B loop.nested.continue.ril 581 B loop.return.rad 137 B loop.return.ril 179 B loop.sealblock.rad 926 B loop.while.false.noparams.rad 175 B loop.while.false.noparams.ril 171 B loop.while.nested.shortcircuit.rad 860 B loop.while.nested.shortcircuit.ril 589 B loop.while.rad 156 B loop.while.ril 241 B loop.whilelet.case.rad 251 B loop.whilelet.case.ril 204 B loop.whilelet.guard.rad 257 B loop.whilelet.guard.ril 256 B loop.whilelet.optional.rad 208 B loop.whilelet.optional.ril 217 B loop.whilelet.union.rad 368 B loop.whilelet.union.ril 382 B match.array.rad 3.5 KiB match.char.rad 1.6 KiB match.more.rad 643 B match.more.ril 683 B match.multi.seal.rad 1002 B match.multi.seal.ril 924 B match.multi.survive.rad 1.6 KiB match.mutref.push.rad 1.0 KiB match.mutref.union.rad 677 B match.nested.call.rad 1.7 KiB match.nested.deep.rad 2.2 KiB match.nested.deref.rad 3.7 KiB match.nested.guard.rad 1.6 KiB match.nested.iflet.guard.rad 1.6 KiB match.nested.iflet.rad 1.4 KiB match.nested.iflet.ril 2.3 KiB match.nested.letelse.rad 828 B match.nested.letelse.union.rad 1.3 KiB match.nested.literal.rad 3.1 KiB match.nested.multi.rad 2.4 KiB match.nested.pattern.rad 5.2 KiB match.nested.pattern.ril 8.3 KiB match.nested.record.rad 2.1 KiB match.nested.record.ril 3.5 KiB match.nested.union.rad 2.3 KiB match.nested.union.ril 4.5 KiB match.nested.whilelet.rad 2.4 KiB match.optional.aggregate.rad 222 B match.optional.aggregate.ril 578 B match.optional.rad 183 B match.optional.ril 164 B match.record.pattern.rad 325 B match.record.pattern.ril 287 B match.simple.rad 367 B match.simple.ril 347 B match.string.rad 1.8 KiB match.switch.rad 217 B match.switch.ril 187 B match.value.copy.rad 2.0 KiB match.void.then.or.rad 1.6 KiB memzero.result.bug.rad 821 B memzero.union.bug.rad 591 B method.basic.rad 554 B method.chain.rad 560 B method.multiple.rad 888 B method.ptr.rad 662 B method.pub.rad 238 B method.return.rad 599 B method.throws.rad 829 B method.union.rad 424 B method.with.trait.rad 644 B mixedtypes.rad 79 B mixedtypes.ril 82 B multi.throw.basic.rad 272 B multi.throw.basic.ril 526 B multi.throw.catch.typed.rad 436 B multi.throw.catch.typed.ril 1015 B multi.throw.propagate.rad 335 B multi.throw.propagate.ril 873 B multiplefns.rad 110 B multiplefns.ril 146 B mutref.loop.bug.rad 1.8 KiB mutref.loop.rad 281 B mutref.loop.ril 368 B mutref.scalar.rad 228 B mutref.scalar.ril 324 B nil.cmp.rad 622 B nil.cmp.ril 423 B noparams.rad 38 B noparams.ril 43 B opt.array.hint.rad 951 B opt.assignment.bug.rad 1.3 KiB opt.bug.test.rad 1.4 KiB opt.if.let.complex.rad 6.2 KiB opt.if.let.guard.rad 809 B opt.if.let.rad 956 B opt.nil.check.rad 1.5 KiB opt.ptr.return.nil.rad 85 B opt.ptr.return.nil.ril 51 B opt.record.eq.rad 842 B opt.record.eq.rev.rad 307 B opt.record.eq.rev.ril 635 B opt.record.eq.ril 3.4 KiB opt.record.rad 655 B opt.return.array.rad 289 B opt.return.nested.rad 797 B opt.return.nil.rad 82 B opt.return.nil.ril 114 B opt.return.record.rad 344 B opt.return.value.rad 91 B opt.return.value.ril 138 B opt.slice.npo.rad 2.8 KiB opt.slice.npo.ril 6.8 KiB opt.type.rad 215 B opt.while.let.complex.rad 404 B optional.aggregate.eq.rad 286 B optional.aggregate.eq.ril 695 B optional.eq.rad 131 B optional.eq.ril 253 B optional.ptr.eq.rad 313 B optional.ptr.eq.ril 309 B panic.basic.rad 70 B panic.basic.ril 46 B panic.rad 111 B placeholder.basic.rad 148 B placeholder.comprehensive.rad 577 B pointer.copy.edge.case.rad 1.3 KiB pointer.slice.index.rad 284 B pointer.slice.store.rad 896 B pointerfn.rad 50 B pointerfn.ril 54 B prog.ackermann.rad 5.0 KiB prog.bignum.rad 9.5 KiB prog.binsearch.rad 2.5 KiB prog.bubblesort.rad 2.0 KiB prog.cordic.rad 6.9 KiB prog.crc32.rad 2.7 KiB prog.dijkstra.rad 7.7 KiB prog.eval.rad 6.2 KiB prog.hanoi.rad 3.8 KiB prog.huffman.rad 9.3 KiB prog.hybridsort.rad 3.1 KiB prog.linkedlist.rad 5.9 KiB prog.lzw.rad 6.7 KiB prog.matmul.rad 2.9 KiB prog.mersenne.rad 5.2 KiB prog.nqueens.rad 3.4 KiB prog.rbtree.rad 8.3 KiB prog.regex.rad 10.2 KiB prog.sha256.rad 7.1 KiB prog.sieve.rad 2.8 KiB prog.symtab.rad 10.1 KiB prog.tokenizer.rad 13.9 KiB prog.vm.rad 17.4 KiB ptr.addressof.field.rad 132 B ptr.addressof.field.ril 78 B ptr.addressof.local.rad 455 B ptr.addressof.local.ril 280 B ptr.addressof.rad 119 B ptr.addressof.ril 213 B ptr.assign.rad 137 B ptr.assign.ril 130 B ptr.deref.rad 622 B ptr.deref.record.rad 282 B ptr.deref.record.ril 190 B ptr.deref.ril 1.1 KiB ptr.eq.rad 981 B ptr.mutate.rad 244 B ptr.opaque.rad 1.4 KiB ptr.subscript.assign.rad 129 B ptr.subscript.assign.ril 288 B range.arithmetic.rad 723 B record.access.rad 300 B record.alignment.rad 194 B record.array.elements.rad 1.7 KiB record.assign.blit.rad 111 B record.assign.blit.ril 158 B record.copy.rad 2.0 KiB record.ctor.tuple.rad 69 B record.ctor.tuple.ril 127 B record.empty.eq.rad 272 B record.empty.eq.ril 226 B record.eq.rad 223 B record.eq.ril 214 B record.field.assign.rad 199 B record.field.assign.ril 308 B record.literal.labeled.rad 103 B record.literal.labeled.ril 127 B record.mixed.layout.rad 116 B record.mixed.layout.ril 149 B record.nested.calls.2.rad 612 B record.nested.calls.3.rad 749 B record.nested.eq.rad 246 B record.nested.eq.ril 522 B record.nested.lit.rad 170 B record.nested.lit.ril 188 B record.param.lit.rad 368 B record.ptr.access.rad 242 B record.ptr.access.ril 198 B record.ptr.mutate.rad 235 B record.shorthand.rad 1.5 KiB record.unlabeled.deref.rad 1.4 KiB record.unlabeled.rad 407 B ref.if.bug.rad 519 B ref.immut.loop.bug.rad 670 B ref.mut.ptr.rad 253 B regalloc.callee.save.rad 1.5 KiB regalloc.spill.reuse.rad 488 B reserve.loop.rad 407 B reserve.loop.ril 473 B result.void.success.rad 701 B return.lit.rad 45 B return.lit.ril 50 B return.param.rad 48 B return.param.ril 54 B simplefn.rad 45 B simplefn.ril 51 B slice.alloc.loop.rad 803 B slice.append.rad 4.1 KiB slice.append.ril 18.4 KiB slice.assign.mismatch.rad 216 B slice.assign.rad 1.4 KiB slice.basic.rad 742 B slice.basic.ril 711 B slice.cap.rad 956 B slice.delete.rad 986 B slice.delete.ril 4.8 KiB slice.eq.rad 126 B slice.eq.ril 209 B slice.index.rad 104 B slice.index.ril 278 B slice.mutable.rad 281 B slice.mutable.ril 1.7 KiB slice.of.rad 475 B slice.range.rad 606 B slice.range.ril 1.2 KiB slice.runtime.i32.rad 237 B slice.runtime.i32.ril 725 B slice.runtime.literal.rad 240 B slice.runtime.literal.ril 455 B slice.subslice.rad 1.4 KiB spill.blockarg.clobber.rad 3.5 KiB spill.loop.rad 1.6 KiB stack.local.corrupt.rad 335 B static.array.mutate.rad 402 B static.assign.rad 127 B static.assign.ril 244 B static.basic.rad 327 B static.fn.array.rad 628 B static.local.decl.rad 191 B static.local.decl.ril 280 B static.record.array.rad 518 B static.scalar.rad 109 B static.scalar.ril 135 B static.slice.index.assign.rad 408 B static.slice.offset.rad 683 B string.basic.rad 164 B string.escape.rad 364 B string.index.rad 131 B switch.blockargs.clobber.rad 1.4 KiB trait.aggregate.ret.rad 1.5 KiB trait.array.optional.rad 1.7 KiB trait.basic.rad 580 B trait.control.flow.rad 1.2 KiB trait.dispatch.rad 323 B trait.dispatch.ril 469 B trait.fn.param.rad 1.7 KiB trait.multiple.methods.rad 1.2 KiB trait.multiple.traits.rad 1.2 KiB trait.multiple.types.rad 1.3 KiB trait.object.rad 356 B trait.object.ril 496 B trait.supertrait.rad 2.6 KiB trait.supertrait.ril 3.8 KiB trait.throws.rad 1.0 KiB trait.writer.rad 2.6 KiB trivial.phi.rad 1.1 KiB trivial.phi.ril 512 B try.basic.rad 391 B try.basic.ril 879 B try.catch.rad 339 B try.catch.ril 837 B try.optional.rad 363 B try.optional.ril 760 B try.panic.rad 351 B try.panic.ril 639 B type.unify.rad 4.5 KiB undefined.aggregate.rad 152 B undefined.aggregate.ril 84 B undefined.primitive.rad 115 B undefined.primitive.ril 48 B undefined.rad 432 B undefined.record.field.rad 1.6 KiB undefined.record.field.ril 751 B union-tag.rad 926 B union.bitfield.rad 1.2 KiB union.ctor.rad 552 B union.ctor.ril 385 B union.discriminant.cast.rad 389 B union.edge.case.2.rad 694 B union.edge.case.3.rad 623 B union.eq.rad 783 B union.eq.ril 1.4 KiB union.eq.void.ctor.rad 378 B union.eq.void.ctor.ril 131 B union.eq.void.rad 178 B union.eq.void.ril 75 B union.match.bind.rad 259 B union.match.bind.ril 238 B union.match.ref.rad 1.1 KiB union.match.ref.ril 1.2 KiB union.match.tag.rad 858 B union.match.tag.ril 820 B union.mixed.assign.rad 992 B union.payload.mutref.rad 1.4 KiB union.payload.rad 595 B union.payload.record.eq.rad 292 B union.payload.record.eq.ril 984 B union.record.forward.rad 1.3 KiB union.record.literal.rad 444 B union.record.literal.ril 391 B union.variant.access.rad 731 B union.variant.access.ril 506 B union.void.match.rad 418 B union.void.rad 839 B unop.rad 478 B unop.ril 376 B unsigned.compare.rad 1.9 KiB var.align.rad 1.0 KiB var.infer.rad 564 B var.shadow.rad 236 B var.shadow.ril 145 B void.throw.rad 270 B void.throw.ril 707 B voidfn.rad 18 B voidfn.ril 43 B run 1.9 KiB runner.rad 7.0 KiB vim/ .gitignore 353 B .gitsigners 112 B LICENSE 1.1 KiB Makefile 3.0 KiB README 2.5 KiB std.lib 1.0 KiB std.lib.test 252 B
test/tests/prog.symtab.rad 10.1 KiB raw
1
//! returns: 0
2
//! Symbol table.
3
//! Implement a multi-scope symbol table with hash-based lookup, scope
4
//! push/pop, and symbol resolution. Exercises: optionals, if-let,
5
//! while-let, let-else, for-in with indexing, records with pointer
6
//! fields, and complex interactions between data structures.
7
8
const MAX_SYMBOLS: u32 = 256;
9
const MAX_SCOPES: u32 = 16;
10
const HASH_SIZE: u32 = 64;
11
const NIL: u32 = 0xFFFFFFFF;
12
13
/// A symbol entry in the table.
14
record Symbol {
15
    /// Name of the symbol (hash for comparison).
16
    nameHash: u32,
17
    /// The value associated with this symbol.
18
    value: i32,
19
    /// Scope depth at which this symbol was defined.
20
    depth: u32,
21
    /// Next symbol in hash chain.
22
    next: u32,
23
    /// Previous symbol with the same name (for shadowing).
24
    shadow: u32,
25
}
26
27
/// A scope boundary marker.
28
record ScopeMarker {
29
    /// Number of symbols when scope was entered.
30
    symbolCount: u32,
31
}
32
33
/// The symbol table.
34
record SymTab {
35
    symbols: *mut [Symbol],
36
    symbolCount: u32,
37
    scopes: *mut [ScopeMarker],
38
    scopeDepth: u32,
39
    buckets: *mut [u32],
40
}
41
42
/// Simple string hash function.
43
fn hashName(name: *[u8]) -> u32 {
44
    let mut h: u32 = 5381;
45
    for ch in name {
46
        h = ((h << 5) + h) + ch as u32;
47
    }
48
    return h;
49
}
50
51
/// Initialize the symbol table.
52
fn init(tab: *mut SymTab) {
53
    tab.symbolCount = 0;
54
    tab.scopeDepth = 0;
55
56
    for i in 0..HASH_SIZE {
57
        tab.buckets[i] = NIL;
58
    }
59
}
60
61
/// Push a new scope.
62
fn pushScope(tab: *mut SymTab) {
63
    tab.scopes[tab.scopeDepth] = ScopeMarker { symbolCount: tab.symbolCount };
64
    tab.scopeDepth += 1;
65
}
66
67
/// Pop the current scope, removing all symbols defined in it.
68
fn popScope(tab: *mut SymTab) {
69
    if tab.scopeDepth == 0 {
70
        return;
71
    }
72
    tab.scopeDepth -= 1;
73
    let marker = tab.scopes[tab.scopeDepth];
74
75
    // Remove symbols added in this scope (in reverse order).
76
    while tab.symbolCount > marker.symbolCount {
77
        tab.symbolCount -= 1;
78
        let sym = tab.symbols[tab.symbolCount];
79
        let bucket = sym.nameHash % HASH_SIZE;
80
81
        // Remove from hash chain.
82
        tab.buckets[bucket] = sym.next;
83
84
        // Restore shadowed symbol if any.
85
        if sym.shadow != NIL {
86
            // The shadowed symbol is still in the symbols array;
87
            // re-link it into the hash chain.
88
            let shadowIdx = sym.shadow;
89
            tab.symbols[shadowIdx].next = tab.buckets[bucket];
90
            tab.buckets[bucket] = shadowIdx;
91
        }
92
    }
93
}
94
95
/// Define a symbol in the current scope.
96
fn define(tab: *mut SymTab, name: *[u8], value: i32) -> u32 {
97
    let h = hashName(name);
98
    let bucket = h % HASH_SIZE;
99
100
    // Check for shadowed symbol with same name.
101
    let mut shadowIdx: u32 = NIL;
102
    let mut cur = tab.buckets[bucket];
103
    while cur != NIL {
104
        if tab.symbols[cur].nameHash == h {
105
            // Found existing symbol with same hash - shadow it.
106
            // Remove it from hash chain first.
107
            shadowIdx = cur;
108
            // Remove the shadowed symbol from the bucket chain.
109
            if tab.buckets[bucket] == cur {
110
                tab.buckets[bucket] = tab.symbols[cur].next;
111
            }
112
            break;
113
        }
114
        cur = tab.symbols[cur].next;
115
    }
116
117
    let idx = tab.symbolCount;
118
    tab.symbols[idx] = Symbol {
119
        nameHash: h,
120
        value,
121
        depth: tab.scopeDepth,
122
        next: tab.buckets[bucket],
123
        shadow: shadowIdx,
124
    };
125
    tab.buckets[bucket] = idx;
126
    tab.symbolCount += 1;
127
    return idx;
128
}
129
130
/// Look up a symbol by name. Returns the value if found.
131
fn lookup(tab: *SymTab, name: *[u8]) -> ?i32 {
132
    let h = hashName(name);
133
    let bucket = h % HASH_SIZE;
134
    let mut cur = tab.buckets[bucket];
135
136
    while cur != NIL {
137
        if tab.symbols[cur].nameHash == h {
138
            return tab.symbols[cur].value;
139
        }
140
        cur = tab.symbols[cur].next;
141
    }
142
    return nil;
143
}
144
145
/// Update a symbol's value. Returns true if the symbol was found.
146
fn update(tab: *mut SymTab, name: *[u8], newValue: i32) -> bool {
147
    let h = hashName(name);
148
    let bucket = h % HASH_SIZE;
149
    let mut cur = tab.buckets[bucket];
150
151
    while cur != NIL {
152
        if tab.symbols[cur].nameHash == h {
153
            tab.symbols[cur].value = newValue;
154
            return true;
155
        }
156
        cur = tab.symbols[cur].next;
157
    }
158
    return false;
159
}
160
161
/// Test basic define and lookup.
162
fn testBasic(tab: *mut SymTab) -> i32 {
163
    init(tab);
164
    pushScope(tab);
165
166
    define(tab, "x", 10);
167
    define(tab, "y", 20);
168
    define(tab, "z", 30);
169
170
    let x = lookup(tab, "x") else {
171
        return 1;
172
    };
173
    assert x == 10;
174
175
    let y = lookup(tab, "y") else {
176
        return 3;
177
    };
178
    assert y == 20;
179
180
    let z = lookup(tab, "z") else {
181
        return 5;
182
    };
183
    assert z == 30;
184
185
    // Lookup nonexistent symbol.
186
    if let val = lookup(tab, "w") {
187
        return 7;
188
    }
189
190
    popScope(tab);
191
    return 0;
192
}
193
194
/// Test scope shadowing.
195
fn testShadowing(tab: *mut SymTab) -> i32 {
196
    init(tab);
197
    pushScope(tab);
198
    define(tab, "x", 1);
199
200
    // Verify outer x.
201
    let x1 = lookup(tab, "x") else {
202
        return 1;
203
    };
204
    assert x1 == 1;
205
206
    // Push inner scope, shadow x.
207
    pushScope(tab);
208
    define(tab, "x", 2);
209
210
    let x2 = lookup(tab, "x") else {
211
        return 3;
212
    };
213
    assert x2 == 2;
214
215
    // Pop inner scope, x should revert.
216
    popScope(tab);
217
218
    let x3 = lookup(tab, "x") else {
219
        return 5;
220
    };
221
    assert x3 == 1;
222
223
    popScope(tab);
224
    return 0;
225
}
226
227
/// Test deep nesting with shadowing.
228
fn testDeepNesting(tab: *mut SymTab) -> i32 {
229
    init(tab);
230
231
    // Define x at each of 8 scope levels.
232
    let mut i: u32 = 0;
233
    while i < 8 {
234
        pushScope(tab);
235
        define(tab, "x", i as i32 * 10);
236
        i += 1;
237
    }
238
239
    // x should be the innermost value.
240
    let x = lookup(tab, "x") else {
241
        return 1;
242
    };
243
    assert x == 70;
244
245
    // Pop scopes one by one and check.
246
    i = 7;
247
    while i > 0 {
248
        popScope(tab);
249
        let val = lookup(tab, "x") else {
250
            return 3;
251
        };
252
        let expected = (i - 1) as i32 * 10;
253
        assert val == expected;
254
        i -= 1;
255
    }
256
257
    popScope(tab);
258
    return 0;
259
}
260
261
/// Test multiple symbols per scope.
262
fn testMultipleSymbols(tab: *mut SymTab) -> i32 {
263
    init(tab);
264
    pushScope(tab);
265
266
    // Define a bunch of symbols.
267
    let names: [*[u8]; 8] = ["a", "bb", "ccc", "dddd", "eeeee", "ff", "ggg", "h"];
268
    let values: [i32; 8] = [1, 2, 3, 4, 5, 6, 7, 8];
269
270
    for name, i in names {
271
        define(tab, name, values[i]);
272
    }
273
274
    // Verify all of them.
275
    let mut sum: i32 = 0;
276
    for name, i in names {
277
        if let val = lookup(tab, name) {
278
            sum += val;
279
        } else {
280
            return 1;
281
        }
282
    }
283
284
    // 1+2+3+4+5+6+7+8 = 36
285
    assert sum == 36;
286
287
    popScope(tab);
288
    return 0;
289
}
290
291
/// Test update functionality.
292
fn testUpdate(tab: *mut SymTab) -> i32 {
293
    init(tab);
294
    pushScope(tab);
295
296
    define(tab, "counter", 0);
297
298
    // Increment counter 10 times.
299
    let mut i: u32 = 0;
300
    while i < 10 {
301
        let cur = lookup(tab, "counter") else {
302
            return 1;
303
        };
304
        assert update(tab, "counter", cur + 1);
305
        i += 1;
306
    }
307
308
    let finalVal = lookup(tab, "counter") else {
309
        return 3;
310
    };
311
    assert finalVal == 10;
312
313
    // Update nonexistent symbol should fail.
314
    if update(tab, "nonexistent", 99) {
315
        return 5;
316
    }
317
318
    popScope(tab);
319
    return 0;
320
}
321
322
/// Test scope isolation: symbols in popped scopes are gone.
323
fn testScopeIsolation(tab: *mut SymTab) -> i32 {
324
    init(tab);
325
326
    pushScope(tab);
327
    define(tab, "outer", 1);
328
329
    pushScope(tab);
330
    define(tab, "inner", 2);
331
332
    // Both visible.
333
    if let val = lookup(tab, "outer") {
334
        assert val == 1;
335
    } else {
336
        return 2;
337
    }
338
    if let val = lookup(tab, "inner") {
339
        assert val == 2;
340
    } else {
341
        return 4;
342
    }
343
344
    popScope(tab);
345
346
    // outer still visible, inner gone.
347
    if let val = lookup(tab, "outer") {
348
        assert val == 1;
349
    } else {
350
        return 6;
351
    }
352
    if let val = lookup(tab, "inner") {
353
        return 7;
354
    }
355
356
    popScope(tab);
357
    return 0;
358
}
359
360
/// Test interleaved defines and lookups across scopes using while-let.
361
fn testInterleaved(tab: *mut SymTab) -> i32 {
362
    init(tab);
363
    pushScope(tab);
364
365
    define(tab, "a", 100);
366
    define(tab, "b", 200);
367
368
    pushScope(tab);
369
    define(tab, "a", 111);
370
    define(tab, "c", 300);
371
372
    // Verify values with expected lookup results.
373
    let queries: [*[u8]; 4] = ["a", "b", "c", "d"];
374
    let expected: [?i32; 4] = [111, 200, 300, nil];
375
    let mut failures: u32 = 0;
376
377
    for name, i in queries {
378
        let result = lookup(tab, name);
379
        if let exp = expected[i] {
380
            // We expect a value.
381
            if let r = result {
382
                if r != exp {
383
                    failures += 1;
384
                }
385
            } else {
386
                failures += 1;
387
            }
388
        } else {
389
            // We expect nil.
390
            if let _ = result {
391
                failures += 1;
392
            }
393
        }
394
    }
395
396
    if failures != 0 {
397
        return failures as i32;
398
    }
399
400
    popScope(tab);
401
    popScope(tab);
402
    return 0;
403
}
404
405
@default fn main() -> i32 {
406
    let mut symbols: [Symbol; 256] = [Symbol { nameHash: 0, value: 0, depth: 0, next: NIL, shadow: NIL }; 256];
407
    let mut scopes: [ScopeMarker; 16] = [ScopeMarker { symbolCount: 0 }; 16];
408
    let mut buckets: [u32; 64] = [NIL; 64];
409
410
    let mut tab = SymTab {
411
        symbols: &mut symbols[..],
412
        symbolCount: 0,
413
        scopes: &mut scopes[..],
414
        scopeDepth: 0,
415
        buckets: &mut buckets[..],
416
    };
417
418
    let r1 = testBasic(&mut tab);
419
    if r1 != 0 {
420
        return 10 + r1;
421
    }
422
423
    let r2 = testShadowing(&mut tab);
424
    if r2 != 0 {
425
        return 20 + r2;
426
    }
427
428
    let r3 = testDeepNesting(&mut tab);
429
    if r3 != 0 {
430
        return 30 + r3;
431
    }
432
433
    let r4 = testMultipleSymbols(&mut tab);
434
    if r4 != 0 {
435
        return 40 + r4;
436
    }
437
438
    let r5 = testUpdate(&mut tab);
439
    if r5 != 0 {
440
        return 50 + r5;
441
    }
442
443
    let r6 = testScopeIsolation(&mut tab);
444
    if r6 != 0 {
445
        return 60 + r6;
446
    }
447
448
    let r7 = testInterleaved(&mut tab);
449
    if r7 != 0 {
450
        return 70 + r7;
451
    }
452
453
    return 0;
454
}