An analyzer for SPDH frame

佐手、 提交于 2019-12-25 00:34:23

问题


I must produce a parsing automat of SPDH protocol.

SPDH defines the structure of request and response messages exchanged between an electronic payment terminal and the server of the bank.

The specifications of this protocol are described in this document: http://www.trauco.com/docs/SPDH-specification_070212.pdf

I specified the following grammar for this protocol:

Frame           : = header fids etx ;

header          : = fields ;

fields          : = field fields | epsilon ;

field           : = string | number ;

fids            : = fid FieldSeparator fids | epsilon ;

fid             : = exp | subfids ;

exp             : = string | number| whitespace ;

subfids         : = exp RecordSeparator subfids |epsilon ;

whitespace      : = space whitespace | epsilon ;

space           : = ' ' ;

string          : = letter string | digits string | '-' string | period string |epsilon ;

FieldSeparator  : = period | epsilon ;

RecordSeparator : = '!'| epsilon    ;

number          : = digits number | epsilon    ;

digits          : = '0'|'1'|...|'8'| '9'    ;

letter          : = 'a'|...|'z'|'A'|...|'Z'    ;

period          : = '.'              ;

etx             : = 'ETX'| epsilon  ;

I need some help to conceive my application and to implement my grammar.


回答1:


  • Have you really specified the grammar?
  • What is the target platform?
  • What are the tools you are using?
  • Are you familiar with parser generators a.k.a compiler-compilers



回答2:


Because I won't create a compiler. I have just to break up the frame into fields. I have in second step to save all fields in a data base.




回答3:


Try creating a state diagram of the frame. Maybe the first time you wown't get it right but this way you will get a better understanding of the frame strucuture.

I would give you a hand but the link provided is not accessible for me. Please email the file or send an alternative link.



来源:https://stackoverflow.com/questions/601746/an-analyzer-for-spdh-frame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!