|
|
1.1 ! root 1: .TH FSM 10.5 UCDS ! 2: .SH NAME ! 3: fsm \- finite state machine language format ! 4: .SH DESCRIPTION ! 5: .B Fsm ! 6: is designed to write finite state machines. ! 7: It assumes that there are ! 8: some number of input and output pins. ! 9: These must be declared first. ! 10: The input clock speed can also be declared so that the compiler will ! 11: calculate the length of loops given in the time format. ! 12: The input programs resemble C. ! 13: There must be a procedure ! 14: named ! 15: .B main ! 16: for the compiler to proceed. ! 17: Procedures declared "inline" ! 18: are called directly by the compiler to generate inline code. Otherwise ! 19: the syntax is very familiar. ! 20: Note that all procedures ! 21: .B must ! 22: be declared void. ! 23: Therefore, there are no expressions on the return ! 24: statement. ! 25: .PP ! 26: The ! 27: .IR yacc (1) ! 28: syntax for ! 29: .I fsm ! 30: is given below: ! 31: .sp ! 32: .nf ! 33: .ta 20n +3n ! 34: program : declarations procedures ! 35: declarations : declarations declaration ; ! 36: | empty ! 37: declaration : input ! 38: | outputDecl ! 39: input : \f5INPUT\fP inputDetails ! 40: inputDetails : BIT ID ! 41: | \f5FIELD ID < NUMBER : NUMBER >\fP ! 42: | \f5CLOCK\fP clockFrequency frequency ! 43: clockFrequency : \f5NUMBER\fP ! 44: | \f5NUMBER . NUMBER\fP ! 45: frequency : \f5MHZ\fP ! 46: | \f5KHZ\fP ! 47: outputDecl : \f5OUTPUT\fP outputDetails ! 48: outputDetails : \f5BIT ID\fP ! 49: | \f5FIELD ID < NUMBER : NUMBER >\fP ! 50: procedures : procedures procedure ! 51: | empty ! 52: procedure : inline \f5VOID ID\fP ( id_list ) statement ! 53: inline : \f5INLINE\fP ! 54: | empty ! 55: statements : statements statement ! 56: | empty ! 57: statement : output ! 58: | loop ! 59: | do ! 60: | enabled ! 61: | ifprefix statement ! 62: | ifelseprefix statement ! 63: | while ! 64: | repeat ! 65: | goto ! 66: | break ! 67: | continue ! 68: | call ! 69: | label statement ! 70: | \f5{\fP statements \f5}\fP ! 71: | \f5;\fP ! 72: call : \f5ID (\fP expression_list \f5) ;\fP ! 73: loop : \f5LOOP\fP statement ! 74: enabled : \f5ENABLED\fP statement ! 75: ifprefix : \f5IF\fP boolean ! 76: ifelseprefix : ifprefix statement \f5ELSE\fP ! 77: while : \f5WHILE\fP whileHead boolean whileTail statement ! 78: do : \f5DO\fP statement dopart \f5;\fP ! 79: dopart : \f5UNTIL\fP boolean ! 80: | \f5WHILE\fP boolean ! 81: repeat : \f5REPEAT NUMBER DO\fP statement ! 82: output : \f5OUTPUT (\fP field_list \f5)\fP outputSuffix \f5;\fP ! 83: outputSuffix : \f5FOR\fP timesOrCycles ! 84: timesOrCycles : \f5NUMBER\fP times ! 85: | \f5NUMBER CYCLES\fP ! 86: times : \f5NS\fP ! 87: | \f5US\fP ! 88: | \f5MS\fP ! 89: goto : \f5GOTO ID\fP ! 90: break : \f5BREAK\fP ! 91: continue : \f5CONTINUE\fP ! 92: label : \f5ID :\fP ! 93: boolean : \f5(\fP expression \f5)\fP ! 94: id_list : \f5ID\fP ! 95: | id_list \f5, ID\fP ! 96: | empty ! 97: expression_list : expression ! 98: | expression_list \f5,\fP expression ! 99: | empty ! 100: field_list : field ! 101: | field_list \f5,\fP field ! 102: field : \f5ID =\fP expression ! 103: expression : \f5(\fP expression \f5)\fP ! 104: | expression \f5+\fP expression ! 105: | expression \f5-\fP expression ! 106: | expression \f5&\fP expression ! 107: | expression \f5|\fP expression ! 108: | expression \f5^\fP expression ! 109: | expression \f5>>\fP expression ! 110: | expression \f5<<\fP expression ! 111: | \f5~\fP expression ! 112: | \f5!\fP expression ! 113: | \f5INPUT ( ID )\fP ! 114: | \f5ID\fP ! 115: | \f5NUMBER\fP ! 116: .fi
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.