pushdown-automaton

PDA to accept a language of strings containing more a's than b's

老子叫甜甜 提交于 2019-12-03 08:44:06
Produce a PDA to recognise the following language : the language of strings containing more a's than b's I have been struggling with this question for several days now, I seem to have hit a complete mental block. Would any one be able to provide some guidance or direction to how I can solve this problem? Divyanjali Your problem of "more a's than b's" can be solved by PDA. All you have to do is: When input is a and the stack is either empty or has an a on the top, push a on the stack; pop b , if b is the top. When input is b and the stack is either empty or has an b on the top, push b on the

Matching groups of nested parentheses using Regex and Pushdown-Automata

余生颓废 提交于 2019-11-30 17:51:53
问题 I'm working on a c# regular expression that can match nested constructions (parentheses in this case) as well as arbitrary operators (a '|' character in this case). I've gotten started by using a push-down automata as described here. What I have so far: String pattern = @" (?# line 01) \( (?# line 02) (?> (?# line 03) \( (?<DEPTH>) (?# line 04) | (?# line 05) \) (?<-DEPTH>) (?# line 06) | (?# line 07) .? (?# line 08) )* (?# line 09) (?(DEPTH)(?!)) (?# line 10) \) "; var source = "((Name1|