[Haskell-cafe] http://www.cs.cornell.edu/icfp/task.htm
Vo Minh Thu
noteed at gmail.com
Fri Feb 25 17:44:13 CET 2011
2011/2/25 Hauschild, Klaus (EXT) <klaus.hauschild.ext at siemens.com>:
> Hi,
>
> Currently I'm trying to lern Haskell by doing. After doing some examples I
> plan to solve an ICFP task (see subject). In short: build an interpreter for
> a stack based language thata describes a 3D scene. Ray trace this scene in
> an image. My current source state can be found here:
> http://code.google.com/p/hgmltracer/source/browse/
> My first goal is to develop the interpreter of the GML language. My source
> contains a data GmlToken with various constructors for the different
> operators, sequences, int, real, string an so on. Some code for the
> evaluation is also there und working.
> But the parser converting a string (contained in the program file provided
> as command line argument) is hard stuff and I'm stuck.
>
> Can any one help me with ideas or concepts for this parser?
Hi,
You have chosen to develop a very interesting program and I'm sure a
lot of people could help you if you face any problem. But it would be
easier for those people to help you if you could be a bit more
specific about what works (or what you understand) and where you have
some problem.
In this case, maybe you could copy in the mail some code (possibly
cutting it down to what really matter).
For instance, I think central to your mail is this data structure:
data GmlToken =
IntToken Int
| RealToken Double
| BoolToken Bool
| StringToken String
| FunctionToken [GmlSequence]
| ArrayTokenToken [GmlSequence]
| BinderToken String
| IdentifierToken String
| AddiToken
and the function
parse :: [String] -> TokenSequence -> TokenSequence
parse = ...
At first view I would say that parse should be (and I call it tokenize)
tokenize :: String -> [GmlToken]
Now, maybe you can provide some sample inputs *with* their expected
output and tell us what is really a problem for you.
Alternatively I can assume too much (or not enough) things from your
mail and you can enlighten me :)
Cheers,
Thu
More information about the Haskell-Cafe
mailing list