File ChangingCfg.html    Author McKeeman    Copyright © 2007    index

Changing the Cfg Object

Preliminaries

Type

>> help Cfg       % one page help for Cfg
>> load cfg cfg   % fetch the precomputed X Cfg object into variable cfg.
>> cfg            % see the public fields and methods of Cfg
>> cfg.dump()     % see some of the information in Cfg

Read about context-free grammars.
Read about context-free grammar implementation.

Typically the file Cfg.m does not have to be changed to make a small change to X. Think twice before you do anything to it.

The Input Format

The "everyday cfg" format was chose primarily to avoid complicated processing of the text of CFGs.

Adding a new Class Symbols

Symbols id, integer and real are not reserved words. They represent classes of symbols, with each symbol containing more information (its text). Neither is eof reserved, it is just unprintable. One might want to add yet another such symbol (say string). It will have to be added to the "special" list in Cfg.m.

Running the Cfg table builder for xcom

The Cfg module supports two parsing methods; top-down and bottom-up. You will read more about them later. At the moment the concern is that the bottom-up support takes time. If you are not going to use the bottom-up tables (usual case), then you can get the simpler top-down only tables. Try

>> makeCfg -noLR X.cfg
to check for cfg errors. Usually there will be none. You can look at the results by calling the Cfg method directly
>> help Cfg                       % for list of flags
>> c = Cfg(xread('X.cfg'), flag), % for the some flag (e.g. '-shiftDump')
>> c                              % just to see what Cfg makes
When you want to change the MAT file that xcom will access, try
>> makeCfg -saveMat -noLR X.cfg