mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-09 16:28:47 +00:00
Fixed bug in parser; perhaps we need to scrap Ostap and go back to Yacc
This commit is contained in:
parent
59a7d48568
commit
f4467ec540
2 changed files with 37 additions and 9 deletions
|
|
@ -59,7 +59,7 @@ fun insert (m, k, v) {
|
|||
esac
|
||||
}
|
||||
|
||||
return inner (m, k, v).snd
|
||||
return m.inner (k, v).snd
|
||||
}
|
||||
|
||||
fun find (m, k) {
|
||||
|
|
@ -110,15 +110,32 @@ fun validate (t) {
|
|||
fi
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
inner (t, fun (x) {return true})
|
||||
}
|
||||
|
||||
local tree = {}, i;
|
||||
|
||||
for i := 1, i <= 100, i := i+1 do
|
||||
for i := 100, i >= 1, i := i-1 do
|
||||
validate (tree);
|
||||
tree := insert (tree, i, i);
|
||||
printf ("Inserting: %s\n", i.string);
|
||||
printf ("Result : %s\n", tree.string)
|
||||
od
|
||||
od;
|
||||
|
||||
tree := {};
|
||||
|
||||
for i := 1, i <= 100, i := i+2 do
|
||||
validate (tree);
|
||||
tree := insert (tree, i, i);
|
||||
printf ("Inserting: %s\n", i.string);
|
||||
printf ("Result : %s\n", tree.string)
|
||||
od;
|
||||
|
||||
for i := 2, i <= 100, i := i+2 do
|
||||
validate (tree);
|
||||
tree := insert (tree, i, i);
|
||||
printf ("Inserting: %s\n", i.string);
|
||||
printf ("Result : %s\n", tree.string)
|
||||
od
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue