Awesome
This is a parser/scanner of DBC files
The application is useless on its own, but may be tweaked or embedded into any app to do real stuff. Originally the project was started to implement dbc parser that will become part of a wireshark plugin to dissect CAN traffic.
About DBC file format
DBC is a proprietary file format developed by Vector Informatik GmbH (c). Specification of the file format is not available to general public and thus reverse engineering is used to reconstruct its specification to some extent. CANdb++ Editor is used to verify a file to match specification.
DBC file format specification
Lexer rules
- Tokens are separated by delimiters: space, tab or new line;
- Delimiters are not enforced by the parser and thus are ignored;
- Text strings are enclosed into double quotes and may contain any other characters except for double quotes (e.g. text string may span several lines; side note: CANdb++ Editor is able to open dbc files with escaped double quotes
\"
but don't allow to edit or enter such strings in GUI); - There are reserved keywords:
VERSION
,NS_
,BS_
,BO_
,SG_
,CM_
, and etc.; - Identifier names are composed of Latin letters, digits and/or underscores; Names should not start with a digit and may not match a reserved keyword;
- Some symbols are passed to the parser as-is:
(
,)
,[
,]
,,
,:
,;
,|
,@
; - There are cases in which symbols
+
and-
are used as separate tokens (not a prefix of a number); - Standalone letter
M
orm
and following digits with optionalM
are passed as a separate token type, such sequence may appear as a special token or as an identifier; - Comments start with double slash and span until end of line and are ignored;