Následuje ukázka definování typů symbolů pro překladač jazyka s podmnožinou příkazů na Příkazovém řádku Windows.
package wintrainer;
/**
*
* @author sarka
*/
// trida pro typy symbolu v prvni urovni (odpovida nazvum prikazu)
public class TTypSymbolu {
public static final int // v Jave je trochu problem s vyctovymi typy, proto byly zvoleny celociselne konstanty
SInvalid = 0,
SFirstSymbolType = 551,
SArp = 551,
SAt = 552,
SAttrib = 553,
SCacls =554,
SCd =555,
SChdir =556,
SCls =557,
SComp = 558,
SCopy =559,
SDate = 560,
SDel = 561,
SDir = 562,
SEcho = 563,
SEdit = 564,
SFc = 565,
SFind = 566,
SFindstr = 567,
SFsutil = 568,
SHelp = 569,
SIpconfig = 570,
SMd = 571,
SMkdir = 572,
SMore = 573,
SMove = 574,
SNet = 575,
SNetsh = 576,
SNetstat = 577,
SNslookup = 578,
SPath = 579,
SPathping = 580,
SPing = 581,
SRd = 582,
SRen = 583,
SReg = 584,
SRmdir = 585,
SRoute = 586,
SSc = 587,
SSet = 588,
SSchtasks = 589,
SSort = 590,
SStart = 591,
STaskkill = 592,
STasklist = 593,
STime = 594,
STracert = 595,
STree = 596,
SType = 597,
SVer = 598,
SWinver = 599,
SWmic = 600,
SDiskC = 601,
SDiskD = 602,
SLastSymbolType = 602;
// konec konstant
// pristupova metoda, vraci "uzivatelsky pritulny" nazev symbolu
public static String getSymbolType (int type) {
switch (type) {
case SInvalid: return "chyba";
case SArp: return "arp";
case SAt: return "at";
case SAttrib: return "attrib";
case SCacls: return "cacls";
case SCd: return "cd";
case SChdir: return "chdir";
case SCls: return "cls";
case SComp: return "comp";
case SCopy: return "copy";
case SDate: return "date";
case SDel: return "del";
case SDir: return "dir";
case SEcho: return "echo";
case SEdit: return "edit";
case SFc: return "fc";
case SFind: return "find";
case SFindstr: return "findstr";
case SFsutil: return "fsutil";
case SHelp: return "help";
case SIpconfig: return "ipconfig";
case SMd: return "md";
case SMkdir: return "mkdir";
case SMore: return "more";
case SMove: return "move";
case SNet: return "net";
case SNetsh: return "netsh";
case SNetstat: return "netstat";
case SNslookup: return "nslookup";
case SPath: return "path";
case SPathping: return "pathping";
case SPing: return "ping";
case SRd: return "rd";
case SRen: return "ren";
case SReg: return "reg";
case SRmdir: return "rmdir";
case SRoute: return "route";
case SSc: return "sc";
case SSet: return "set";
case SSchtasks: return "schtasks";
case SSort: return "sort";
case SStart: return "start";
case STaskkill: return "taskkill";
case STasklist: return "tasklist";
case STime: return "time";
case STracert: return "tracert";
case STree: return "tree";
case SType: return "type";
case SVer: return "ver";
case SWinver: return "winver";
case SWmic: return "wmic";
case SDiskC: return "C:";
case SDiskD: return "D:";
}
return ""; // nedefinovany symbol
}
}