Lectures‎ > ‎

Week02

How to use git

We will be using git for source code control this semester.

We have setup a repository manager called gitolite.

In order to setup your git repository you need to send me and CS support your public ssh key.  RSA preferred.

If you don't have one, use:

$ ssh-keygen -t rsa

Send your .ssh/id_rsa.pub file to me (benson@usfca.edu and support@cs.usfca.edu).

The gitolite server will be www.cs.usfca.edu.  More to follow on how to setup your initial local repo.

Once you have your keys setup, you can clone your repo from the CS gitolite server:

$ git clone git@www.cs.usfca.edu:<username>

For example:

$ git clone git@www.cs.usfca.edu:benson

After you have cloned, you can add files to the repo:

$ cd benson
$ mkdir cs345
$ cd cs345
$ mkdir project0
$ cat > find_links.py
print 'Hello World'
^D
$ cd ../..
$ git add cs345
$ git commit -a -m "Initial CS 345 files."
$ git push

Here are a few common git commands:

git clone - clone a repo from a remote server
git pull - pull updates from the remote repo
git push - push local updates to the remote repo
git add - add a file or directory to be tracked by git
git commit - commit changes

git branch - show branches
git checkout -b <branch-name> # create a new branch
git checkout <branch-name> # switch to a branch
git merge <branch-name> # merge updates from <branch-name> into current branch

See http://git-scm.com for more info on git.


Parsing Example
  • How to interpret the following:
  • "'Greg ' + 'Benson'" 
    • "Greg Benson"
  • "upper('Greg') + upper('Benson')"
    • "GREG BENSON"
  • "sub(1,1, 'Greg') + '.' + 'Benson'"
    • "G. Benson"
  • Code up in a language of your choice.

EBNF

Recursive Descent Parsing
  • Recursive Descent Parsing explained (PDF)

Ċ
Greg Benson,
Jan 29, 2013, 2:00 PM
ċ
calc_scanner.py
(5k)
Greg Benson,
Jan 29, 2013, 4:49 PM
Comments