473,785 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parser suggestion


Hi!
I'm needing a parser to retrieve some information from source code --
including parts of code -- from Fortran, to use in a project with a
documentation system.

Any recommendations on a Python app or parser that I could use for that?
Thanks,
--
Jorge Godoy <go***@ieee.org >

Sep 29 '05
11 1838
[Jorge Godoy]
You're someone [...]
You make me shy! :-) Nevertheless, thanks for the appreciation! :-)
It looks like it stopped being developed circa 2002...

How can I be sure that if I find a bug I'll be able to discuss it with
the developer if it's 3 years since the last release of his code?


SPARK is rock solid for me, and for the little doubts or improvements I
wanted, I remember having written to John Aycock, who always replied.
But of course, without having experienced it yourself, I understand that
one may have doubts. I also did not have any need for writing to Jonh
in a few years. In any case, SPARK is a single module file, and not
such a big one after all. I very slightly adapted it to my own needs
and habits, and merely copy it from project to project since then.

One warning is worth being told about SPARK. As it accepts a wider
variety of grammars, it uses algorithms that may be slow depending
on your grammar design, and may become slow when you have errors in
your source. Compromises are needed. In all cases I used it so far,
whenever the input to parse was sizeable, it was easy for me to split
the source in smaller chunks with boundaries recognisable by other
means, and calling the parser on each chunk instead of globally on the
whole thing. This yielded reasonable parsing speed in production code.

With SPARK, you have to provide a tokenizer. SPARK offers one based on
regular expressions as in Python, I found out I often prefer writing
my own instead. If you have to process FORTRAN code, you may have
some difficulty in this area (yet I may be all wrong by saying so, as
my FORTRAN is very rusty, and I did not keep up with the evolution of
FORTRAN standards). At a time in the past, FORTRAN did allow spurious,
ignored whitespace about everywhere outside strings, would it be within
identifiers. Whitespace can (could) also be spared between tokens where
it would have been clearly mandatory in any other language I know.

So, the split between the lexical and syntactic analysis for FORTRAN
is (or at least once was) fairly fuzzy. But this is theoretical. In
practice, FORTRAN programmers almost never resort to insane use of
whitespace. So you may probably resort to easier, standard two-level
analysis, rather than FORTRAN as formally defined, and still be winning!

--
François Pinard http://pinard.progiciels-bpi.ca
Sep 30 '05 #11
Take a look at PLY.
There is an example lexer in the download for parsing fortran.

Oct 12 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4262
by: annoyingmouse2002 | last post by:
Hi there, sorry if this a long post but I'm really just starting out. I've been using MSXML to parse an OWL but would like to use a different solution. Basically it reads the OWL (Based on XML) and puts values in a number of arrays and then puts the contents of the array in a HTML table. I'd like to keep the array structure. I've checked out all sorts of different javascript parsers but have not met with a great deal of success with any...
1
2705
by: Helge Ruistuen | last post by:
Hello, I'm using SAX parser to read a string of numbers defined as XML list type. Occasionally the 'characters' method is called twice, which means I need a buffer to read the entire string. My problem is that whenever "the split" (or second reading) occurs at a white space, I need to manually add a white space (avoid two number becoming one), while for the case that the parser start a second reading within a number, adding a white space...
16
6318
by: Mike | last post by:
Does anyone know of a minimal/mini/tiny/small xml parser in c? I'm looking for something small that accepts a stream or string, builds a c structure, and then returns an opaque pointer to that structure. There should then be a function to search that structure given the pointer, tag, and an optional attribute. I'm looking initially at only text data, no numbers, though eventuall there will be some binary data (CDATA?). Thanks.
2
2263
by: Alex | last post by:
Hello all, As I don't have any experience with XML parsers, I'm looking for your advice in this group. In the project I'm involved with, we are dealing with parsing of XML messages that are coming from server. The parser that we are currently using is not able to: - parse non-ASCII Unicode text - parse unary XML elements - parse the text block between XML elemnts
6
7383
by: Herby | last post by:
Hi, Im interested in Reverse Engineering C++ source code into a form more comprehensible than the source itself. I want to write a basic one myself, obviously i need to write a parser for the source code. Although this has some overlap with say a compiler it would also seem significantly different too.
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.