4 ms·
Written in Notepad, don't shoot me: enum action { Shift, Read}; action A = Read; Token tok; while (tok != END) { if(A == Read) tok = gettoken(); if(A == s
by biohacker42 17y ago
Written in Notepad, don't shoot me:
enum action { Shift, Read};
action A = Read;
Token tok;
while (tok != END)
{
if(A == Read) tok = gettoken();
if(A == shift(tok)) A = read;
else if(A == reduce(tok)) A = shift;
else if(tok == END) return ACCEPT
else return ERROR;
}
--EDIT--
Awww, no indentation support in HN.
- chaosmachine 17y agoI believe you can prefix your lines with two spaces to get <pre> tags. while (1) { print "yay"; }