1 / 10

CS310

CS310. The Linux Command Line in a Nutshell or How I learned to stop worrying and love the shell so I can get my Lex and Yacc assignment done by next Wednesday. November 3, 2006. Connect to zeus.cs.pacificu.edu. ssh from your home computer

dulcea
Download Presentation

CS310

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS310 The Linux Command Line in a Nutshell or How I learned to stop worrying and love the shell so I can get my Lex and Yacc assignment done by next Wednesday. November 3, 2006

  2. Connect to zeus.cs.pacificu.edu • ssh from your home computer • Windows: putty.exe http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html • Mac OS X: open a terminal window • ssh –l username zeus.cs.pacificu.edu • ssh from the CS lab computers • Windows: putty.exe • Linux: open a terminal window • ssh –l username zeus.cs.pacificu.edu • Or install Lex & Yacc on your home computer Some of you may not have an account on Zeus. Come see me. Log on to ada.cs.pacificu.edu to change your password

  3. Connected to zeus • You are presented with a command line interface • for example: • basic commands • ls list files • mkdir directory make a directory • cd directory change to directory • cd .. move up one directory • rm –i file remove a file [chadd@zeus ~]$

  4. Creating a file • Various text editors to create a file • emacs • cheat sheet • http://ccrma.stanford.edu/guides/package/emacs/emacs.html • vi • cheat sheet • http://www.lagmonster.org/docs/vi.html • Emacs open a file: emacs -nw file.y save the current file: control-x control-s quit emacs: control-x control-c

  5. To create or open a file using emacs [chadd@zeus ~]$ emacs –nw hmwk4_2.y

  6. Build the executable After you build the yacc and lex source files, build the executable [chadd@zeus ~]$ yacc –dv yaccfile.y [chadd@zeus ~]$ lex lexfile.l [chadd@zeus ~]$ gcc –o parser lex.yy.c y.tab.c –lfl [chadd@zeus ~]$ ./parser input input input <control-d> [chadd@zeus ~]$ exit

  7. Build a tar.gz file • tar is a command that will append a set of files together into one large file • gzip is a compression utility to compress the data in a file [chadd@zeus ~]$ tar czf cs310Hwm4.tar.gz *.y cs310Hwmk4_1.l

  8. Makefiles cs310Hmwk4_1: lex will4614_cs310Hmwk4_1.l gcc lex.yy.c -o cs310Hmwk4_1 -lfl cs310Hmwk4_2: yacc -dv cs310Hmwk4_2.y lex cs310Hmwk4_2.l gcc lex.yy.c yy.tab.c -o cs310Hmwk4_2 -lfl clean: rm *.c *.h cs310Hmwk4_2 cs310Hmwk4_1

  9. Alternate Plan • Edit all you files on your home or lab computer and copy them to zeus using scp or PSCP (part of putty) • Linux or Mac • Windows [chadd@home ~]$ scp hmwk4_2.y chadd@zeus.cs.pacificu.edu: c:\CS310> pscp hmwk4_2.y chadd@zeus.cs.pacificu.edu: scp is build on SSL to keep your password and data safe!

  10. Write a lex and yacc file S -> TT S -> a S b T -> c T -> b T a

More Related