grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On GRUB script lexer rewrite using flex


From: BVK Chaitanya
Subject: On GRUB script lexer rewrite using flex
Date: Sun, 20 Dec 2009 18:20:46 +0530

Hi,


I was working on rewriting GRUB script lexer using Flex from last
couple of weeks, and this work is now complete.  Changes for this are
available in grub-script branch here
http://bzr.savannah.gnu.org/r/grub/people/bvk/  The same is attached
as a patch with this mail.

This branch also includes code from my unit-testing branch, that has
unit testing framework and some GRUB script unit tests, which also
need reviewing.

Three important points to note are:

1. Flex generated lexer always hard-codes libc headers (stdio.h,
string.h, etc) which are not available for GRUB environment.  To get
around this, I am removing the #include lines from the Flex output
files, using make rules.  (See common.rmk and any-emu.rmk)

2. Another Flex problem is, Flex generated files use FILE*, errno,
etc. libc features, which are again not available for GRUB.  I used
some pre-processor hacks to get around these items.  (See %top section
in yylex.l)

3. Lexer generated using Flex is now 30KB in size and makes sh.mod to
46KB.  Our existing, hand-coded lexer is only of 5KB (and sh.mod is
15KB).


Let me know your comments.


thanks,
-- 
bvk.chaitanya

Attachment: lexer-rewrite.patch.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]