[erlang-questions] json to map

Felix Gallo felixgallo@REDACTED
Thu Aug 27 18:05:06 CEST 2015


Roelof: don't do the JSON parser.  Do Garrett's suggestion instead.  I
recommend the added facet of trying to build a simple, complete
four-function calculator.  For extra credit, add the ability to use
parentheses, which gets you to some fundamental computer science
discoveries.


ROK is, as always, correct that this area (parsing ill-defined
specifications involving text) is one of the Great Problems of Computer
Science, rife with monsters named lex and yacc and their cousins yecc and
leex, in the lair of the dread throne of the Basic Multilingual Plane where
surrogate pairs lurk in the deep pits of context-free grammar, gnawing on
abstract syntax trees.

Nevertheless, the admonition to criticise the exercise doesn't really help
all the Roelofs, because they haven't spent countless years in the trenches
yet, so have no basis to independently formulate the notion that a
maximalist reading of the problem would necessitate a lawyerly reading of
iso/iec 10646, or the implementation of an LR(1) parser, or whatever.  The
analysis and subsequent constructive exercise-sculpting does need to come
from a grizzled, irascible, greying mentor; in my opinion.

F.


On Thu, Aug 27, 2015 at 7:01 AM, Garrett Smith <g@REDACTED> wrote:

> On Thu, Aug 27, 2015 at 6:04 AM, Roelof Wobben <r.wobben@REDACTED> wrote:
> > Thanks,
> >
> > Can this be a way to solve the challenge :
> > http://www.evanmiller.org/write-a-template-compiler-for-erlang.html
>
> I think the challenge is to take smaller steps here...
>
> Either solve this challenge by finding a JSON parser and using it, or
> redefine the challenge to "create a simple parser".
>
> Parsing JSON is a challenge, but I think you should define an interim
> challenge first - one that's less challenging.
>
> Strictly speaking the challenge of parsing JSON in Erlang (and
> therefore being able to generate other forms) is not that challenging
> as there are like half a dozen decent libraries to do that already. It
> can be a challenge to find them, compile and use them - but not that
> challenging. So why not just do that and cross this challenge off your
> list?
>
> Then, create a new challenge, which is to parse some simply expression
> like "1 + 1" into a term in Erlang. You can then do something
> interesting with that term! See hint [1]
>
> This is a good challenge IMO because you'll learn a lot about Erlang
> (your goal) and you'll also experience the empowerment of building
> your own language, even if a very simple one.
>
> What I'm really trying to say is that it's challenging to define the
> right challenge. Richard said it best:
>
> > The first thing to do with these exercises is CRITICISE them.
>
> But don't criticize mine :)
>
> [1]
> https://gist.github.com/cooldaemon/13773/6133f606a809dbd05683f290afaac21fbe7e2ce4
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150827/4573c6c4/attachment.htm>


More information about the erlang-questions mailing list