Structure and
Interpretation
of Computer
Programs

Fall 2021
course
site
-->

Mon Nov 15

We're doing today's class in zoom with a recording again, because of the folks who can't be here because of covid protocols.

The assignment for Thursday is posted. And I've caught up with my feedback, including a comment on grading for those of you signed up to get them. Past this there's likely to be only one or two more perhaps just an "end of semester" wrap-up ... I'll discuss that further later today.


Main topic for today : discuss what "parsing" is all about, and in particular the "recursive descent parser" using my

and the resources listed in its comments.

The wikipedia recursive descent has a fairly clear example, parsing a grammar for PL/0 in C.

For another example, consider CSX-lite (pdf)

program     ::= "{" statements "}" \eof           ;; end of file marker
statements  ::= statement statements | ""
statement   ::= id "=" expresion ";"
expression  ::= id tail
tail        ::= ("+" | "-") expression | ""

It turns out that this is LL(1) ... and we can therefore write a recursive descent parser for it, as described in the pdf.


As I said last time, I would like to spend most of the rest of the term working on a class "dickinson language" project, with the goal of defining and implementing a small, simple programming language.

Your contributions can include tests, documentation, code, ideas, other features and implementations, ... or at the very least, a discussion of how it all works.


goals :

End of semester is coming up fast

      Mon   Thu
 Nov  15    18
      22    thanksgiving
      29     2
 Dec   6     9

... so we don't have much time to do this. We'll see how far we can get, and whether we can find ways to divide up some of the work.

proposal for calculator syntax (one step past simple arithmetic) :

symbol      ::=  [decide on a regex for variable names]
assignment  ::=  symbol "is" expression
function    ::=  symbol "(" args ")" "is" expression
args        ::=  symbol ( "," symbol )*
factor      ::=  number | symbol | "(" expression ")" | symbol "(" args ")"

thinking out loud about features past that ... with mostly C-language-ish conventions (i.e. "simple")

I'm not fixed on any of this yet ... but we need to make some decisions soon; we only have a few weeks.

Oh, and I've uploaded a link to the zoom recording of today to the zoom video page.

aside

https://cs.bennington.college /courses /fall2021 /sicp /notes /11-15
last modified Mon November 15 2021 5:02 pm