5.0

5.0 | 3 ratings Rate this file 9 Downloads (last 30 days) File Size: 14.51 KB File ID: #3915
image thumbnail

fparser: a pedestrian m-file parser and tokenizer

by us

 

31 Aug 2003 (Updated 12 Dec 2005)

lists ML-tokens and constructs (function, var, struct assignment) in a m-file or from a command line

| Watch this File

File Information
Description

FPARSER parses a M-file or command line
and list tokens and constructs:
- functions/keywords
- variables/constants
- struct field assignments

see the accompanying published m-file for an example

Acknowledgements
This submission has inspired the following:
Toward a program development and documentation toolbox
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
21 Dec 2004 Fu-Sung Wang

The concept of parsing a MATLAB file is new to me. I guess that can help programmers to analyze the cost of the script, in a manner of minimum number of variables, functions, etc...Anyway, I have to parsing this great work first.

19 Jan 2006 Andrej Mosat

The file is well commented, some lines are cryptic, but thats good for learning new programming styles :-) Excellent tool for compiling a documentation of your project.
Some remarks:
variable i: (output of the fparser):
i > 11 built-in (C:\install\Matlab\toolbox\matlab\elmat\i)
That is true, but in my context I use it exclusively as a counter (for i=1:N)
And one question: what exactly represents:
 .nstok nr of STRUCT.FIELD assignments ?
Thank you.

11 Jul 2011 Charles Tatum

Excellent work! Here's a fresh bug report:

Code 'idx>0' gets tagged as a field rather than an expression.

18 Jul 2011 Ronan

Very useful function. thanks.

Found 1 bug. Comment on lines after a function "end" seem to cause an error.

R

Please login to add a comment or rating.
Updates
02 Sep 2003

added help, refined output

02 Sep 2003

additional parser capabilities

02 Sep 2003

added option to enter a command line (user request)

02 Sep 2003

added option to enter a command line (user request)

03 Sep 2003

removed command_line mode restriction (user request); ver_tag: 03-Sep-2003 14:53:14

06 Dec 2004

1) added user requested options (john peach/ll.mit.edu): by default, run-time display of results is now available via -d option; otherwise, use par.res
2)put very long usage example into html file
3) ver tag: 05-Dec-2004 18:20:34

12 Dec 2005

changed a struct assignment issue; ver tag 12-Dec-2005 09:26:17

Tag Activity for this File
Tag Applied By Date/Time
script us 22 Oct 2008 07:07:02
function us 22 Oct 2008 07:07:02
variable us 22 Oct 2008 07:07:02
structure us 22 Oct 2008 07:07:02
lexical us 22 Oct 2008 07:07:02
parser us 22 Oct 2008 07:07:02
decode us 22 Oct 2008 07:07:02
token us 22 Oct 2008 07:07:02
parser Joydeep 17 Mar 2010 12:09:27
lexical Joydeep 17 Mar 2010 12:09:32
decode Onur 15 Sep 2010 15:37:09
decode Nathan 31 Oct 2011 11:46:16

Contact us at files@mathworks.com