-
Notifications
You must be signed in to change notification settings - Fork 65
New Grammar
tmolteno edited this page Oct 21, 2014
·
1 revision
The old grammar for NEC2 was designed with punch cards in mind. This has some problems. The most significant is that blank fields are difficult to specify, and defaults can sometimes be zeros, othertimes left out. In addition the parser, originally written in FORTRAN does not report good errors.
Two projects are under way. The files for these are in the antlr directory.
- A drop-in replacement parser for the existing card-based grammar. File nec.g
- New simulation language. File electro.g
This is in beta development. The grammar is written in the [http://www.antlr.org/ ANTLR] language.
This is in very early stages. The language will allow C-style comments, and named arguments for the simulation functions. An example of the new language is below
g = geometry();
w0 = g.wire(start=[1,2,3], end=[2,3,4], r=0.01, n=5);
w1 = g.wire(start=w0.end, end=[2,3,5], r=0.01, n=5);
g.arc(origin=[0,1,2], arc_radius=1.0, r=0.01 );
g.helix();
g.patch();
g.scale(3.0);
g.ground();
e = excitation(type=VOLTAGE, wire=w0, segment=3, freq=range(start=1.575GHz, end=1.675GHz, n=5));
e.extended_thin_wire_kernel = false; /* default */
execute();
theta = range(start=0.0, end=180, n=30);
phi = range(start=0.0, end=90, n=30);
/* Returns an array of radiation patterns */
radiation_pattern(mode="normal", theta=th, phi=ph);