Tagged Questions
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.
-1
votes
1answer
30 views
Construct: (un)dumping bytes to hex
This code is part of the Construct library. Docstrings explain what the code is supposed to do.
...
-2
votes
1answer
22 views
Construct: VarInt integer encoding
This code is part of the Construct library. Docstrings explain what the code is supposed to do.
...
0
votes
2answers
43 views
Parsing a string into a double
I'm trying to understand the strtod() function, and how I can handle any user input given to the function. I assume I tested for everything, however I am hoping for ...
0
votes
0answers
41 views
libconfini (shared library)
I recently wrote a small INI parsing library. The code is also on GitHub, with documentation. I would like to have opinions, suggestions, and critiques.
confini.h
...
2
votes
0answers
16 views
Spider for House Price Website
hey guys how you all doing,
I built a spider that crawls through a house price website and stores houses address and transactions on it, through a bunch of functions, and I was wondering if anyone ...
7
votes
1answer
290 views
Implementation of tokenizer object and finite state machine in C
I was given an assignment to create an implementation of a tokenizer object (by object, I mean a struct with associated functions that operate on instances of the struct). This tokenizer retrieves ...
8
votes
1answer
103 views
+100
Log sorting program
This is my first ever program written in Rust (after reading the book). It is small tool to sort all lines from stdin according to two criteria. First one is time ...
5
votes
1answer
96 views
Delete all comments in a C program
I am new to C. And I just want to know if my code is horrible or not. I tried to make program to delete all comments in C program. It's from "The C Programming Language Second Edition" book, Exercise ...
4
votes
2answers
121 views
Tokenize a string
I used strtok to tokenize a string. But many developers said me to avoid strtok, why? How should I optimize this code? Is it ...
6
votes
2answers
62 views
Parse a file containing key-value pairs followed by coordinates of nodes in a graph
I've a file which is divided into two parts:
The header
The data part
The header has of course a different format than the data part. The header part contains lines that look like this ...
1
vote
0answers
38 views
Building DOM tree from XML, checking/updating player's average score
This is the first time I'm parsing an XML file. So I will be grateful for any suggestions on how my code may be improved. Or if you could suggest another approach to solving this problem.
One other ...
1
vote
0answers
37 views
Record parsing to Scala Object with some unknown fields
I am getting some customer data but doesn't know the complete schema beforehand.I want to parse this data and create a Scala object from it.But due to unknown fields in the record I fill only the ...
3
votes
2answers
18 views
Parsing and extracting all IDs from a document (using regex with capture)
I'm interested in parsing and extracting the IDs found in a document. The IDs are found throughout the document in the this format:
IDStart=1FG3392MQ9&IDEnd
The "1FG3392MQ9" is an example ...
3
votes
1answer
124 views
Shunting-yard algorithm for expression parser
After reading about the Shunting-yard algorithm, I decided to try to make a expression parser, before trying to make a actual language parser, using it. The way i translated the algorithm into C++ ...
8
votes
2answers
983 views
Reading a repetitive file with repetitive code
I made this code for take some data from a .txt file. The text file is a large list of data from temperature with a format that is repetitive and have some lines at the beginning with the station ...
3
votes
1answer
50 views
hl7 parser with fparsec
I have a little experience working with .hl7 data (format for transmitting health data), so I decided to try and write an .hl7 parser using fparsec.
A standard .hl7 segment is a single line with:
...
4
votes
2answers
93 views
LINQish command line parser
I needed to parse some command line switches from a string and I tried to do it the easy way so I just wrote this:
...
3
votes
0answers
38 views
Parser for an bifurcation analysis tool
So during my thesis I used xppaut quite extensively. In the end there were some minor problems and I decided to have a look at the code, which was just released at github.
So after 30 years of on and ...
3
votes
2answers
26 views
Getting columns from lines of uneven length
I am given pasted data from a table, so I have spaces as delimiters and in some of the fields I don't care about. I want the first field and the last three fields, and got them using this code:
...
2
votes
0answers
195 views
Console command parser for my custom Libgdx console (gamedev)
For a game I'm writing using LibGDX framework and Kotlin language, I've decided to make a dev console. This is a WIP line parser. Since there's already a decent amount of code written I've decided to ...
0
votes
1answer
58 views
Grammar lexer in C++
Here is a lexer for a grammar I'm designing. After benchmarking with 1MB files and having several iterations of the lexer, I found that coping the file being read into a buffer and lexing that buffer ...
3
votes
1answer
114 views
2
votes
1answer
56 views
Overly complicated parser combinator
I recently started to learn Haskell in order to write some small tools for me. Currently I'm working on a program which calculates how much steam a (railcraft) boiler of a given size outputs per tick.
...
6
votes
2answers
106 views
16
votes
5answers
3k views
Program that removes comments from C and C++ programs
I have downloaded the latest version of the Linux kernel and I want to perform thorough analysis on it. I want to start by eliminating comments from all the source and header files that belong to it. ...
1
vote
0answers
20 views
Functional-style Cocoa XML serializer and object mapper
I'm working on an XML-to-model-object serialization and deserialization library. There are three main design goals for the code:
It should parse XML into and serialize from Cocoa-native collection ...
3
votes
4answers
217 views
CSV parsers and OrderedDictionary
I wrote the following (static) class to read files easily in C#. However, it is a static class, so I wonder if there would be a gain to make it a non static method (and therefore, passing arguments as ...
5
votes
2answers
108 views
Creating a simple Interpreter for the Quartz language
I've been trying to improve my C++ skills, and deiced to try my hand at making a interpreter for a toy language. The language is called Quartz, and so far the only thing you can do is output strings. ...
2
votes
0answers
25 views
List of lists from file
I'm writing a sub-routine in AppleScript to get text from a file and insert that text in a list of lists forming a dictionary.
Text File:
a:b
c:d
e:f
Expected ...
5
votes
0answers
75 views
Function to conect to Firebase Rest API via Access VBA
This is the application for small school, which will store students' info in Firebase and also retrieve data from Firebase. I am using JSON Parser to parse the data and save the same in Access tables.
...
8
votes
1answer
78 views
HTML Parser (using SAX)
Got bored writing a review on an HTML parser and decided I wanted to try.
So I threw this together to see I could parse an Amazon page.
...
3
votes
2answers
87 views
HTML parsing algorithm for extracting <a> tags
My intention is to create a complete HTML parser, so far I made a basic algorithm that iterates trough text and extracts everything in an "a" tag.
It works on everything I tried, but I want a review ...
3
votes
0answers
78 views
CSV file parser and compare
This may seem like a lot of stuff? I just need help with 2 small parts the code works, however I have provided the rest of the info in case some one can help. USING PYTHON 3.4
Code below is ...
1
vote
2answers
52 views
Phone number/email regex verifier
Is there anything I can do better here? I tried looking for ways to simplify this with comprehension but could not figure out how and was told it is better to explicitly use ...
6
votes
3answers
636 views
Determine if a file is either in JSON or XML format
The purpose of this function is to determine if report_input_file is either in JSON format or XML format, this is what I came up with, just want to know if this is ...
3
votes
0answers
46 views
Facet for simple math expressions
I've built simple math expression facet which ignores any character except numbers and operators listed below:
plus, minus, multiply, divide, degree, left bracket, right bracket, assignment
I'm ...
1
vote
0answers
51 views
Moving a div inside p by to the body element
I get malformed HTML input with divs inside other HTML elements like the ...
2
votes
1answer
48 views
Processing a string containing product variants
I have a variable containing a string in this format "Size-XS|Size-XL|Color-Red|Color-Green". When i process it the final result is "Variations: Size: XS, XL, Color: Green, Red. The code for this is ...
6
votes
2answers
81 views
Simple ini file parser
The below is a C++ parser for a reasonably simple INI grammar (although my understanding is that there isn't an official spec as such).
My grammar is roughly:
...
9
votes
2answers
459 views
Break a full name into a dictionary of its parts
It seems like I'm repeating myself here. Is there a standard way to deal with code like this?
...
2
votes
1answer
42 views
Efficiently calculating differences between file using diff file
I'm using SVNKit to get diff information between two revisions. I'm using the diff utility to generate a diff file, however I still need to parse it into numbers.
I implemented a solution, but it is ...
0
votes
1answer
46 views
JavaScript to parse json that can be, string, object and array
I have to parse a json object that can be a string, array, array of strings and array of object. I realised that it's not good from the beginning that one object can be many types, but I can't change ...
2
votes
1answer
54 views
Optimizing Java HTML parser
I wrote a program that goes through a webpage and returns matches of regex. I used it on my letterboxd.com account to go through all of my movies (over 900 entries) and then find genres field for each ...
3
votes
1answer
63 views
Haskell Parsec parser of Verilog-style number literals
I've set myself the task to write a function that parses Verilog-style number literals. In Verilog, numbers are written like this:
8'b10101100, ...
6
votes
3answers
79 views
Bash script to extract HTML comment into a Markdown file
I learned Bash a million years ago. I just wrote this simple script used to get the first lot of HTML comments from a file, and spit it out in order to create a ...
3
votes
3answers
68 views
Parse 2D matrix, 2 versions
I'm writing a little C program that computes matrices (for learning purpose). The matrix is fed through arguments in the following form : "{{43,543.324,34},{43,432,87}}"
The user doesn't give the ...
1
vote
1answer
39 views
Parsing latitude and longitude, using Try[T] to ignore errors
I wrote this question asking about how to implement my error handling while still maintaining functional code and based on 200_success's very interesting note on the spaces, I decided to ...
3
votes
0answers
18 views
Decompose string into parenthesed blocks in OCaml
The purpose of the OCaml code below is to decompose (or "parse")
a string into parenthesed (or possibly non-parenthesed) blocks.
...
3
votes
2answers
55 views
Convert a String with comma separated latitudes and longitudes to a Seq[Coordinate]
I have a function that receives a String like the following:
"-10.0 -10.0,10.0 10.0,0.0 0.0"
And needs to translate that into ...
1
vote
2answers
73 views
Postman collection parser which injects collection to Jira/xray addon
I'we created an interface that communicates with Postman collection and Jira api more precise the Xray addon for jira.
I would much appreciate if you could give me notes on how to improve this code.
...