From: Vladimir Serbinenko <phcoder@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [Patch] Scripting engine
Date: Sun, 25 Sep 2005 13:40:36 +0200 [thread overview]
Message-ID: <43368CB4.6050806@gmail.com> (raw)
In-Reply-To: <200508281455.32569.okuji@enbug.org>
Unfortunately I haven't had a lot of time to work with GRUB2. I'll have
some more when my holidays begin in mid October.
Yoshinori K. Okuji wrote:
>
>I'd like to see a kind of "design document", since it is a bit hard for others
>to understand.
>
>
Ok. I send one with this mail. Perhaps it would be good to add a folder for
developpement docs and standartisize the format. What about /devdocs and
html?
>We must wait until your assignment is finished. How is it going?
>
>
>
It's strange. It's already a month that I sent my assignment and I've
still nothing received.
Vladimir
------------------------------------------------------------------
The scripting engine is separated into 2 parts: parser and executer.
Parser is wirtten with bison using hand-written yylex. It transforms one
command into grub_script_commandlist. This structure represents a chain
of commands in the form of linked list. Every single command is
represented by grub_script_command. Which has the following fields:
enum grub_script_command_type type
which indicates what command it is:
GRUB_SCRIPT_COMMAND_NORMAL - just a non-scripting command
GRUB_SCRIPT_COMMAND_FORIN - used for for..in..
GRUB_SCRIPT_COMMAND_LOOKUP - used for block-end keyword like done, fi
indicating to interpreter to relaunch or end the loop
enum grub_script_command_chain
which indicates how this command is linked with previous: independent,
with && or with ||.
flags: command flags. Now only GRUB_SCRIPT_COMMAND_FLAG_NOT (command was
with !) is defined.
non-scripting command:
struct grub_script_superchars *normal - a non-scripting command to execute.
for...in:
struct grub_script_superchars *var - a variable to set
struct grub_script_superchars *vals - the values to set to var
struct grub_script_commandlist *lookup - where the end of loop is.
grub_script_sueprchar is used to store the strings. char * is
unappropriated because value of the string is unknown at parsing time.
it's separated in chunks which are represented in linked list. There are
4 types of chunks: plain (just a string), variable ($var), arithmethic
($((expression))) and command (`cmd` or $(cmd)) to transform to char*
superchartostring is used.
grub_script_superchars is used to store array of strings like command
with arguments a variable list. supercharstostrings is used to transform
to char**
terminal tokens:
ENTER: '\n'
FOR: "for" keyword
SEMICOLON: ';'
IN: "in" keyword
DO: "do" keyword
DONE: "done" keyword
NOP: not used
WORD: any word, that is not a keyword. Represented like superchars
OR: "||" keyword
AND: "&&" keyword
NOT: '!' keyword
other symbols
out: output
commandlist : list of commands
arglist : list of words (like not scripting command with arguments or
vallist for for..in)
command :
execlist : list of inter-linked (by || or &&) commands
pre_command : solitary command that waits for ||, &&, ; or newline
cmdend: end of execlist (; or newline)
I hope that this small design document will help. All propositions and
questions are welcome.
next prev parent reply other threads:[~2005-09-25 11:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-14 9:18 [DISCUSSION] Scripts and menus Vladimir Serbinenko
2005-08-14 13:29 ` Douglas Wade Needham
2005-08-14 13:53 ` Vladimir Serbinenko
2005-08-14 15:12 ` Yoshinori K. Okuji
2005-08-14 22:54 ` Douglas Wade Needham
2005-08-14 23:09 ` Yoshinori K. Okuji
2005-08-15 7:27 ` [DISCUSSION] Grub2 Improvements marm.mm
2005-08-15 8:37 ` Yoshinori K. Okuji
2005-08-14 14:35 ` [DISCUSSION] Scripts and menus Yoshinori K. Okuji
2005-08-14 16:03 ` Vladimir Serbinenko
2005-08-14 18:01 ` Yoshinori K. Okuji
2005-08-14 18:30 ` Vladimir Serbinenko
2005-08-15 17:37 ` Marco Gerards
2005-08-24 9:36 ` [Patch] Scripting engine Vladimir Serbinenko
2005-08-28 12:55 ` Yoshinori K. Okuji
2005-08-28 14:11 ` Vladimir Serbinenko
2005-09-25 11:40 ` Vladimir Serbinenko [this message]
2005-08-31 19:22 ` Marco Gerards
2005-09-04 13:23 ` Vladimir Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43368CB4.6050806@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox