Hi, Vojtech, Vojtech Horky on 2012-08-05: > Hello, Sean. > > 2012/8/4 Sean Bartell <[email protected]>: > > Hello, everyone, > > > > I've implemented conditions and repetition in Bithenge[0]. There are > > more examples in the test files[1]. > Nice. I am still playing with my BMP script - with repetitions it > almost works but it would be very helpful to have some simple > expressions. At least comparisons and adding/multiplying with a > constant. > > I also started working on a GIF script (to try something more cryptic) > and I encountered a problem which I think is actually a bug. Below is > my minimal example: > > transform main = struct { > .kind <- uint8; > switch (.kind) { > 0: { }; > else: { > .str <- ascii <- known_length(.kind); > }; > } > }; > > I would say that such script is syntactically okay and semantically it > shall express: treat some values specifically (here only 0) and for > the rest just skip following .kind bytes. > > Running Bithenge with hex:00 works as expected and {"kind":0} is printed. > I would expect that for hex:0120, the output would be { "kind": 1, > "str": " "}. However, Bithenge prints {"kind": 1Error printing node: > No such file or directory. > But if the known_length(.kind) is changed to known_length(1), hex:0120 > works as expected. > > Ideas what could be wrong?
The problem was that the "0" and "else" have their own implicit structs, and you couldn't get to .kind in the "main" struct from within the "else" struct. I just fixed this by letting you access fields in outer structs; there's an example in test-repeat.bh. > Otherwise, good job. I like the simple syntax though sometimes I am a > bit confused where is the semicolon required and where it is > prohibited ;-). Whenever the syntax requires many independent items in sequence (definitions in a script, fields in a struct, cases in a switch), they must be terminated with semicolons. I plan to write more documentation during the "suggested pencils down" week. Thanks, Sean _______________________________________________ HelenOS-devel mailing list [email protected] http://lists.modry.cz/cgi-bin/listinfo/helenos-devel
