Questions tagged [parsing]
This tag denotes challenges where parsing input is a large / the main part of the challenge.
182
questions
2
votes
0answers
81 views
Simple regex parser [duplicate]
Let's parse some regex. Not quite the regex you are used to, but the formal regular expressions taught in courses on automata theory. Wikipedia knows what I'm talking about.
We have four operations. ...
30
votes
3answers
1k views
Help! My calculator broke! (Turn integer expression into calculator keystrokes)
Introduction
Help! I accidentally dropped my TI-84 calculator out my window (don't ask how) and it broke. I have a math test tomorrow and the only calculator I can find is one with these buttons:
<...
24
votes
52answers
2k views
Remove all occurrences of the first letter of a string from the entire string
Given an input string only containing the characters A-Z, a-z, and spaces, remove all occurrences of the uppercase and lowercase ...
19
votes
2answers
793 views
Dames, do some math!
The order of operations, PEMDAS, is a basic rule in mathematics telling us which order operations should be performed:
"Parentheses, Exponents, Multiplication and Division, and Addition and ...
18
votes
2answers
382 views
Minifying math statements
The Challenge
You are the owner of an amazing service called Coyote Beta, which magically answers math questions its users send to it over the internet.
But it turns out, bandwidth is expensive. ...
21
votes
15answers
3k views
Count the bytes of a program
Note 2: I accepted @DigitalTrauma's 6-byte long answer. If anyone can beat that I will change the accepted answer. Thanks for playing!
Note: I will be accepting an ...
6
votes
5answers
1k views
Remove Whitespace from a Java Program [closed]
In this challenge, you will be given the source code of a Java program. Your task is to write a function or full program that will remove the whitespace from this program. The whitespace-removed ...
19
votes
8answers
2k views
Find our missing dead
Challenge
Peter has risen again to save us from the duplicate challenges!
Peter Taylor is dead, and there's no doubt about it (well, apart from the huge amount of doubt we have... but just ignore ...
56
votes
2answers
6k views
Seriously, GolfScript, CJam, or Pyth?
Some time ago, the following question was asked: GolfScript, CJam, or Pyth?
Based on the title only, I thought that it would be a very nice challenge, but unfortunately, it turned out to be a question ...
9
votes
1answer
588 views
Where did you COME FROM?
INTERCAL is a wonderful language, but it is not always easy to understand other people's code. This is particularly the case if they use the COME FROM statement.
Challenge definition
Write a program ...
15
votes
4answers
1k views
The Lazy Programmer's XML Parser
Background
You are working as a programmer for a car sales company.
Your task for this week is to program an XML parser that takes in data about available models from different car manufacturers, and ...
16
votes
5answers
1k views
Code Golf : Parsing google results
When you search something on google, within the results page, the user can see green links, for the first page of results.
In the shortest form possible, in bytes, using any language, display those ...
10
votes
0answers
467 views
mini SPICE solver
SPICE is an electrical circuit simulation program originating from UC Berkeley. Your goal is to implement a minimalistic version which can solve for the nodal voltages and branch currents of a circuit ...
-5
votes
1answer
159 views
Compact XML Parser
Goal:
The goal of this challenge is to take a simple 6 row by 6 column XML file (without the standard XML header) and parse it out so that the program can return the value of a cell given it's ...
7
votes
16answers
892 views
Parse Query Parameters
The challenge is this:
You are given a url that is as follows:
http://sub.example.com/some/dir/file.php?action=delete&file=test.foo&strict=true
There ...
14
votes
6answers
495 views
Out-of-Control Rounding Errors
Background
You have recently been hired by a small accounting firm.
The world of accounting is somewhat foreign to you, so you're not sure whether you are following all the professional guidelines.
...
-3
votes
1answer
130 views
Listing links from pages — with error handling
In my previous question Debunking Stroustrup's debunking of the myth “C++ is for large, complicated, programs only”, a lot of people complained that comparison with Stroustrup's program isn't fair, ...
161
votes
57answers
39k views
Debunking Stroustrup's debunking of the myth “C++ is for large, complicated, programs only”
Stroustrup has recently posted a series of posts debunking popular myths about C++. The fifth myth is: “C++ is for large, complicated, programs only”. To debunk it, he wrote a simple C++ program ...
3
votes
4answers
644 views
Shortest parser for a left-recursive grammar
Write the shortest parser for the grammar:
M -> M + n | n
Output must be some representation of a structured value representing the concrete syntax tree ...
11
votes
4answers
839 views
Reduce html to n characters while keeping the formatting
Almost every language has a built-in function that can split a string at a given position. However, as soon as you have html tags in the string, the built-in function will not work properly.
Your ...
11
votes
2answers
669 views
Apply English punctuation rules
You've been hired to write some code for a dictation-taking app, which takes voice input from a spoken source, parses it as words, and writes it down on a screen.
The management doesn't really trust ...
4
votes
28answers
1k views
Implement an integer parser
Implement an integer parser in the shortest code possible, with the following restrictions:
The function or program can only take one argument: a string (or equivalent). Assume it to be signed and ...
12
votes
10answers
1k views
Line up the CSV
Overview:
Your job is to take CSV input in key=value format and line it up in a more organized (see below) way.
Input:
Always via stdin. Records will always be ...
19
votes
10answers
3k views
Create a programming language interpreter [closed]
Task:
You must create an interpreter that can parse snippets of a programming language. The language does not need to be complex, but it must include the following syntactical elements:
Ability to ...
14
votes
12answers
2k views
Brainf*ckish directions
Your task – should you choose to accept it – is to build a program that parses and evaluates a string (from left to right and of arbitrary length) of tokens that give directions – either left or right....
33
votes
18answers
3k views
Code Romanization
The challenge is to make any Roman numerals valid code in your chosen language.
They should not appear inside of strings or anything similar, but work just like any other tokens, literals such as (...
12
votes
2answers
575 views
Interpret a circuit diagram
Your challenge is to interpret a circuit diagram, complete with logic gates.
Logic gates (you don't actually need to know what these do / are to complete this challenge):
and gate: ...
9
votes
1answer
653 views
Transform 7-segment display pattern into number
Given A and B, where A is the scale of a Digital LED Pattern B. Parse pattern B and print the number.
input:
...
7
votes
5answers
496 views
Mechanical Coding
The goal is to calculate the output speed of a series of cogs. The winner will be chosen by popular vote.
The arrangement of cogs is defined in an ASCII-art string:
...
10
votes
3answers
526 views
Expand tabs (implement expand(1))
Your task this time is to implement a variant of the POSIX expand(1) utility which expands tabs to spaces.
Your program is to take a tabstop specification and then ...
13
votes
7answers
3k views
Reverse words without changing capitals or punctuation
Create a program with the lowest amount of characters to reverse each word in a string while keeping the order of the words, as well as punctuation and capital letters, in their initial place.
By "...
9
votes
5answers
594 views
Simple Tag Parser
This is a model of a forgiving HTML parser. Instead of parsing HTML and extracting attributes, in this code golf, the tag parser will be simple.
Write a function that parses a tag structure and ...