Hi ,
any one can help me code for how to parse the below file.

-*: M V3.1SP0010*20140925
#-+: 131854
# PROLIM Package V20.02
{
    FILE = "54377948";
    COMM = "U:fe
"S;
    {
    COMM = "FE_slt"S;
    SEQ = "FE_crt";
    SEQID = "FE_slt";
    MEMO = " "S;
    SA = HEAD;  PORI = HS;  TC = C:WB;  RC = C:WB;
    TR = 50;    FAT = 0;    THK = 8;    GAP = 0;
    MTX = 256x256;  FOV = 25.6x25.6;        TS = 1;
    NAQ = 1;    PLN = AX;   PD = RL;    FLIP = 90;
    SPSAT = 0;  ITRL = 1;   ACQ = 1;    AFI = 0;
    KFLT = 2007;    RFLT = 1003;    ROPRC = 110000; PEPRC = 110000;
    SEPRC = 000000; PDATAF = 0; VDIR = 1;   PVOICE = 0;
    MIP = 0,1000,-1;        MIPB = 0,0,0;   MIPANG = 0;
    MIPSL = 1;  MAXP = 3;   COV = 1;    SKIP = 0;
    HOLD = 1;   GTAG = 0;   RECON = 1;  SCMD = 0;
    SPEED = 0;  MTC = 0;    COUCH = 0;  PREP = 0;
    BVAL = 0;   RFSPOIL = 1;    SPDR = 0;   SPDRR = 2,1,1;
    MAXPCOV = 128;  PEORDER = 0;    SPDRT = 0;  INTCORF = 0;
    INTCORR = 1;    SPDRRI = 2,1,1; FATTYPE = 0;    APOST = 0;
    SPLITM = 0; DRKS = 0;   GDCFLG = 0; ALTFLG = 0;
    RMC = 0;    LCFFLG = 0; FCMP = 0;   WEFLG = 0;
    TRIGT = 0;  FLEXTE = 0.005; BW = 244;   NRFLG = 0;
    NRSET = 786433; GOPFLT = 720901;        KFLTNR = 131080;
    MIPFLT = 1; MIPGOP = -1;    ATDSET = 983041;
    ATDFLT = 917505;        KFLTATD = 131080;
    MIPATDFLT = 1;  MIPATD = -1;    GDC = 1;    GDCDIMR = 2;
    GDCIMG = 1; GDCMASK = 0;    SOFFSET = 0;    PASTA = 0;
    INTCORV1 = 0;   INTCORV2 = 0;   GINTRFLG = 0;   RGNCORFLG = 0;
    PRSRC = "QD Whole Body";
    PHCORPRES = 0;  KTRAJECT = 0;   DEGENEFLG = 0;  DECOMT = 0;
    NUMREP = 1; FSBBBVAL = 0;   BDYPART = "HEAD";
    AVRMODE = 1;    IFLAG = 0;  RMCR = 0,0,0.6; STAMDMODE = 0;
    STAMDSL = 2;    STAMDSHFT = 1;  CMFLG = -1; FHTAGTYPE = 0;
    CFCTRL = 0; NSDEOPT = 0;    EMTFLG = 0; EMTFLT = 851969;
    INTCORSTS = 0;  INTCORRX = 1;   INTCORTX = 1;   MPNAXIS = 0;
    CALAINVOKEMODE = 0;     CALAPLANNEDSTATUS = 0;
    HALAINVOKEMOD = 0;      HALAPLANNEDSTATUS = 0;
    SALAINVOKEMOD = 0;      SALAPLANNEDSTATUS = 0;
    AUTOINSM = 0;   AUTOINSA = 0;   CFCTRLCOV = 0;  PIXNORMOD = 2;
    AFISERATIO = 1; AFISEFLTRR = 100;       GAIN = 0.01;
    AUTOIMGSHIFTCOR = 0;        GVSR = 1;   RGNOPT = 0;
    PRESCNSKIP = 2; SLREODR = 0;    NOREFRIG = 0;   AMIPLOC = 0;
    WFS = 0;    DFFSN = 0,0,0,0,0,0;        SECRC = 1,[65,32,0,0,67];
    RCSHOWLIST = 1,[65,32,0,67,0,0,0];      WRAP = 0;
    WRAPR = 1,1,1;  WRAPRI = 1,1,1; RCCORDLIST = 1,[65,32,0];
    VG = 1,[0,0,0],[0,0,1],[1,0,0];
    VGI = 0;
    CALAORINID = 0;
    }
    {
    COMM = "SE_EPI100+0.8"S;
    SEQ = "SE_EPI100+0.8_trape";
    SEQID = "SE_EPI100+0.8";
    MEMO = " "S;
    SA = HEAD;  PORI = HS;  TC = C:WB;  RC = C:WB;
    TR = 2000;  FAT = 0;    INV = 0;    NEFS = 1;
    THK = 5;    GAP = 0;    MTX = 128x128;  FOV = 25x26;
    TS = 3;     NAQ = 1;    PLN = SG;   PD = AP;
    FLIP = 90;  FLOP = 180; SPSAT = 0;  ITRL = 1;
    ACQ = 1;    AFI = 0;    KFLT = 2007;    RFLT = 1003;
    ROPRC = 110000; PEPRC = 110000; SEPRC = 000000; PDATAF = 0;
    VDIR = 1;   PVOICE = 0; MIP = 0,1000,-1;
    MIPB = 0,0,0;   MIPANG = 0; MIPSL = 1;  SSMODE = 0;
    MAXP = 11;  COV = 1;    SKIP = 0;   HOLD = 0;
    GTAG = 0;   RECON = 1;  SCMD = 0;   SPEED = 0;
    MTC = 0;    COUCH = 0;  PREP = 0;   BB = 0;
    PRECP = 0;  BVAL = 1;   NBARRAY = 1;    BARRAY = 1,1;
    IMGPTN = 0; T2PLUS = 0; RFSPOIL = 0;    SPDR = 0;
    SPDRR = 2,1,1;  MAXPCOV = 64;   PEORDER = 0;    SPDRT = 0;
    INTCORF = 0;    INTCORR = 1;    SPDRRI = 2,1,1; FATTYPE = 0;
    ECHOF = 92; APOST = 0;  SPLITM = 0; DRKS = 0;
    GDCFLG = 0; ALTFLG = 0; RMC = 0;    FCMP = 0;
    WEFLG = 0;  TRIGT = 0;  NRFLG = 0;  NRSET = 786433;
    GOPFLT = 720901;        KFLTNR = 131080;
    MIPFLT = 1; MIPGOP = -1;    ATDSET = 983041;
    ATDFLT = 917505;        KFLTATD = 131080;
    MIPATDFLT = 1;  MIPATD = -1;    GDC = 1;    GDCDIMR = 2;
    GDCIMG = 0; GDCMASK = 0;    SOFFSET = 0;    PASTA = 0;
    INTCORV1 = 0;   INTCORV2 = 0;   GINTRFLG = 0;   RGNCORFLG = 1;
    PRSRC = "QD Whole Body";
    PHCORPRES = 0;  KTRAJECT = 0;   DEGENEFLG = 0;  DECOMT = 0;
    NUMREP = 1; BDYPART = "HEAD";
    NUMRFE = 1; AVRMODE = 1;    IFLAG = 4;
    IPREFID = "DWI_C25C1F50-1F42-4D30-8C3D-4C8DEB6FD6EA"S;
    RMCR = 0,0,0.6; STAMDMODE = 0;  STAMDSL = 2;    STAMDSHFT = 1;
    CMFLG = -1; BVSET = 1;  BVPRESET = 0;   BNAQ = 1,1;
    FHTAGTYPE = 0;  CFCTRL = 0; NSDEOPT = 0;    GRESP = 0.00076;
    FSECOMTD = 0;   EMTFLG = 0; EMTFLT = 851969;
    INTCORSTS = 0;  INTCORRX = 1;   INTCORTX = 1;   MPNAXIS = 3;
    CALAINVOKEMODE = 0;     CALAPLANNEDSTATUS = 0;
    HALAINVOKEMOD = 0;      HALAPLANNEDSTATUS = 0;
    SALAINVOKEMOD = 0;      SALAPLANNEDSTATUS = 0;
    AUTOINSM = 0;   AUTOINSA = 0;   CFCTRLCOV = 0;  PIXNORMOD = 2;
    RGNCORVAL = 0;  AFISERATIO = 1; AFISEFLTRR = 100;
    GAIN = 0.005;   PRECONTTE = 0;  AUTOIMGSHIFTCOR = 0;
    GVSR = 1;   RGNOPT = 0; PRESCNSKIP = 2; SLREODR = 0;
    NOREFRIG = 0;   AMIPLOC = 0;    WFS = 0;    DFFSN = 0,0,0,0,0,0;
    SECRC = 1,[65,32,0,0,67];   RCSHOWLIST = 1,[65,32,0,67,0,0,0];
    WRAP = 0;   WRAPR = 1,1,1;  WRAPRI = 1,1,1;
    RCCORDLIST = 1,[65,32,0];   VG = 3,[0,0,0],[1,0,0],[0,1,0];
    VGI = 0;
    CALAORINID = 0;
    }
    {
    COMM = "FE_slt"S;
    SEQ = "FE_crt";
    SEQID = "FE_slt";
    MEMO = " "S;
    SA = HEAD;  PORI = HS;  TC = C:WB;  RC = C:WB;
    TR = 50;    FAT = 0;    THK = 8;    GAP = 0;
    MTX = 256x256;  FOV = 25.6x25.6;        TS = 1;
    NAQ = 1;    PLN = AX;   PD = RL;    FLIP = 90;
    SPSAT = 0;  ITRL = 1;   ACQ = 1;    AFI = 0;
    KFLT = 2007;    RFLT = 1003;    ROPRC = 110000; PEPRC = 110000;
    SEPRC = 000000; PDATAF = 0; VDIR = 1;   PVOICE = 0;
    MIP = 0,1000,-1;        MIPB = 0,0,0;   MIPANG = 0;
    MIPSL = 1;  MAXP = 3;   COV = 1;    SKIP = 0;
    HOLD = 1;   GTAG = 0;   RECON = 1;  SCMD = 0;
    SPEED = 0;  MTC = 0;    COUCH = 0;  PREP = 0;
    BVAL = 0;   RFSPOIL = 1;    SPDR = 0;   SPDRR = 2,1,1;
    MAXPCOV = 128;  PEORDER = 0;    SPDRT = 0;  INTCORF = 0;
    INTCORR = 1;    SPDRRI = 2,1,1; FATTYPE = 0;    APOST = 0;
    SPLITM = 0; DRKS = 0;   GDCFLG = 0; ALTFLG = 0;
    RMC = 0;    LCFFLG = 0; FCMP = 0;   WEFLG = 0;
    TRIGT = 0;  FLEXTE = 0.005; BW = 244;   NRFLG = 0;
    NRSET = 786433; GOPFLT = 720901;        KFLTNR = 131080;
    MIPFLT = 1; MIPGOP = -1;    ATDSET = 983041;
    ATDFLT = 917505;        KFLTATD = 131080;
    MIPATDFLT = 1;  MIPATD = -1;    GDC = 1;    GDCDIMR = 2;
    GDCIMG = 1; GDCMASK = 0;    SOFFSET = 0;    PASTA = 0;
    INTCORV1 = 0;   INTCORV2 = 0;   GINTRFLG = 0;   RGNCORFLG = 0;
    PRSRC = "QD Whole Body";
    PHCORPRES = 0;  KTRAJECT = 0;   DEGENEFLG = 0;  DECOMT = 0;
    NUMREP = 1; FSBBBVAL = 0;   BDYPART = "HEAD";
    AVRMODE = 1;    IFLAG = 0;  RMCR = 0,0,0.6; STAMDMODE = 0;
    STAMDSL = 2;    STAMDSHFT = 1;  CMFLG = -1; FHTAGTYPE = 0;
    CFCTRL = 0; NSDEOPT = 0;    EMTFLG = 0; EMTFLT = 851969;
    INTCORSTS = 0;  INTCORRX = 1;   INTCORTX = 1;   MPNAXIS = 0;
    CALAINVOKEMODE = 0;     CALAPLANNEDSTATUS = 0;
    HALAINVOKEMOD = 0;      HALAPLANNEDSTATUS = 0;
    SALAINVOKEMOD = 0;      SALAPLANNEDSTATUS = 0;
    AUTOINSM = 0;   AUTOINSA = 0;   CFCTRLCOV = 0;  PIXNORMOD = 2;
    AFISERATIO = 1; AFISEFLTRR = 100;       MAXCCHM = -1;
    GAIN = 0.01;    AUTOIMGSHIFTCOR = 0;        GVSR = 1;
    RGNOPT = 0; PRESCNSKIP = 2; SLREODR = 0;    NOREFRIG = 0;
    AMIPLOC = 0;    WFS = 0;    DFFSN = 0,0,0,0,0,0;
    SECRC = 1,[65,32,0,0,67];   RCSHOWLIST = 1,[65,32,0,67,0,0,0];
    WRAP = 0;   WRAPR = 1,1,1;  WRAPRI = 1,1,1;
    RCCORDLIST = 1,[65,32,0];   VG = 1,[0,0,0],[0,0,1],[1,0,0];
    VGI = 0;
    CALAORINID = 0;
    }
}
{
    FILE = "5440edf5";
    COMM = "U:abc
"S;
    {
    COMM = "FE_slt"S;
    SEQ = "FE_crt";
    SEQID = "FE_slt";
    MEMO = " "S;
    SA = HEAD;  PORI = HS;  TC = C:WB;  RC = C:WB;
    TR = 50;    FAT = 0;    THK = 8;    GAP = 0;
    MTX = 256x256;  FOV = 25.6x25.6;        TS = 1;
    NAQ = 1;    PLN = AX;   PD = RL;    FLIP = 90;
    SPSAT = 0;  ITRL = 1;   ACQ = 1;    AFI = 0;
    KFLT = 2007;    RFLT = 1003;    ROPRC = 110000; PEPRC = 110000;
    SEPRC = 000000; PDATAF = 0; VDIR = 1;   PVOICE = 0;
    MIP = 0,1000,-1;        MIPB = 0,0,0;   MIPANG = 0;
    MIPSL = 1;  MAXP = 3;   COV = 1;    SKIP = 0;
    HOLD = 1;   GTAG = 0;   RECON = 1;  SCMD = 0;
    SPEED = 0;  MTC = 0;    COUCH = 0;  PREP = 0;
    BVAL = 0;   RFSPOIL = 1;    SPDR = 0;   SPDRR = 2,1,1;
    MAXPCOV = 128;  PEORDER = 0;    SPDRT = 0;  INTCORF = 0;
    INTCORR = 1;    SPDRRI = 2,1,1; FATTYPE = 0;    APOST = 0;
    SPLITM = 0; DRKS = 0;   GDCFLG = 0; ALTFLG = 0;
    RMC = 0;    LCFFLG = 0; FCMP = 0;   WEFLG = 0;
    TRIGT = 0;  FLEXTE = 0.005; BW = 244;   NRFLG = 0;
    NRSET = 786433; GOPFLT = 720901;        KFLTNR = 131080;
    MIPFLT = 1; MIPGOP = -1;    ATDSET = 983041;
    ATDFLT = 917505;        KFLTATD = 131080;
    MIPATDFLT = 1;  MIPATD = -1;    GDC = 1;    GDCDIMR = 2;
    GDCIMG = 1; GDCMASK = 0;    SOFFSET = 0;    PASTA = 0;
    INTCORV1 = 0;   INTCORV2 = 0;   GINTRFLG = 0;   RGNCORFLG = 0;
    PRSRC = "QD Whole Body";
    PHCORPRES = 0;  KTRAJECT = 0;   DEGENEFLG = 0;  DECOMT = 0;
    NUMREP = 1; FSBBBVAL = 0;   BDYPART = "HEAD";
    AVRMODE = 1;    IFLAG = 0;  RMCR = 0,0,0.6; STAMDMODE = 0;
    STAMDSL = 2;    STAMDSHFT = 1;  CMFLG = -1; FHTAGTYPE = 0;
    CFCTRL = 0; NSDEOPT = 0;    EMTFLG = 0; EMTFLT = 851969;
    INTCORSTS = 0;  INTCORRX = 1;   INTCORTX = 1;   MPNAXIS = 0;
    CALAINVOKEMODE = 0;     CALAPLANNEDSTATUS = 0;
    HALAINVOKEMOD = 0;      HALAPLANNEDSTATUS = 0;
    SALAINVOKEMOD = 0;      SALAPLANNEDSTATUS = 0;
    AUTOINSM = 0;   AUTOINSA = 0;   CFCTRLCOV = 0;  PIXNORMOD = 2;
    GRPID = 0;  AFISERATIO = 1; AFISEFLTRR = 100;
    MAXCCHM = -1;   GAIN = 0.01;    AUTOIMGSHIFTCOR = 0;
    GVSR = 1;   RGNOPT = 0; PRESCNSKIP = 2; SLREODR = 0;
    NOREFRIG = 0;   AMIPLOC = 0;    WFS = 0;    DFFSN = 0,0,0,0,0,0;
    SECRC = 1,[65,32,0,0,67];   RCSHOWLIST = 1,[65,32,0,67,0,0,0];
    WRAP = 0;   WRAPR = 1,1,1;  WRAPRI = 1,1,1;
    RCCORDLIST = 1,[65,32,0];   VG = 1,[0,0,0],[0,0,1],[1,0,0];
    VGI = 0;
    CALAORINID = 0;
    }
}

What are you supposed to do with the data when you get it? What part of reading in from the file is giving you a problem?

This looks like a very simple grammar would do the job. Unfortunately, generating a parser from a grammar will only give you strings, you need to interpret that data individually and that requires knowledge of what this data means. For example, what is the difference between a string that has a trailing S and one that does not?

PRSRC = "QD Whole Body"; vs. COMM = "SE_EPI100+0.8"S;

What is the difference between enclosed lists and open lists?

RCCORDLIST = 1,[65,32,0]; vs. WRAPR = 1,1,1;

These are details that will take the most time and are independent of how you actually parse the file.

This article has been dead for over six months. Start a new discussion instead.