Parsing is the process of analysing a string of symbols, either in natural language or in computer languages, conforming to the rules of a formal grammar.

learn more… | top users | synonyms (1)

5
votes
1answer
26 views

String parsing and saving ipaddress to file in Java

Following function will parse string resp, which will be like shown in following example. I will get an IP address in the form of a hexadecimal string like ...
8
votes
3answers
84 views

Calculator using tokens of numbers and operators

Lately there has been some questions regarding calculators, where the response typically has suggested simplifying the logic and using either abstract syntax tree or token lists (like I did myself in ...
8
votes
3answers
219 views

Parsing expression with exponents and evaluating

I'm programming a basic command line calculator in java that can parse expressions and evaluate them, does not handle brackets yet. For example an expression: \$9+9/2^2*5-1\$. At this point I can ...
3
votes
0answers
19 views

Erlang linter written in Erlang using erl_lint:module

I've just started learning Erlang. Since my editor of choice doesn't have a syntax checker for Erlang, I decided to use the parser/linter in the standard library to make a standalone script. It works ...
7
votes
2answers
107 views

Usage of scanner

I have a legacy method which I would like to clean up: ...
3
votes
0answers
80 views

Solution to part 1 of Day 7 Advent of Code in Scala

Does someone want to review my solution to part 1 of Day 7 Advent of Code in Scala? The assignment is here: http://adventofcode.com/day/7 Without repeating the whole text, in short: Given a text file ...
2
votes
1answer
38 views

jQuery replace text with HTML plugin

I've written a jQuery Plugin which searches text & replaces it with other text or HTML. Now everything works quite well but recently I came across this SO question where the OP could have use of ...
3
votes
2answers
104 views

Lexer for C# source code

This code reads a .cs source file in the \bin folder and parses the C# code in it. The program outputs keywords, identifiers, separators and numerical constants. How could it be improved? ...
2
votes
1answer
22 views

Converting fraction notation in strings to a Rational data type

I've been messing around with a RationalInt type, using a simple int-based structure for the time being. I've created code to ...
9
votes
1answer
52 views

Tokenize s-expressions in Rust

I'm writing an s-expression tokenizer in Rust. I have the following code written, but it is not idiomatic Rust - it is quite ugly. TokenizerI is simply an ...
3
votes
2answers
41 views

Return the first number found greater than the provided input number (13 digits)

This script converts the numbers to be at least 13 characters long (for UNIX_MS strings). For use with timestamps, I'm having issues with it being very slow. I wanted an alternative to grepping for ...
2
votes
3answers
71 views

File parsing and data management - follow-up

This is part of a two-part post (Part 1). Here, I have two recent projects that parse a file. The first uses a loop that's kind of hard to follow, and the second uses "modes" to decide what to do. ...
3
votes
1answer
32 views

File parsing and data management

This is part of a two-part post (Part 2). Here, I have two recent projects that parse a file. The first uses a loop that's kind of hard to follow, and the second uses "modes" to decide what to do. ...
2
votes
2answers
94 views

Parsing from one enum to another

I face a problem I think I am not approaching appropiately. I have two independent enumerators that both will contain the same members, the only difference being the values given. I have to be able ...
8
votes
2answers
65 views

Port of NLTK tokenizing code from Python to Rust

I'm working on a port of NLTK to Rust. I am fairly new to Rust, so I wanted to post a small file to check if I was writing idiomatic Rust. I've included the original Python. The Python has docstrings ...
3
votes
0answers
47 views

Infix to Postfix Formula Parser Java

I've written a program that takes a mathematical formula as an user input and converts it from infix to postfix. It doesn't support negative numbers. The program doesn't depend on the user having to ...
1
vote
1answer
52 views

C# Parser of strings with list of assignments

I have implemented class which manages communication with measuring device, which sends list of assignments, like variableName=value. These assignments are always ...
1
vote
0answers
54 views

Parsing JSON with generics

I get back two dictionaries, I need to parse through them and put in an array two objects. I think I did a very poor job and I have a feeling there is a better way to make the code more compact and ...
1
vote
0answers
29 views

Java XML parsing

I am attempting to create XML forms using user input to populate certain areas that would appear when loaded into a STIG viewer. Right now everything is working enough for me to create this and have ...
4
votes
1answer
50 views

Parsing a command line

I've written an object which allows parsing and serializing a command line. I don't in any way consider this done, but this is the beginning of it. I know there are other implementations out there ...
4
votes
2answers
41 views

Compare Two Files

One of the K&R exercises is to write a small piece of software to compare two files and print the first line in which they differ. Here is my attempt: ...
3
votes
1answer
42 views

Simple CFG parser in C++

I have written a CFG (text file) parser for my specific needs. I have found other libraries to be much too large. Even other parsers that bill themselves as "simple" run hundreds of line long. The ...
4
votes
1answer
39 views

Word Counter Project

I recently read K&R The C Programming Language and wanted to write a small program to count the occurrence of each word in the input (std-input - I piped a file with all shakespeare pieces in ...
4
votes
2answers
95 views

Read firewall logs

I am still a Python beginner and would appreciate some help with this code. I am looking through some firewall log files, more specific all lines with Deny in them. For those files I am extracting ...
0
votes
1answer
29 views

Parsing an uploaded file, returning record of 10 fields for each line [closed]

I have a program that reads a .txt file from a given directory. Each record line contains a data and I am parsing it. I think this is costly with it comes to performance but I might be wrong. Here is ...
3
votes
1answer
58 views

Lazy attoparsec parser for log files

I've written a parser with the help of some experienced Haskellers. The parser is not bad, but the same kind of parser written in PHP7 with regular expressions is much faster (takes 25% of the time ...
2
votes
0answers
21 views

Haskell s-expression parser and quasiquoter

There are a number of questions on this site about s-expression parsing: e.g., Calculator parsing S-expressions and Code from "Write Yourself a Scheme in 48 Hours" tutorial. However, these ...
4
votes
3answers
130 views

Using argparse with parameters defined in config file

I understand that and why using eval is generally considered bad practice in most cases (see e.g. here). Related questions on config files and argparse don't use ...
2
votes
1answer
70 views

Parse Twine HTML to JSON

For those who don't know, Twine is just a simple interactive fiction making tool. It lets you easily create a series of passages that are hyperlinked to each other, making a choose your own adventure ...
4
votes
2answers
97 views

Representing and Parsing an Open or Closed Range

I would like to represent a numeric range in C#. Either open-ended, such as "up to 35" or "100 on up" or closed-ended, such as "34 to 65". I'd like to represent the open end with NULL. Further, I'd ...
3
votes
1answer
44 views

Css builder and parser

As part of a larger project I've created recently a simple CssBuilder and CssParser. It's composed of three classes and can ...
1
vote
1answer
68 views

Parsing a CSV file in node.js and express.js

I want to import a CSV file and do some operation on it. The following is the code I'm using and it is working fine: ...
2
votes
1answer
55 views

Replacing values in a file based on values in another file

I am writing Python code which reads through two text files and prints the output based on those two files. Basically, the first file, demo.txt, has a matrix of numbers and the second file, days.txt, ...
2
votes
1answer
36 views

JSON C pull parser

Back in the day in addition to DOM and SAX parsers for XML another parser type was relatively popular -- pull parsers. Recently I was looking for a JSON parser and figured that most JSON C parsers are ...
0
votes
2answers
63 views

Transforming CSS into an encoded representation

I have a java code that is supposed to format the content of a .css file so that I could use the result to make a enum class. ...
1
vote
1answer
46 views

Map all symbols in module to dictionary

The div and add functions are located randomly in my package structure. I have a function with this signature: ...
3
votes
2answers
72 views

Parsing an ini file

I have written a basic ini file parser in C. It won't support big ini files, and isn't very fast when fetching configuration values, but should be enough for small ones. I couldn't find "proper" ...
4
votes
1answer
98 views

Converting string to dict using Python ast library

I have been trying to convert a string of dictionary objects as given below ...
3
votes
3answers
67 views

Parsing an ExpandoObject into a typed class using reflection

I've spent some time writing a library to parse JSON into a statically typed object. Am I following most of the standard coding guidelines? Any thoughts on what I could do better, or any edge cases ...
6
votes
2answers
113 views

Parsing mathematical expressions in Reverse Polish Notation

I've wanted to make a calculator for a long time now, so I wrote one of my first parsers, where the input is in reverse polish notation, \$1 \ 1 +\$ becomes \$2\$. It supports to following operators; ...
1
vote
3answers
80 views

Implementation of IpV4Address

For legacy reason (guys here LOVE immutable object), I need a struct that contain an IpV4. I can't use System.Net.IPAddress because it's not a struct. So far here what I got: ...
6
votes
2answers
72 views

Parsing BibTeX files in Java

As part of a larger project to generate a website with a personal list of publications, I implemented a parser for BibTeX files. The entry point is the parseFile ...
12
votes
3answers
314 views

Lexer for C- in Python

I am currently taking a compilers course where we are designing a compiler for C- (which is a subset of C). Our first step was the lexer and I have written that but I believe that it is not very ...
6
votes
1answer
52 views

Perl parsing code

I've extracted a subroutine from some perl code I've written. (I also included the use enum line for easy reference.) Its purpose is to parse the given code, ...
5
votes
2answers
52 views

Process text file of fulltext articles from news publications

I'm relatively new to programming and have started writing some code for work. This script is something I wrote that I'd like to have someone comment on. Am I doing anything silly, stupid or totally ...
4
votes
2answers
75 views

Parsing mathmatical functions

I have finally finished a Ruby calculator project, which is not based on eval. Instead it parses input char by char. The project is hosted on GitHub. However, I find a specific part of the program ...
2
votes
2answers
45 views

K&R atoi() variation

I'm currently learning C with The C Programming Language by K&R and this is my current exercise: Rewrite appropriate programs from earlier chapters and exercises with pointers instead of array ...
4
votes
3answers
143 views

Extracting a database name from a file

I am developing a project that converts SQL server file to MySQL file based on some assumptions. I have written a function that takes the string source as input and it extracts the database name. Is ...
7
votes
3answers
214 views

Parsing pipe delimited lines

I am parsing the following line of code via a specific format. Line is: S|111111|87654321|Bar UK|BCreace UK|GBP|24/08/2010| The Format is: ...