Read this article at Microsoft Research about "Dynamic Variables." Do not read the Appendix to the article just yet, only the main body of the article.
Answer the following questions:
1) List two purposes for which they envision using these dynamically scoped variables?
2) Choose one of those two, and motivate it. That is, show what the code would look like when not using dynamic variables, and then what it would look like with dynamic variables.
3) Briefly describe the "simple" and the "novel" implementations.
Wednesday, February 27, 2008
Homework #11: Variables With Dynamic Scope
Posted by joshwaxman at 5:24 PM 0 comments
Labels: homework
Monday, February 25, 2008
Homework #10
1. Read this article about regular expressions in Word, and try the find and replace example in the article.
2. Read the Wolfe article posted on blackboard, "Nesting In Ada Programs Is For The Birds," and answer the questions: Give four reasons why nesting in Ada programs is for the birds. What is the authors' suggestion?
Posted by joshwaxman at 8:05 PM 0 comments
class notes from today
some prolog:
father (terach, avraham).
father (avraham, yitzchak).
father (avraham, yishmael).
brother (A, B) :- father(C, A), father (C, B).
?- brother (yitzchak, yishmael)
True
?- brother (yitzchak, Z)
yishmael
floating point:
_______________
sign bit
exponent
fraction
decimal
_____________
part before decimal pt.
part after decimal pt.
1060 = 10.60
integers
______________
sign magnitude notation
two's complement
one's complement
descriptors for:
static length string
--------------
string
length
address
_________________
limited dynamic length string
_-________________________
limited dynamic string
maximum length
current length
address
___________________________
enum temperature { hot, cold, freezing };
enum proximity { near = 6, cold = 7, freezing =8};
proximity::cold
Posted by joshwaxman at 2:46 PM 0 comments
Thursday, February 14, 2008
Some Class Notes
int x[6];
int n;
cin >> n;
int x[n];
int * x = new int [n];
Backus-Naur Form
BNF
CFG - Context Free Grammar
Josh
josh
int int;
REAL APPLE;
INTEGER REAL;
REAL INTEGER;
int shakespeare;
shakespencil = 60;
FSA which recognize regular languages
NFA is equivalent to an FSA
regular langs are closed on the Operations of union, concatenation,
and kleene star
E is the input alphabet
G is the output alphabet
PDA = Push Down Automaton
can recognize CFLanguages,
which can be described with CFG, BNF
Posted by joshwaxman at 5:09 AM 0 comments
Wednesday, February 13, 2008
Getting Fortran to Run
I am still working on getting FORTRAN installed in the labs, for G95. In the meantime, on your own personal machines, you can try installing the Silverfrost FTN95 compiler. It is free for personal use, but has an annoying screen before running any of your programs. And it integrates with the Visual Studio 2005 IDE, with makes it much easier to test out your programs. And it color codes keywords, and lets you step through the code, and so on. I tried it, and it worked with no headaches setting it up.
Posted by joshwaxman at 5:49 PM 0 comments
Tuesday, February 12, 2008
HW #8, with video intro
Not to be confused with homework #7.
#8:
Using VBA for Excel, implement the first FSA from assignment #5. On the spreadsheet, include a formal description of the FSA. This includes the transition function delta. Rather than using Gotos, keep a variable which maintains the present state, and look up the appropriate transition to the next state, based on the present state and the input, from that lookup table on the Excel worksheet.
You can download the video here.
Posted by joshwaxman at 7:04 AM 0 comments
Monday, February 11, 2008
Class Notes
LISP
(A B C D)
(A (B C) D)
Three operations closed on regular languages
Union
Concatenation
Kleene star
Kleene plus
A = { boy, girl}
B = {bad, good}
A.B {boybad, girlbad, boygood, girlgood}
C = {boy}
A* = { epsilon, boy, boyboy, boyboyboy, girl, girlboy, boygirl, girlgirlgirl, girlgirlboy
C* = { w^n | n >= 0, w is an element in C}
ab*a(a|b)
((a|b|c).a)+
((a|b|c).a). ((a|b|c).a)*
1 + 2
Posted by joshwaxman at 2:41 PM 0 comments
Sunday, February 10, 2008
HW #9: More Fortran
Due Feb 13.
In the tutorial, work through hands-on-exercise 2.2 and 2.3. For the former, you might find this video of some help.
You can download the video here:
The purpose of exercise 2.2 is to give you some experience reading a real Fortran program and understanding it to the level of being able to make some simple modifications. In exercise 2.3, we are introduced to internal functions, which are limitations of the scope of functions to within the program. This will help you apply what you read, to modify program 2.2 further. And more than that, it will give you practice in writing functions, and understanding in how they take in their parameters and how they give back their return value. Part of the assignment is also to give me the meaning of "intent" in this context. Google is your friend in this regard.
Posted by joshwaxman at 9:17 PM 0 comments
Homework #7, 8
We continue with the Excel VBA assignments, and will be implementing various finite state automata (FSA). To be announced, discussed in class on Monday.
#7: Due Wednesday, Feb 13
Using VBA for Excel, implement the first FSA from assignment #5. Read the input string from cell B1. Print "accept" or "reject" in C1. Print the sequence of states in cell A4 and down (A5, A6, etc). Use gotos and goto labels to represent the states. Use the MID function to extract letters sequentially from the input string.
You can download the video here.
#8: Due Monday, Feb 18
Using VBA for Excel, implement the first FSA from assignment #5. On the spreadsheet, include a formal description of the FSA. This includes the transition function delta. Rather than using Gotos, keep a variable which maintains the present state, and look up the appropriate transition to the next state, based on the present state and the input, from that lookup table on the Excel worksheet.
Video to come.
Posted by joshwaxman at 5:09 PM 0 comments
Thursday, February 07, 2008
Homework #6 Solution
Here is a walkthrough of installing the G95 FORTRAN compiler and getting the Hello World program up and running.
You can download the video here.
Posted by joshwaxman at 4:28 PM 0 comments
Wednesday, February 06, 2008
Homework #5
In the Sipser book, and up on Blackboard. Look at the FSAs and answer the questions.
Posted by joshwaxman at 7:19 PM 0 comments
Homework #3 Solution
See the assignment definition here.
You can download the video here.
Posted by joshwaxman at 7:14 PM 0 comments
Some formal definitions from class about FSA
A finite automoton is a 5-tuple (Q, E, delta, q0, F)
(We are using E for Sigma)
1. Q is a set of states
2. E is set called the alphabet
3. delta: Q X E -> Q is the transition function
4. q0 an element in Q is the start state
5. F subset of Q is the set of accept states
If A is the set of all strings accepted by FSM M, then Machine M recognizes A; could say accepts A. A is the language of machine M.
Also, we finished chapter 2's coverage of the FORTRANs, in the Concepts of Programming Languages book.
Posted by joshwaxman at 2:44 PM 0 comments
FORTRAN Assignment 1 (HW Assignment 6)
Download G95 (sidebar) and install it on your computer. Name the files *.f90 to be able to use FORTRAN 90 syntax. If you name it *.f, you will have annoying restrictions, such as the first 6 characters on a line being reserved. Read through the beginning of the tutorial, here. Specifically, start with Exercises and Examples, and do Exercise 2.1
Posted by joshwaxman at 1:51 PM 0 comments
Monday, February 04, 2008
Homeworks #3, 4
#3: Due this Wednesday, Feb 6
In Visual Basic for Applications for Excel, create a macro that puts the numbers 1 through 13 in cells A1 through A13. If possible, do so using the functionality in which you can drag to extend an existing pattern of numbers. Copy the text of the VBA macro which was created, and submit that.
#4: Due next Monday, Feb 11
Write two UDFs (User Defined Functions), with meaningful names of your own choosing. The first should take in X and Y and return X times Y. The second should take in X and return X factorial.
Posted by joshwaxman at 3:00 PM 0 comments
Sunday, February 03, 2008
Class 2
First:
From class 1: go over readability, writeability.
Then:
Class 2 from last time. Go over some of the features of language. Get to the beginning of FORTRAN. Much better reading than presenting, so it is a good reason to just get the book.
And introduction to a bit of VBA for Excel.
Then, beginning of other book. What is a Finite State Automaton? An state, a start state, an accept state, a transition, a state transition table. What is the language recognized by a specific FSA?
Posted by joshwaxman at 9:48 PM 0 comments