Go to the first, previous, next, last section, table of contents.


The modular structure of the system

A lexical scanner breaks the input rules up into tokens, which are handed over to a parser, which recognizers grammatical constructs. When the parser recognizes a grammatical construct is calls an action routine to attach the semantics (meaning) to the syntax (grammar). Action routines do such things as allocate space for declare variables and species. Check for duplicate identifier names. Open data input/output files. Translate rules into a simple pseudo-assembler. Once the syntax translation phase is completed with no errors. The pseudo-assembler is passed onto the interpreter. The interpreter actually runs the rules.

The main files in this system are...

  stlucia.rul  - Ecosystem rules. This is the biology bit.
  main.cc      - Opens files, handles options.
  lexscan.l    - Lexical scanner.
  lexyy.c      - produced automatically by flex from lexscan.l
  rule.y       - Grammar file.
  rule_tab.c   - Produced automatically by bison from rule.y
  rule_tab.h   - token name/number defines. Produced automatically from
                 rule.y by bison. Used by lexyy.c.
  semantic.cc  - The actions corresponding to recognised grammatical sections
                 are implemented here.
  datautils.cc - Data structure utilities.
  rules.h      - main header file. Declares all data structures that are
                 used by all modules.
  interp.cc    - The lexical scanner lexscan.l tokenises the input rules,
                 and hands it on to rule.y which parses the token stream.
                 semantic.cc compiles the actions into an intermediate
                 assembler like operations.
                 interp.cc interprets these simple operations.
  check.awk    - Little AWK utility to give min,ave and max of comma and
                 quote data files.
  grab.awk     - Snaffles the first comment out of program files for
                 inclusion into this texinfo file.
  grammar.awk  - Strips out the semantic actions from a BISON grammar
                 for inclusion into a texinfo file.
   

Go to the first, previous, next, last section, table of contents.