Question: Help complete code! This is what I have so far, and in the provided images you will find the instructions. There is also a pda.h
Help complete code! This is what I have so far, and in the provided images you will find the instructions. There is also a pda.h file and main.c file I will include. #include
PDA::PDA
Initialize any member variables if necessary
name "Your Name"; Set a default name if needed
labNumber ; Set a default lab number if needed
description w w is a legal NASM integer constant; Set a default description
Any other initialization can go here
void PDA::initializeMachine
State : Initial state, expecting start of number
machine.insert TableEntryx "push", ; Hexadecimal prefix x
machine.insert TableEntryX "push", ; Hexadecimal prefix X
machine.insert TableEntryb "push", ; Binary prefix b
machine.insert TableEntryB "push", ; Binary prefix B
machine.insert TableEntryo "push", ; Octal prefix o
machine.insert TableEntryO "push", ; Octal prefix O
machine.insert TableEntryd "push", ; Decimal prefix d
machine.insert TableEntryD "push", ; Decimal prefix D
machine.insert TableEntryt "push", ; Decimal prefix t
machine.insert TableEntryT "push", ; Decimal prefix T
State : Reading Hexadecimal digits after x or X
for char c ; c ; c
machine.insert TableEntrycA "push", ; Valid hex digits
for char c A; c F; c
machine.insert TableEntrycA "push", ; Valid hex digits AF
for char c a; c f; c
machine.insert TableEntrycA "push", ; Valid hex digits af
machine.insert TableEntry "push", ; Underscore allowed
machine.insert TableEntry "pop", ; End of input
State : Reading Binary digits after b or B
machine.insert TableEntryA "push", ; Valid binary digits
machine.insert TableEntryA "push", ; Valid binary digits
machine.insert TableEntry "push", ; Underscore allowed
machine.insert TableEntry "pop", ; End of input
State : Reading Octal digits after o or O
for char c ; c ; c
machine.insert TableEntrycA "push", ; Valid octal digits
machine.insert TableEntry "push", ; Underscore allowed
machine.insert TableEntry "pop", ; End of input
State : Reading Decimal digits after dDt or T
for char c ; c ; c
machine.insert TableEntrycA "push", ; Valid decimal digits
machine.insert TableEntry "push", ; Underscore allowed
machine.insert TableEntry "pop", ; End of input
State : Final accepting state valid input
machine.insert TableEntry "pop", ; Allow whitespace at the end
for whatever reason this code does not seem to be able to handle certain test cases like these Input: aAbBcCdDeEfFx Result: NOT accepted
c
Input: aAbBcCdDeEfFh Result: accepted
Input: aAbBcCdDeEfFh Result: NOT accepted
c
Input: aAbBcCdDeEfFH Result: accepted
Input: aAbBcCdDeEfFH Result: NOT accepted
c
Input: d Result: accepted
Input: d Result: NOT accepted
c
Input: Result: accepted
Input: Result: NOT accepted
c
Input: o Result: accepted
Input: o Result: NOT accepted
c
Input: b Result: accepted
Input: b Result: NOT accepted
c
Input: b Result: accepted
Input: b Result: NOT accepted
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
