Berkeley CSUA MOTD:Entry 30060
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/25 [General] UID:1000 Activity:popular
5/25    

2004/5/6 [Computer/SW/Compilers] UID:30060 Activity:high
5/6     I've been out of school for too long.  If I want to write a simple
        compiler, what tools do I need besides yacc and what do they do?
        Thanks a bunch!
        \_ well there's also lex (flex) for the lexical analyzer (tokenizing).
        \_ java or c? if c, lex/flex=good tokenizer. yacc/bison are great
           for grammar. both are LALR so they're pretty powerful.
           \_ I'm not actually writing a compiler.  What I really want is to
              generate some C code that can read simple script files and
              perform some actions.  For example, if the C code reads this
              file:
                        REPEAT 10
                            DELAY 3
                            FOO
                        END
              it'll perform a for-loop 10 times calling sleep(3) and foo().  So
              I thought what I need is pretty much the front part of a
              compiler.  Thanks for any help.
              \_ I've been going through this with guys at work who always
                 want to add scripting capabilities to their apps.  Check out
                 SWIG; it lets you call scripts from C code and vice versa,
                 and your scripts can be python, perl, ruby, java, lisp, scheme,
                 whatever you want to allow.
2025/05/25 [General] UID:1000 Activity:popular
5/25    

You may also be interested in these entries...
2005/2/18-20 [Computer/SW/Compilers] UID:36229 Activity:nil
2/18    When you need to parse something simple do you usually use (f)lex/yacc
        or just write a recursive-descent parser? I've done both in the past,
        but I can't seem to justify using one approach over the other.
        \_ the point of yacc is so that you can write a grammar for it so that
           when things change you don't have to spend a lot of time
           rewriting your hand-written C/Java recursive-descent parser. For
	...
2004/12/20-21 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:35368 Activity:kinda low
12/20   Has anyone used the parser generator JavaCC?  Is it just me, or is
        it completely awful?
        \_ what do you need it for? If you need to use the visitor and
           traverse the syntax tree, I recommend JTB, available here
           http://compilers.cs.ucla.edu/jtb  It is built on top of
           javacc and generates visitors that you can extend functionalities
	...
2004/5/21-22 [Computer/SW/Compilers] UID:30345 Activity:very high
5/21    I was not a CS major and never took the compiler class.  What is
        a good book to help me write a compiler?  And what about interpreter?
        Do they basically involve the same issues except code generation and
        optimization?
        \_ Use the book by Robert Mak, called "Writing Interpreters and
           Compilers in C++." It's a practical, hands-on "lab" type book which
	...
2004/5/12-13 [Computer/SW/Editors/Emacs, Computer/SW/Compilers] UID:30198 Activity:kinda low
5/12    Are there any emacs modes for .l files (lex) and .y files (yacc)?  I'm
        running emacs20.  Thanks.
        \_ just use c-mode or c++-mode.
	...
2003/6/25-26 [Computer/SW/Compilers] UID:28839 Activity:high
6/25    When yacc man page refers to "LR(1) parser", is LR(1) a reference to
        some other man page or does LR(1) have some other special meaning?
                -clueless
        \_ some other special meaning, LR(1) is a style of parse tree
           generation that has certain limitatations.  Sort of like how
           reg exps can't search for all the things you want to search for
	...
2001/7/16-17 [Computer/SW/Languages/C_Cplusplus] UID:21812 Activity:moderate
7/16    Dear motd, is it true that the gnu implementation of C++ lacks
        <sstream>?  What gives?
        \_ see below on the bit on ali.  C++?  who cares.
           \_ what should we care about, java? eiffel? mh?
           \_ what should we care about, java? eiffel? ml?
              \_ Ocaml.
	...
2000/12/17 [Computer/SW/Compilers, Computer/Theory] UID:20114 Activity:high
12/14   I totally don't see any relevance in teaching Lambda calculus in an
        undergrad course to describe stupid semantic rules. Fuck Aiken and
        his stupid ambiguous exams!!!
              researcher)
           \_ usually to emphasize its distinction from an algebra.  keep
              in mind that "the calculus" taught in high school is
	...
2000/10/27-28 [Computer/SW/Languages/Java, Academia/Berkeley/Classes] UID:19586 Activity:insanely high
10/27   I have seen lots of cheating while in Berkeley.  Do any of you cheat?
        If so, how, why do you did it, and do you think it is justified?
        \_ in four years as a double major i never cheated.  no one i know
           in math or physics ever cheated.  cheating is for people in
           college for the degree only.
           \_ I.e. Business, Econ, IEOR
	...
2000/10/5-6 [Computer/SW/Compilers] UID:19421 Activity:very high
10/5    How do you know whether you're going to ace CS164 or barely going
        to pass it? I kick ass in flex and regular expression, but I'm
        having a little problem with this LL LR LALR theory. Help.
        \_ I hate compilers and I didn't understand half of the material, but
           for some reason the prof gave me an A+.  So being good/bad at the
           subject doesn't always mean you'll get a good/bad grade.
	...
2000/8/14-15 [Computer/Theory] UID:18977 Activity:high
8/13    Is there such a thing as an algorithm that can output another
        algorithm? Kind of like self tuning, self evolving algorithm?
        \_ Yes. Not as glamorous as it sounds; see also: genetic algorithms,
           Remez algorithms, data-directed programming
        \_ bison, yacc, (f)lex, and many many more. not self tuning though.
        \_ There are algorithmns that can learn from data.  It's really not
	...
2000/5/20-22 [Computer/SW/Languages/Misc] UID:18307 Activity:kinda low
5/20    When I need an spec/interface/extension language, I use
        0 my own language and lex+yacc
        1 my own language and my own lexer/parser
        <number value="0"/> XML
        2 scheme
        1 PROLOG!!!
	...
2000/1/19-20 [Computer/SW/Database] UID:17267 Activity:kinda low
1/18    Wanted 2 programmers to help develop web based apps:  Between the
        two, will need PERL, CGI, SQL, Yacc(or Bison), Javascript, HTML.
        Full time or Part time (20 hours minimum).  At least two weeks(tm)
        with possibilities of more if appropriate.  Work on-site (downTown
        Oakland)  or off-site. (510) 271-4142 ask for Garo, Alan or Ephram.
        -gargamel
	...