g | x | w | all
Bytes Lang Time Link
730Go240701T043624Zbigyihsu
335Ruby160625T070343ZValue In
398Javascript ES6160623T153744ZBassdrop

Go, 730 bytes

import(."fmt";."strings")
type U=uint
var S=[]any{}
func A(e...any){S=append(S,e...)}
func C()(o any){o,S=S[len(S)-1],S[:len(S)-1];return}
func f(p,i string){c:="chicken"
if TrimSpace(ReplaceAll(p,c,""))!=""{return}
A(&S,i)
for _,l:=range Split(p,`
`){A(Count(l,c))}
A(0)
for I:=U(2);I<U(len(S));{switch a:=S[I];a{case 0:Print(S[len(S)-1]);return
case 1:A(c)
case 2:o,p:=C(),C();A(o.(U)+p.(U))
case 3:o,p:=C(),C();A(o.(U)-p.(U))
case 4:o,p:=C(),C();A(o.(U)*p.(U))
case 5:o,p:=C(),C();k:=0;if o==p{k++};A(k)
case 6:o:=C().(U);if S[int(I+1)].(int)<1{A(S[o])}else{A(S[S[int(I+1)].(int)].(string)[o])};I++
case 7:o,p:=C(),C();S[o.(U)]=p
case 8:o,p:=C(),C();if p.(U)!=0{I+=o.(U)}
case 9:A(rune(C().(U)))
default:A(U(a.(int)-10))
I++}}}

Attempt This Online!

This was a bit of a pain: a plain, no-frills implementation of the specification. I have not tested this extensively; the program will probably crash if you even as much drip a non-uint in the wrong place. Can probably be golfed down a bit.

Expects program code to only consist of lowercase chicken and whitespace.

Explanation

import(."fmt";."strings")
type U=uint
var S=[]any{}
func A(e...any){S=append(S,e...)}                    // push function
func C()(o any){o,S=S[len(S)-1],S[:len(S)-1];return} // pop function

func f(p,i string){c:="chicken"
if TrimSpace(ReplaceAll(p,c,""))!=""{return}         // exit when there are non-chickens

// === STACK SETUP ====
A(&S,i)                                     // append the stack reference, and the user input
for _,l:=range Split(p,"\n"){A(Count(l,c))} // append opcodes
A(0)                                        // opcode terminator

// === INTERPRETATION ===
for I:=U(2);I<U(len(S));{          // loop until the instruction pointer hits the end of the stack
switch a:=S[I];a{                  // based on the current instruction...
case 0:Print(S[len(S)-1]);return   // print and exit on 0
case 1:A(c)                        // push chicken on 1
case 2:o,p:=C(),C();A(o.(U)+p.(U)) // add on 2
case 3:o,p:=C(),C();A(o.(U)-p.(U)) // sub on 3
case 4:o,p:=C(),C();A(o.(U)*p.(U)) // mul on 4
case 5:o,p:=C(),C();k:=0;if o==p{k++};A(k) // eq on 5
case 6:o:=C().(U);if S[int(I+1)].(int)<1{A(S[o])} // on 6, take from the stack if 0
                  else{A(S[S[int(I+1)].(int)].(string)[o])} // otherwise take a char from the input
                  I++                             // skip the load location
case 7:o,p:=C(),C();S[o.(U)]=p     // set stack on 7
case 8:o,p:=C(),C();if p.(U)!=0{I+=o.(U)} // jump on 8
case 9:A(rune(C().(U)))            // reinterpret as a char on 9
default:A(U(a.(int)-10))           // push n-10 on everything else
I++}}}                             // bump instruction pointer

Ruby, 335 bytes

Takes the input file name as a command line argument and takes user input (for instruction #6) from STDIN.

Because of Ruby "truthy" (everything except false and nil) being different from the Javascript "truthy" (Ruby truthy plus 0, empty strings, etc.), there might be some edge cases where programs that work fine on a JS interpreter fail on this one because of instruction #8, such as if "" is on the stack. I've fixed the biggest case, though, which is falsy 0.

Works with the test program and the Hello World program on the Chicken website.

+(/^(#{c='chicken'}|\s)*$/m=~f=$<.read+"

")
s=[0,STDIN.read]+f.lines.map{|l|l.split.size};s[0]=s;i=1
s<<(s[i]<10?[->{c},->{x,y=s.pop 2;x+y},->{x,y=s.pop 2;x-y},->{s.pop*s.pop},->{s.pop==s.pop},->{s[s[i+=1]][s.pop]},->{s[s.pop]=s.pop;s.pop},->{l,k,j=s.pop 3;i+=j if k&&k!=0;l},->{s.pop.chr}][s[i]-1][]:s[i]-10)while s[i+=1]>0
$><<s.pop

Explanation

The interpreter immediately starts off by running a regex match /^(chicken|\s)*$/m against the entire file ($<.read), which makes sure the file contains nothing but chicken and whitespace. In Ruby, this operator returns the index for the match, or nil if it wasn't found.

Two byte-saving tricks are used here: instead of directly matching chicken, the string substitution operator #{} is used instead to also assign that string to a variable for later (saves 1 byte), and when storing the contents of the file to a variable for processing, it appends two newlines to allow the lines function later to naturally append an extra 0 to the end of the instruction set. (Two are needed because of ignored trailing newline, which is necessary for the Chicken program.)

The error used is NoMethodError: undefined method '+@' for nil:NilClass, which is done by wrapping the regex match in parens and putting a + in front. If the file matches the pattern, you get +0, which evaluates to 0 and proceeds normally.

Next, the stack is assembled. The initial list must be created before the self-reference to the stack can be assigned, so a placeholder is used and then replaced. The instruction pointer is set to 1 instead of 2 because post-increment operators don't exist in Ruby.

Finally, it uses the lambda trick from @BassdropCumberwubwubwub to determine what to push on the stack next. If an operation doesn't push anything onto the stack, the interpreter simply pops an extra value so the stack stays the same. (This saves bytes over adding a push operation into every single lambda.)

Ungolfed code:

f = $<.read + "\n\n"
+(/^(chicken|\s)*$/m =~ f)
s = [0, STDIN.read] + f.lines.map{|l|l.split.size}
s[0] = s
i = 1

while s[i += 1] > 0
    if s[i] < 10
        s.push [
            ->{'chicken'},
            ->{
                x,y = s.pop 2
                x+y
                },
            ->{
                x,y = s.pop 2
                x-y
                },
            ->{s.pop*s.pop},
            ->{s.pop==s.pop},
            ->{s[s[i+=1]][s.pop]},
            ->{s[s.pop]=s.pop;s.pop},
            ->{
                l,k,j=s.pop 3
                i+=j if k&&k!=0
                l
                },
            ->{s.pop.chr}
        ][s[i] - 1][]
    else
        s.push(s[i] - 10)
    end
end

print s.pop

Javascript ES6, 398 bytes

By far the longest golf I have ever done, I'm sure this can be improved but my brain doesn't recognize anything other than chicken at this point.

(a,b)=>{for(c='chicken',s=[j=0,b,...A=a.split`
`.map(m=>m.split(c).length-1)],i=A.length+2;j<A.length;([_=>s[++i]=c,_=>s[--i]=s[i]+s[i+1],_=>s[--i]=s[i]-s[i+1],_=>s[--i]=s[i]*s[i+1],_=>s[--i]=s[i]==s[i+1],_=>s[i]=s[2+j++]?b[s[i]]:s[s[i]],_=>s[s[i--]]=s[i--],_=>j+=s[--i]?s[--i+2]:0,_=>s[i]=String.fromCharCode(s[i])][s[j+2]-1]||(_=>s[++i]=s[j+1]-10))(j++));return /[^chicken \n]\w/g.test(a)?0:s[i]}

I will edit the explanation in when my brain starts functioning again. Here's a slightly ungolfed version for now.
Outputs a falsey value (0) for everything which isn't chicken

(a,b)=>{
    for(c='chicken',s=[j=0,b,...A=a.split`
    `.map(m=>m.split(c).length-1)],i=A.length+2; // loop init
    j<A.length; // loop condition
    ( // everything else
        [
            _=>s[++i]=c,
            _=>s[--i]=s[i]+s[i+1],
            _=>s[--i]=s[i]-s[i+1],
            _=>s[--i]=s[i]*s[i+1],
            _=>s[--i]=s[i]==s[i+1],
            _=>s[i]=s[2+j++]?b[s[i]]:s[s[i]],
            _=>s[s[i--]]=s[i--],
            _=>j+=s[--i]?s[--i+2]:0,
            _=>s[i]=String.fromCharCode(s[i])
        ][s[j+2]-1]
        ||(_=>s[++i]=s[j+1]-10)
    )(j++)
);
return /[^chicken \n]\w/g.test(a)?0:s[i]}

Try it here

f=
  (a,b)=>{for(c='chicken',s=[j=0,b,...A=a.split`
`.map(m=>m.split(c).length-1)],i=A.length+2;j<A.length;([_=>s[++i]=c,_=>s[--i]=s[i]+s[i+1],_=>s[--i]=s[i]-s[i+1],_=>s[--i]=s[i]*s[i+1],_=>s[--i]=s[i]==s[i+1],_=>s[i]=s[2+j++]?b[s[i]]:s[s[i]],_=>s[s[i--]]=s[i--],_=>j+=s[--i]?s[--i+2]:0,_=>s[i]=String.fromCharCode(s[i])][s[j+2]-1]||(_=>s[++i]=s[j+1]-10))(j++));return /[^chicken \n]\w/g.test(a)?0:s[i]}

i.innerHTML = f(`chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken
`, 'Hello world!')
<pre id=i>