Lynus Vaz: Enhanced scripting language

Journal Week 1

23 May: Had a look at the current code in gPXE. Decided to start off with an arithmetic parser. Tried implementing a precedence parser, as described on wikipedia, and ended up with a rather large code. Stefan put together a much smaller recursive descent parser for addition/subtraction and multiplication/division, so I'll modify that tomorrow.

24 May: Modified the parser to include more operators: the usual C operators on integers with their precedence. It seems pretty small, around 3KB.

25 May: Just experimented with making the same stuff in bison. It comes to something like double the size. I'll see how it can be compressed. But for now, I think I'll leave it aside and continue with hand-written code.

26 May: Couldn't work much today: seem to have caught a cold.

27 May: I've pushed in my code instead of the variable expansion. I know that's not the right place for it, but it's just for testing. It does seem to work.

28 May: Instead of using the ${} to mark the expression, I've decided to use $() to delimit it. A good thing about this is that I can use gPXE to first expand variables, and then evaluate the expression. In such cases, I don't have to deal with variables. Unfortunately, since ')' can appear within an expression, I get things like '$(7*6))' evaluating to '42)'. Pushed the changes to my git repository: http://git.etherboot.org/?p=people/lynusvaz/gpxe.git;a=commit;h=85c7a684fa755fefb793024bc5c456d15b351160 under an expt branch.

29 May: Spent today cleaning up bugs in my code.


QR Code
QR Code soc:2009:lynusvaz:journal:week1 (generated for current page)