[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Line lexer...
Hi all. I've been using SableCC for quite some time now. Now I'm facing a project where I need to process lines of data that represent transactions in very fixed formats (spaces are showed only for simplicity):
FI 0001a 0104abcde 0209123456789 0302aa SE 0002ab
where FI(RST), SE(COND) are headers of so called segments, and fields are marked as 00-01, 00 is the 'id' of the field and 01 is the lenght of the segment, a is the data. So it follows that in 0209123456789, 02 is the 'id', 09 is the length and
123456789 the data, etc.
Next, I have that segments represent data/operations and there are some constraints on how they can be structured, the same applies to fields (that have real names, numbers are just codes).
We have processors from plain C to annotated Java with fancy filters and so on, but all are hard coded monsters that you'll hate to meet. I want something simpler and higher level, ¿would you recommend me to implement a scanner for the line oriented thing? I started to change Lexer class to an interface, etc. you know the story, but I also want to evaluate speed and memory issues (millions of transactions you know). Then I stopped and wanted to know your opinion.
Maybe next step is XML migration but thats why I want to get a real parser involved :) Or maybe this is overkill for such a dumb format and I must settle for good old C.
Thank you and good luck with SableCC 4 I really want to play with it >.<
Javier Abdul Córdoba Gándara
Buró de Crédito
Sistemas - Desarrollo
Tel. 54494900 Ext. 5935
El presente mensaje es confidencial, dirigido únicamente para el destinatario.
Si usted no es el destinatario, no deberá copiarlo, revelarlo o distribuirlo.
Cualquier acción realizada en este sentido, será ilegal. Si por error recibe el
presente mensaje, por favor notifique al remitente.
This communication is confidential and intended only for the addressee. If you
are not the intended recipient, you may not copy, disclose, or distribute this
message to anyone else; any such actions may be unlawful. If you have received
this communication in error, please contact the sender of the message to inform
him or her of the error.