grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Grammatica-users] Parsing fixed format


From: Jonas Forssell
Subject: [Grammatica-users] Parsing fixed format
Date: Tue, 28 Mar 2006 20:49:20 +0200 (CEST)

I'm a complete beginner to Grammatica so forgive me if this is a FAQ.

How do I formulate a grammar to parse a file in fixed 8 character format?

Here is an example from a nastran file:

*****************************************************************

$ NASTRAN input file created by the MSC MSC.Nastran input file
$ translator ( MSC.Patran 13.0.053 ) on March     26, 2006 at 15:11:01.
$ Direct Text Input for Nastran System Cell Section
$ Direct Text Input for File Management Section
$ Linear Static Analysis, Database
SOL 101
$ Direct Text Input for Executive Control
CEND
SEALL = ALL
SUPER = ALL
TITLE = MSC.Nastran job created on 26-Mar-06 at 09:06:04
ECHO = NONE
$ Direct Text Input for Global Case Control Data
SUBCASE 1
$ Subcase name : Default
   SUBTITLE=Default
   SPC = 2
   LOAD = 2
   DISPLACEMENT(SORT1,REAL)=ALL
   SPCFORCES(SORT1,REAL)=ALL
   STRESS(SORT1,REAL,VONMISES,BILIN)=ALL
BEGIN BULK
PARAM    POST    0
PARAM    AUTOSPC YES
PARAM   PRTMAXIM YES
$ Direct Text Input for Bulk Data
$ Elements and Element Properties for region : p_steel
PSHELL   1       1      10.      1               1
$ Pset: "p_steel" will be imported as: "pshell.1"
CTRIA3   1       1       13      12      1
CTRIA3   2       1       1       2       13
CTRIA3   3       1       2       3       13
CTRIA3   4       1       14      13      3
CTRIA3   5       1       15      14      3
CTRIA3   6       1       3       4       15
CTRIA3   7       1       4       5       15
CTRIA3   8       1       16      15      5
CTRIA3   9       1       17      16      5
CTRIA3   10      1       5       6       17
$ Elements and Element Properties for region : p_rf_steel
PSHELL   2       2      10.      2               2
$ Pset: "p_rf_steel" will be imported as: "pshell.2"
CTRIA3   11      2       6       7       17
CTRIA3   12      2       18      17      7
CTRIA3   13      2       19      18      7
CTRIA3   14      2       7       8       19
CTRIA3   15      2       8       9       19
CTRIA3   16      2       20      19      9
CTRIA3   17      2       21      20      9
CTRIA3   18      2       9       10      21
CTRIA3   19      2       10      11      21
CTRIA3   20      2       22      21      11
$ Referenced Material Records
$ Material Record : steel
$ Description of Material : Date: 26-Mar-06           Time: 08:38:38
MAT1     1      210000.         .3      7.8E-6
$ Material Record : rf_steel
$ Description of Material : Date: 26-Mar-06           Time: 11:36:33
MAT1     2      190000.         .3      8.E-6
$ Nodes of the Entire Model
GRID     1               0.      0.     10.
GRID     2              10.      0.     10.
GRID     3              20.      0.     10.
GRID     4              30.      0.     10.
GRID     5              40.      0.     10.
GRID     6              50.      0.     10.
GRID     7              60.      0.     10.
GRID     8              70.      0.     10.
GRID     9              80.      0.     10.
GRID     10             90.      0.     10.
GRID     11             100.     0.     10.
GRID     12              0.      0.      0.
GRID     13             10.      0.      0.
GRID     14             20.      0.      0.
GRID     15             30.      0.      0.
GRID     16             40.      0.      0.
GRID     17             50.      0.      0.
GRID     18             60.      0.      0.
GRID     19             70.      0.      0.
GRID     20             80.      0.      0.
GRID     21             90.      0.      0.
GRID     22             100.     0.      0.
$ Loads for Load Case : Default
SPCADD   2       1
LOAD     2      1.      1.       1
$ Displacement Constraints of Load Set : indsp
SPC1     1       123456  1       12
$ Nodal Forces of Load Set : last
FORCE    1       11      0      50.      0.     -1.      0.
FORCE    1       22      0      50.      0.     -1.      0.
$ Referenced Coordinate Frames
ENDDATA 929a5961

***********************************************************

Thanks
/Jonas Forssell, Gothenburg, Sweden


reply via email to

[Prev in Thread] Current Thread [Next in Thread]