Return to Video

Challenge Problem - Design of Computer Programs

  • 0:01 - 0:03
    Now we showed how useful it is to have an API
  • 0:03 - 0:06
    for regular expressions that we can say
  • 0:06 - 0:15
    for example plus an option, alternative of literal A, literal B
  • 0:15 - 0:19
    and these function calls are convenient to manipulate
  • 0:19 - 0:20
    but that’s an awful lot to type,
  • 0:20 - 0:22
    especially when the string notation for
  • 0:22 - 0:24
    regular expressions is so much simpler,
  • 0:24 - 0:28
    we can represent this as this simple string,
  • 0:28 - 0:32
    and so what I want you to do in this homework
  • 0:32 - 0:35
    is to write a grammar and a parser that maps
  • 0:35 - 0:38
    from this string to this expression.
  • 0:38 - 0:41
    So you should first define regular expression grammar
  • 0:41 - 0:43
    using the tools that we’ve provided,
  • 0:43 - 0:45
    build the parser for that, that’s going to give you a tree,
  • 0:45 - 0:50
    so when we parse let’s say, RE is our main symbol,
  • 0:50 - 0:53
    then some text with this grammar
  • 0:53 - 0:55
    then that’s going to give you some sort of tree,
  • 0:55 - 0:58
    but it’s not quite this API form,
  • 0:58 - 1:02
    so then I want you to write another function to convert
  • 1:02 - 1:05
    from the tree to the API,
  • 1:05 - 1:07
    and so here’s what it looks like.
  • 1:07 - 1:09
    You are going to define your grammar,
  • 1:09 - 1:11
    RE is going to be the main left-hand side symbol
  • 1:11 - 1:13
    to parse the regular expression that’s given for you,
  • 1:13 - 1:15
    you parse it and convert it
  • 1:15 - 1:18
    and then you have to convert this
  • 1:18 - 1:21
    to make that cause into the API.
Tytuł:
Challenge Problem - Design of Computer Programs
Opis:

dummy description

more » « less
Video Language:
English
Team:
Udacity
Projekt:
CS212 - Design of Computer Programs
Duration:
01:22

English subtitles

Revisions Compare revisions