Author: Dann Corbit
Date: 16:38:37 08/21/02
Go up one level in this thread
On August 21, 2002 at 19:16:39, Dieter Buerssner wrote: >On August 21, 2002 at 19:05:44, Dann Corbit wrote: > >>The protocol and parser I suggest does not solve that problem. It solves the >>problem of: >>Someone sent me a string. What does it mean? >>Answer from parser: >>Perform command x with parameters a, b, c >>So parser calls: >>x(a,b,c); >>You still have to write the callback. And your engine has to know how to handle >>the callback. > >Dann, isn't this trivial without a yacc/lex parser? Perhaps, but many programs get it wrong. And if the grammar were fully specified I don't think it would be trivial. >In WB, a line from the GUI >is either a move, a command, or something unknown. On can loop (or if/else >if/...)over a list of strings, that's all. You know my implementation, which >actually uses callbacks. It is only rather few lines of code. One could make it >fancier - for example as you suggested by ordering the strings and doing a >binary search. Or even hashing the strings (easy at least when one does not >allow abbrevations and/or case insensitivity). I think lex/yacc for this would >be overkill, and actually more work than a straightforward implementation in >high level language. That's possible. It is also Tim Mann's objection. Will it also be trivial when the command set is doubled in size to include memory allocations, EGTB files, contest setup and other things of that nature? If we have a formal grammar specified, the command set is infintely more extensible.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.