01-13-2011
I usually deal with such parsing tasks with a little state machine that normlizes the C into one string block with all white space down to one or zero spaces as allowed. The state machine parses bytes until the end of declaration, knowing when it is in comments and in quotes, and the depth of any (){}[] has cancelled down to 0. The block might get very big, so it might be good to abstract out whatever is in {}, as you must reparse inside {} to see what is declared there. The code needs to be preprocessed so macros are expanded, and the parser needs to keep track of the files and line numbers it is in via include: # line_number "file_name"
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Is there a way to determine if a Script is called from a
CRON job or from a commandline
Gerry. (2 Replies)
Discussion started by: jerryMcguire
2 Replies
2. Shell Programming and Scripting
last week i started learning perl, so have limited skill and knowledge.
why isn't 'die' being called and the script exiting before the 'directory created' line?
if (! -d "$logdir") {
system "mkdir -p $logdir" || die print "\nERROR: release log directory creation failed - $logdir: $!\n";... (4 Replies)
Discussion started by: mjays
4 Replies
3. Shell Programming and Scripting
Hi,
First I will tell my objective of this function (function one).
I have a table for ex:
id passwd name
-- ------ -----
1 fdhgfs werwer
2 fsdfs sdfsdf
3 sdfs sdfsdf
4 fdsfs dssdf
. . .
.
.
.
The id, passwd and name are the arguments for another function say two. (1 Reply)
Discussion started by: mercuryshipzz
1 Replies
4. UNIX for Dummies Questions & Answers
I want to write a shell script which traverses a cpp file.
Suppose there is function fncn_name6 .. which is called by fncn_name5
which in turn called by fncn_name4 and so on .. in a single cpp class.
ie
fncn_name1
{
fncn_name2
{
fncn_name3
}
{
fncn_name4
}
}
so fncn_name1 is... (2 Replies)
Discussion started by: ultimatix
2 Replies
5. UNIX for Dummies Questions & Answers
i have taken a screen shot of the question. http://www.magicscreenshot.com/MagicScreenshot/REAdbT956kE.png
Please some one help me.:) (1 Reply)
Discussion started by: kjamsheed
1 Replies
6. Programming
how?
there is html-page with:
<iframe>
<!--#exec cgi="perl-script"-->
</iframe>
so in that perl-script need to delegate the name of html-page
why? too lazy for ajax (3 Replies)
Discussion started by: tip78
3 Replies
7. Shell Programming and Scripting
I am using blow script :--
#!/bin/bash
FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not
if
then
# echo "process found"
exit 0;
else
echo "process not found"
exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies
8. Programming
I would like to use Perl in 'interactive' mode (kind off), starting it by
> perl -d -e 0;
But I need to have some function be read on loading.
Also, it should not be for anyone who starting Perl or use it any how.
I did try to search, but not much result.
I have try a file '.perldb':... (1 Reply)
Discussion started by: alex_5161
1 Replies
9. Shell Programming and Scripting
In the below script i found that the alias mkdir_s is getting invoked from function configure() i.e the alias is kicking in.
#!/bin/bash -e
shopt -s expand_aliases
alias mkdir=mkdir_s
mkdir_s(){
if ]; then
return
else
/usr/bin/mkdir "$1"
return
fi
}
configure()
{
mkdir -p... (9 Replies)
Discussion started by: mohtashims
9 Replies
10. UNIX for Beginners Questions & Answers
I want to find c function definition with pattern with shell script by checking condition for each line:
data_type
functionname(param_list){
....
}
I knew cscope or ctag is usable for this task, but if there any ways to do without using them.
I am thinking of checking line condition... (3 Replies)
Discussion started by: cmdcmd
3 Replies
LEARN ABOUT MOJAVE
me_intro
grammar::me_intro(n) Grammar operations and usage grammar::me_intro(n)
__________________________________________________________________________________________________________________________________________________
NAME
grammar::me_intro - Introduction to virtual machines for parsing token streams
DESCRIPTION
This document is an introduction to and overview of the basic facilities for the parsing and/or matching of token streams. One possibility
often used for the token domain are characters.
The packages themselves all provide variants of one virtual machine, called a match engine (short ME), which has all the facilities needed
for the matching and parsing of a stream, and which are either controlled directly, or are customized with a match program. The virtual
machine is basically a pushdown automaton, with additional elements for backtracking and/or handling of semantic data and construction of
abstract syntax trees (AST).
Because of the high degree of similarity in the actual implementations of the aforementioned virtual machine and the data structures they
receive and generate these common parts are specified in a separate document which will be referenced by the documentation for packages
actually implementing it.
The relevant documents are:
grammar::me_vm
Virtual machine specification.
grammar::me_ast
Specification of various representations used for abstract syntax trees.
grammar::me::util
Utility commands.
grammar::me::tcl
Singleton ME virtual machine implementation tied to Tcl for control flow and stacks. Hardwired for pull operation. Uninteruptible
during processing.
grammar::me::cpu
Object-based ME virtual machine implementation with explicit control flow, and stacks, using bytecodes. Suspend/Resumable. Push/pull
operation.
grammar::me::cpu::core
Core functionality for state manipulation and stepping used in the bytecode based implementation of ME virtual machines.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category gram-
mar_me of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may
have for either package and/or documentation.
KEYWORDS
CFG, CFL, LL(k), PEG, TPDL, context-free grammar, context-free languages, expression, grammar, matching, parsing, parsing expression gram-
mar, push down automaton, recursive descent, top-down parsing languages, transducer, virtual machine
CATEGORY
Grammars and finite automata
COPYRIGHT
Copyright (c) 2005 Andreas Kupries <andreas_kupries@users.sourceforge.net>
grammar_me 0.1 grammar::me_intro(n)