Find Jobs
Hire Freelancers

implement a command parser in perl

$100-500 USD

Cancelled
Posted almost 12 years ago

$100-500 USD

Paid on delivery
Convert an existing chunk of c code into a perl module. The existing code takes a string like "source:pulse:width2 100 ns", and breaks it into a numeric function code (source:pulsE:width = function 36), a channel number (2), a parameter (100), units (ns), and a command type (command_param_units). It can also loop through a "compound" command string, where multiple commands are separated by semi-colons. There are special "grammar" rules about processing compound commands. The commands follow the SCPI standard ([login to view URL]). See chapter 6 and a bit of chapter 7. Also, see section 2.1 of my instrument programming manual ([login to view URL]). You'll need to read them to understand the grammar. For example, "source:pulse:width2 100 ns" can also be written as "puls:widt2 100e-9". Some other valid commands are: pulse:width? frequency 1.1MHz freq 2000 freq 2.2 khz diag:eprom:float 1000 9e-9 diag:eprom:float? 1000 diag:ampl:cal:point 2 go *idn? *rst sour:pulse:width 1us;delay 2us;double off sour:pulse:width 1us;:source:volt 10;delay 2us;double off sour:pulse:width 1us;*rst;delay 2us;double off These are not valid according to the rules: width 100 ns sour:pulse:width 1us;sour:pulse:delay 2us;sour:pulse:double off This is a fairly direct translation with no change in basic functionality. The next code should be shorter, more elegant, and more robust, due to the use of a higher-level language like Perl and its string and regex functions. You'll need to confirm that the end code actually meets the SCPI standard, even if the original code had bugs. The original code came from an odd embedded development system, and may have unused variables and other minor quirks. Your will re-implement the "Parser_main" function in the attached zip file, and its support functions (Parser_*, String_trim*). You will only implement the parser, not any actual firmware functions (that set the pulse width, for example).
Project ID: 2758240

About the project

Remote project
Active 12 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of CANADA
Ottawa, Canada
5.0
61
Payment method verified
Member since Jan 18, 2006

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.