Am Montag, 18. August 2014, 10:46:57 schrieb Michael Davidsaver:
> One of changes I'm considering (after the linking/locking work) is to
> re-write the DBD file parser.
>
> The idea would be to parse into an intermediate structure which would be
> more general than dbStatic. This would define points in the syntax for
> future expansion, and avoid some of the chicken and egg problems of the
> present code.
This reminds me of the following idea I had some years ago, which might be
similar or not to what you have in mind.
The db/dbd syntax can be generalized to a very simple syntax that basically
recognizes one kind of item:
item ::= keyword "(" arg "," ... ")" [ "{" item ... "}" ]
(where 'arg' is defined by the lexical syntax as a quoted or unquoted string,
and 'keyword' is a sequence of lower case letters). A lookup-table defines the
mapping of keywords to functions of type
void parse_item(database *db, arg_list *args, item_list *items);
This function then checks that the number and types of its arguments and sub-
items are correct, produces the final output and adds it to the database.
I am fully aware that there are many details missing in this picture, this is
merely a rough sketch of the idea, not a full design spec.
The main point is that the syntax is now easily extensible by adding a new
keyword and the corresponding function in the table. Unknown keywords
(together with the item they introduce) are ignored (or optionally give
warning), so that future extensions never break existing parsers.
Cheers
Ben Attachment:
signature.asc
Description: This is a digitally signed message part.
- Replies:
- Re: Array data in db files? Michael Davidsaver
- References:
- Array data in db files? Ralph Lange
- Re: Array data in db files? Michael Davidsaver
- Navigate by Date:
- Prev:
Re: Array data in db files? Michael Davidsaver
- Next:
Re: ePID deadband on output Benjamin Franksen
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Array data in db files? Michael Davidsaver
- Next:
Re: Array data in db files? Michael Davidsaver
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|