Sponsored Content
Top Forums Programming When I am writing my own interpreter... Post 302142356 by bakunin on Thursday 25th of October 2007 05:13:10 PM
Old 10-25-2007
It may not directly help you, but this is the document inventing the pipes, i just stumbled across it on the net: pipes invented

The best information about recursively parsing and techniques of lexical analysis is still the "Dragon book" (real Name: Compilers: Principles, Techniques, and Tools) by Aho, Sethi and Ullmann (depending on you level of you pre-education, but you come across like you should be able to understand it). The authors offer better advice in this regard than perhaps any of us could provide.

bakunin
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

an command interpreter

if somebody can help me pls. i need the source code for a shell which compiles C or java programs. i need a very short and simple one, just for the compiling part, in UNIX Respect (4 Replies)
Discussion started by: zlatan005
4 Replies

2. UNIX for Dummies Questions & Answers

m4 as script interpreter

#!/usr/bin/m4 when running m4 scripts with "#!/usr/bin/m4" they are executed properly, but "#!/usr/bin/m4" is printed out - how to avoid it? Thanks in advance. (5 Replies)
Discussion started by: Action
5 Replies

3. Programming

Java Interpreter

Hello guys - do you have any sample program implementing UNIX commands in an interpreter with Java? I can look up the simple ones such "ls" etc and then write my own commands. I would appreciate it. (2 Replies)
Discussion started by: cmontr
2 Replies

4. Shell Programming and Scripting

Multiple interpreter declarations

Hi, I am writing a shell script that connects to a remote server and performs some tasks on the server and exits. Since i am using a ssh connection, i am using a "expect" utility to supply the password automatically (which is present within the script). In order to use this utility, i need to... (3 Replies)
Discussion started by: sunrexstar
3 Replies

5. Shell Programming and Scripting

Bad Interpreter

Hi. My name is Caleb (a.k.a RagingNinja) form the whited00r forums. (Whited00r makes custom firmware for iOS devices). I have been learning and creating simple shells scripts. I have been recently using VIM for Windows or using VirtualBox to run the UBUNTU OS within VirtualBox to create my shell... (2 Replies)
Discussion started by: RagingNinja
2 Replies

6. Linux

interpreter files

Can you explain me what is ment by interpreter files ?? Why and how they are used?? (1 Reply)
Discussion started by: kkalyan
1 Replies

7. Shell Programming and Scripting

Dynamically choosing the interpreter

Hi, Is it possible to choose the inerpreter conditionally. For example, if whereis bash returns /usr/bin/bash then i need to choose #!/usr/bin/bash else i need to use #!/usr/bin/sh. Is it possible to achieve in a shell script? Thanks (1 Reply)
Discussion started by: pandeesh
1 Replies
EYAPP(1)						User Contributed Perl Documentation						  EYAPP(1)

NAME
eyapp - A Perl front-end to the Parse::Eyapp module SYNOPSYS
eyapp [options] grammar[.eyp] eyapp -V eyapp -h grammar The grammar file. If no suffix is given, and the file does not exists, .eyp is added DESCRIPTION
The eyapp compiler is a front-end to the Parse::Eyapp module, which lets you compile Parse::Eyapp grammar input files into Perl LALR(1) Object Oriented parser modules. OPTIONS IN DETAIL
-v Creates a file grammar.output describing your parser. It will show you a summary of conflicts, rules, the DFA (Deterministic Finite Automaton) states and overall usage of the parser. Implies option "-N". To produce a more detailed description of the states, the LALR tables aren't compacted. Use the combination "-vN" to produce an ".output" file corresponding to the compacted tables. -s Create a standalone module in which the parsing driver is included. The modules including the LALR driver (Parse::Eyapp::Driver), those for AST manipulations (Parse::Eyapp::Node and Parse::Eyapp::YATW)) and Parse::Eyapp::Base are included - almost verbatim - inside the generated module. Note that if you have more than one parser module called from a program, to have it standalone, you need this option only for one of your grammars; -n Disable source file line numbering embedded in your parser module. I don't know why one should need it, but it's there. -m module Gives your parser module the package name (or name space or module name or class name or whatever-you-call-it) of module. It defaults to grammar -o outfile The compiled output file will be named outfile for your parser module. It defaults to grammar.pm or, if you specified the option -m A::Module::Name (see below), to Name.pm. -c grammar[.eyp] Produces as output (STDOUT) the grammar without the actions. Only the syntactic parts are displayed. Comments will be also stripped if the "-v" option is added. -t filename The -t filename option allows you to specify a file which should be used as template for generating the parser output. The default is to use the internal template defined in Parse::Eyapp::Output.pm. For how to write your own template and which substitutions are available, have a look to the module Parse::Eyapp::Output.pm : it should be obvious. -b shebang If you work on systems that understand so called shebangs, and your generated parser is directly an executable script, you can specify one with the -b option, ie: eyapp -b '/usr/local/bin/perl -w' -o myscript.pl myscript.yp This will output a file called myscript.pl whose very first line is: #!/usr/local/bin/perl -w The argument is mandatory, but if you specify an empty string, the value of $Config{perlpath} will be used instead. -B prompt Adds a modulino call '__PACKAGE->main(<prompt>) unless caller();' as the very last line of the output file. The argument is mandatory. -C grammar.eyp An abbreviation for the combined use of -b '' and -B '' -T grammar.eyp Equivalent to %tree. -N grammar.eyp Equivalent to the directive %nocompact. Do not compact LALR action tables. -l Do not provide a default lexical analyzer. By default "eyapp" builds a lexical analyzer from your "%token = /regexp/" definitions grammar The input grammar file. If no suffix is given, and the file does not exists, an attempt to open the file with a suffix of .eyp is tried before exiting. -V Display current version of Parse::Eyapp and gracefully exits. -h Display the usage screen. EXAMPLE
The following "eyapp" program translates an infix expression like "2+3*4" to postfix: "2 3 4 * +" %token NUM = /([0-9]+(?:.[0-9]+)?)/ %token VAR = /([A-Za-z][A-Za-z0-9_]*)/ %right '=' %left '-' '+' %left '*' '/' %left NEG %defaultaction { "$left $right $op"; } %% line: $exp { print "$exp " } ; exp: $NUM { $NUM } | $VAR { $VAR } | VAR.left '='.op exp.right | exp.left '+'.op exp.right | exp.left '-'.op exp.right | exp.left '*'.op exp.right | exp.left '/'.op exp.right | '-' $exp %prec NEG { "$exp NEG" } | '(' $exp ')' { $exp } ; %% Notice that there is no need to write lexer and error report subroutines. First, we compile the grammar: pl@nereida:~/LEyapp/examples/eyappintro$ eyapp -o postfix.pl -C Postfix.eyp If we use the "-C" option and no "main()" was written one default "main" sub is provided. We can now execute the resulting program: pl@nereida:~/LEyapp/examples/eyappintro$ ./postfix.pl -c 'a = 2*3 +b' a 2 3 * b + = When a non conformant input is given, it produces an accurate error message: pl@nereida:~/LEyapp/examples/eyappintro$ ./postfix.pl -c 'a = 2**3 +b' Syntax error near '*'. Expected one of these terminals: '-' 'NUM' 'VAR' '(' There were 1 errors during parsing AUTHOR
Casiano Rodriguez-Leon COPYRIGHT
(c) Copyright 2006 Casiano Rodriguez-Leon This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. SEE ALSO
o Parse::Eyapp, o perldoc vgg, o The tutorial Parsing Strings and Trees with "Parse::Eyapp" (An Introduction to Compiler Construction in seven pages)> in o The pdf file in <http://nereida.deioc.ull.es/~pl/perlexamples/Eyapp.pdf> o <http://nereida.deioc.ull.es/~pl/perlexamples/section_eyappts.html> (Spanish), o eyapp, o treereg, o Parse::yapp, o yacc(1), o bison(1), o the classic book "Compilers: Principles, Techniques, and Tools" by Alfred V. Aho, Ravi Sethi and o Jeffrey D. Ullman (Addison-Wesley 1986) o Parse::RecDescent. perl v5.12.5 2011-01-30 EYAPP(1)
All times are GMT -4. The time now is 08:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy