Language Specification - WORK IN PROGRESS
Parser - WORK IN PROGRESS
Copyright: See the gEDA Copyright
gsymbol is first distributed with a back end to generate gEDA symbol files. Future distributions will include back-ends to generate symbols for other CAD tools, such as chipmunk.
gsymbol converts a Symbol Description Language into the proper form for use by the targeted CAD application. By default, the gsymbol parser takes its input from stdin and directs output to stdout. This behavior may be modified with command line switches and/or the file statement in the SDL input stream.XXX What is the precedence for output?
Symbol Description Language.Symbols for the gEDA suite are in text files which are not easily read- able by humans. Creating symbols was done by editing one of these files, either with gschem or with your favorite editor.
There are problems with this method. The files involved are not easily read and understood. There is no mechanism for using one symbol definition for several symbols.
For example, the 74xx00, 74xx24, 74xx26, 74xx37, 74xx132, etc., all have the same basic shape. If one could draw the basic shape and define symbols that use this shape, the work of creating symbols would be much easier.
Enter SDL , the symbol Definition Language.
Sdl is a context-free grammar, allowing indention, comments, include, and, definition variables. This eases the reading of symbol definition files while retaining the gEDA symbol file format and directory structure.
Creating a symbol is simply an exercise of using your favorite editor, feeding the sdl file to a parser and placing the resultant symbol where gEDA and friends can find it. The parser is case insensitive with respect to keywords.
The sdl files are text files and may be maintained with any of the OS tools available for handling text files.
So, here is an acceptible definition.
symbol {
device '12571AX'
pin L 1 2 IN 'A'
pin L 3 3 IN 'B'
pin R 2 1 TRI 'OUT'
pin T 0 7 PWR 'VCC'
pin B 0 14 POW 'GND'
}
If I save this in a file, 12571AX.sdl, and,
Of course, it may also be much more complicated.
If I create a file, 7400_pinout.sdl,
The symbol parser recognizes all the keywords and arguments in the
Reference Section. XXXX Maybe this should be elsewhere? The symbol parser recognizes all the keywords and arguments in the
Reference Section.
The defaults are as described in the reference section.
Default outputs are designed to allow a minimal specification to define
a working symbol. Specifying a symbol such as the minimal definition
will produce a working symbol for most situations. The parser requires at least
With this minimal input, a reasonable symbol will be produced.
XXXX Maybe this should be elsewhere?
device '7400'
size 3 4
parts 4
package 'DIP14'
L 1 1 4 9 12 IN 'I0'
L 3 2 5 10 13 IN 'I1'
R 2 3 6 8 11 DOT OUT 'O'
T 0 14 PWR 'VCC'
B 0 7 PWR 'GND'
dim_pins
grid_space 300
LINE +4.0 +0.0 +0.0 +0.0 23
LINE +0.0 +0.0 +0.0 +4.0 23
LINE +0.0 +4.0 +4.0 +4.0 23
ARC +4.0 +2.0 +0.0 -2.0 +2.0 +0.0 23
ARC +4.0 +2.0 +2.0 +0.0 +0.0 +2.0 23
I can create all the 7400-same-shaped symbols above,
symbol {
file '7400.sym'
comment 'Uses the default device above'
#include '7400_pinout.sdl'
}
symbol {
file '7424.sym'
comment 'Override the device'
device '7424'
#include '7400_pinout.sdl'
}
/*
| now, define a 74132
*/
symbol {
file '74132.sym'
device '74132'
#include '7400_pinout.sdl'
}
and, save this as 7400_like_symbols.sdl. Then,
will create the five files named in the file statements.
will check the symbol files for syntax, but, not create the symbol files
or output the symbols to the screen.
Symbol Parser Syntax
Symbol Parser Defaults
Parser notes.
Now, on to the goodies, the sdl definitions.
A symbol may be created by using
symbol { <sdl statements> }.
REFERENCE
regex: (\"[^\"\n]*[\"])|(\'[^\'\n]*[\'])<\p>
regex: [+-]?[0-9]+<\p>
regex: [0][Xx][0-9[A-F]|[a-f]]]+<\p>
regex: {dreal}|{ereal}
regex: [+-]?[0-9]?"."[0-9]+<\p>
regex: [+-]?[0-9]?"."[0-9]+[[Ee][+-]?[0-9]+<\p>
Default: Do not include ANY files.
Default: None. Refer to the Component Symbol Creation Guide for details. The default colors are defined in gsymbol.h
Default: No Author.
Default: If a body statement is not specified and no lines, arcs, or, circles are specified, a body statement will be created from the pin descriptions. Refer to the Component Symbol Creation Guide for details. The default colors are defined in gsymbol.h
Default: None. Refer to the Component Symbol Creation Guide for details. The default colors are defined in gsymbol.h
Default: None.
Default: None.
Default: None. A component without a body will create an empty symbol, with all the defaults in place. Entirely Useless!
Default: None.
Default: The default symbol dimenson is pins.
Default: The default symbol dimenson is pins.
Default: No Dot.
Default: No output file, the output is directed to stdout.
Default: 300
Default: None.
Default: None.
Default: None.
Default: None. Refer to the Component Symbol Creation Guide for details. The default colors are defined in gsymbol.h
Default: None.
Default: None.
Default: XXXXX Is this true? The default pin attribute is IN
Default: DIPxx, determined by the location of vcc and gnd pins.
Default: 1 part per package.
Default: None.
Default: None.
Default: None.
Default: None.
Default: None. A component without a body will create an empty symbol, with all the defaults in place. Entirely Useless!
Default: None. Refer to the Component Symbol Creation Guide for details. The default colors are defined in gsymbol.h
Default: None.
Default: None.
Default: None.
The gEDA ASCII file generator outputs a symbol that conforms to the gEDA specification. The file format is described in the following paragraphs, only as it relates to the file generator. Refer to File Formats in gEDA for exact specification of the file contents. The output symbol in the gEDA format is in the following order.
LINE +4.0 +0.0 +0.0 +0.0 23 LINE +0.0 +0.0 +0.0 +4.0 23 LINE +0.0 +4.0 +4.0 +4.0 23 ARC +4.0 +2.0 +0.0 -2.0 +2.0 +0.0 23 ARC +4.0 +2.0 +2.0 +0.0 +0.0 +2.0 23
body +0.0 +0.0 +3.0 +5.0
size 3 4
parts 2
package "DIP14"
pin L 1 1 9 DOT IN clk 'OE'
pin R 2 2 10 DOT OUT 'vflitz'
pin T 0 14 PWR 'VCC'
pin b 0 7 pwr 'GND'
symbol {
version "19990505"
file "file1"
author "Tomdean@ix.speakeasy.org"
comment 'this is in single quotes'
comment 'this is a second line of comments in single quotes'
device '71234'
package "T043"
size 2 3
parts 4
pin L 1 1 2 3 4 DOT IN 'IN 1'
pin R 1 5 6 7 8 DOT OUT 'Out 1'
pin L 2 9 10 11 12 DOT IN 'IN 2'
pin R 2 13 14 15 16 DOT OUT 'Out 1'
pin L 3 17 18 19 20 DOT IN 'IN 3'
pin R 3 21 22 23 24 DOT OUT 'Out 1'
pin L 4 25 26 27 28 DOT IN 'IN 4'
pin R 4 29 30 31 32 DOT IN 'IN 5'
pin L 5 33 34 35 36 DOT OUT 'Out 1'
pin R 5 37 38 39 40 DOT IN 'IN 1'
pin L 6 41 42 43 44 DOT OUT 'Out 1'
pin R 6 24 46 47 48 DOT IN 'IN 1'
pin L 7 49 50 51 52 DOT IN 'IN 1'
pin R 7 53 54 55 56 DOT OUT 'Out 1'
pin T 0 57 PWR 'VCC'
pin b 0 58 pwr 'GND'
LINE +4.0 +0.0 +0.0 +0.0 7
LINE +0.0 +0.0 +0.0 +4.0 7
LINE +0.0 +4.0 +4.0 +4.0 7
ARC +4.0 +2.0 +0.0 -2.0 +2.0 +0.0 7
ARC +4.0 +2.0 +2.0 +0.0 +0.0 +2.0 7
CIRCLE +0.3 +3.0 +0.3 3
CIRCLE +0.3 +1.0 +0.3 3
}
symbol {
version "19990505"
file "file1"
author "Tomdean@ix.speakeasy.org"
comment 'this is in single quotes'
#include "box_body.sdl"
}
symbol {
version "19990505"
file "file1"
author "Tomdean@ix.speakeasy.org"
comment 'this is in single quotes'
}
symbol {
version "19990505"
file "file1"
author "Tomdean@ix.speakeasy.org"
comment 'this is in single quotes'
comment 'this is a second line of comments in single quotes'
device '7$00'
technology 'ALS'
package "DIP14"
size 2 3
parts 4
pin L 1 1 2 3 4 DOT IN 'IN 1'
pin R 1 5 6 7 8 DOT OUT 'Out 1'
pin L 2 9 10 11 12 DOT IN 'IN 2'
pin R 2 13 14 15 16 DOT OUT 'Out 1'
pin L 3 17 18 19 20 DOT IN 'IN 3'
pin R 3 21 22 23 24 DOT OUT 'Out 1'
LINE +4.0 +0.0 +0.0 +0.0 7
LINE +0.0 +0.0 +0.0 +4.0 7
LINE +0.0 +4.0 +4.0 +4.0 7
ARC +4.0 +2.0 +0.0 -2.0 +2.0 +0.0 7
ARC +4.0 +2.0 +2.0 +0.0 +0.0 +2.0 7
}