100 likes | 402 Views
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
E N D
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 • 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
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 ~]$
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
To create or open a file using emacs [chadd@zeus ~]$ emacs –nw hmwk4_2.y
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
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
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
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!
Write a lex and yacc file S -> TT S -> a S b T -> c T -> b T a