Questions tagged [parsing]

This tag denotes challenges where parsing input is a large / the main part of the challenge.

Filter by
Sorted by
Tagged with
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 ...
79
votes
16answers
4k views

Defeat SVGCaptcha

I came across SVGCaptcha, and immediately knew it was a bad idea. I would like you to show just how bad an idea this is by extracting the validation code from the SVG images that code produces. An ...
75
votes
84answers
10k views

Count of “a”s and “b”s must be equal. Did you get it computer?

In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated: mainly because this language ...
72
votes
16answers
14k views

The World's Smallest Web Browser

Backstory: You enjoy your new programming job at a mega-multi-corporation. However, you aren't allowed to browse the web since your computer only has a CLI. They also run sweeps of all employees' ...
70
votes
23answers
7k views

Well that's odd… no wait, that's even!

Preamble Integers are always either even or odd. Even integers are divisible by two, odd integers are not. When you add two integers you can infer whether the result will be even or odd based on ...
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 ...
46
votes
26answers
5k views

Translate oOo CODE

Given an input of a program written in oOo CODE, output the BF code that it represents. Here is a short description of how oOo CODE works: First, all non-alphabetic characters are removed (...
45
votes
13answers
3k views

Golf my Shakespeare quote references

While writing my essay for Shakespeare, I realized that I needed to shorten my quote references to more manageable lengths. I had previously been writing this: ...
41
votes
12answers
4k views

Read out the C variable declaration

Background Variable declaration statement in C consists of three parts: the name of the variable, its base type, and the type modifier(s). There are three kinds of type modifiers: Pointer ...
37
votes
1answer
1k views

Guess how to pronounce German words

Introduction Unlike English, German is considered to have quite a phonemic writing system. That means that the correspondence between spelling and pronunciation is close. Given any word you aren't ...
36
votes
25answers
4k views

Expand a C array

In the C programming language, arrays are defined like this: int foo[] = {4, 8, 15, 16, 23, 42}; //Foo implicitly has a size of 6 The size of the array is ...
36
votes
15answers
3k views

Will I tip over?

Overview Given a 3 line string, figure out if the structure falls to the left, balances, or falls to the right. Input structure You can imagine the structure as metal rod with stuff on top, all ...
34
votes
28answers
4k views

Please release me!

As code-golfers, we're not used to releasing (surely). We're gonna need a few tools to help us do that. Of course, to help marketing a new release, we need a nice and shiny Release Version. Who doesn'...
34
votes
8answers
4k views

Read ASCII-Art Text

Inspired by Golf me an ASCII Alphabet, of which this challenge is (almost) a direct inverse. Task: Take a string of ASCII-art text and output the content of the text as regular ASCII text. Input: ...
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 (...
32
votes
9answers
5k views

Remove unnecessary parentheses

You are given a string composed with the characters 0123456789+*(). You can assume that string is always a valid mathematical expression. Your task is to remove ...
32
votes
1answer
2k views

Generate Pyramid Scheme code

Pyramid Scheme is a language being developed by @ConorO'Brien. In Pyramid Scheme, the code that you write looks like this: ...
30
votes
25answers
4k views

Robot on a ladder

Background I have a ladder leaning on a wall, and a remote-controlled robot that can climb it. I can send three different commands to the robot: UP: the robot ...
30
votes
20answers
3k views

Parse the comments out of my esoteric code

Earlier this week, we learned about how to format esoteric languages for commenting. Today, we're going to do the inverse of that. I need you to write a program or function that parses some well-...
30
votes
20answers
1k views

Locate and rotate

The task This is a simple challenge. Your input is a single non-empty string, containing only digits 0123456789 and hashes #. ...
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: <...
29
votes
10answers
1k views

Santa's Decision

Santa's Decision: In this challenge, you will help Santa Claus decide whether somebody on their list has been naughty or nice, and subsequently get coal or ...
28
votes
19answers
2k views

URL-Friendly Titles

People on this site really love to embellish their post titles... Stewie's sequence: + * - / + * - / However, when this title needs to be included in the page ...
28
votes
1answer
417 views

Count spelling errors in text; minimize the number of spelling errors in your code

Write a program or function that takes two inputs: A text message The dictionary of English language, as it appears in this Github file (containing about 60000 words) and outputs the number of ...
27
votes
39answers
5k views

12 hour to 24 hour time converter

Amazingly, this simple task doesn't seem to exist already, so... Your task is to write a program that takes as input a 12 hour time, and converts it into "military time", or 24-hour time format. ...
27
votes
27answers
4k views

Parse a C++14 integer literal

According to http://en.cppreference.com/w/cpp/language/integer_literal, integer literals consist of a decimal/hex/octal/binary literal and a optional integer suffix, that is obviously completely ...
27
votes
9answers
983 views

Decode a Microsoft MS-DOS 5.0 FAT directory entry

The Microsoft FAT file system has a directory table to represent which "files" are in which "folders" on the disk. For the time, these entries crammed a lot of information into a small amount of bits. ...
27
votes
10answers
2k views

Parse a Quaternion

If you don't know already, a quaternion is basically a 4-part number. For the purposes of this challenge, it has a real component and three imaginary components. The imaginary components are ...
27
votes
4answers
598 views

Reverse a regex

The Challenge Given a valid regex, output a regex that that matches the same set of strings, but reversed. The Task This challenge uses the most basic regex operations: ...
26
votes
32answers
4k views

Decode the chmod

Challenge Given a three digit octal permissions number, output the permissions that it grants. chmod On UNIX OSes file permissions are changed using the chmod ...
25
votes
15answers
879 views

Transpile WordMath

We've all seen those online "maths hax" that look like this: Think of a number, divide by 2, multiply by 0, add 8. And, by magic, everyone ends up with the ...
25
votes
9answers
1k views

De-Parenthesizing a String

Given a properly-parenthesized string as input, output a list of all nonempty substrings within matching parentheses (or outside of all parentheses), with nested parentheses removed. Each substring ...
25
votes
5answers
849 views

Parse a two-dimensional syntax

Background Alice and Bob are creating a golfing language to win every single PPCG challenge. Alice wants to make a two-dimensional language, like ><>, but Bob prefers a prefix-infix syntax like in ...
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 ...
24
votes
14answers
1k views

Parse the Parcel

Thanks to your help in the Mark My Mail challenge, PPCG-Post has successfully stamped all of its parcels with the generated barcodes! Now, it's time to decode them. In this challenge your program ...
24
votes
10answers
1k views

Convert a TIO answer to a CMC answer

Let's for once do something useful. Given the text from a Try It Online codegolf submission, produce the equivalent Chat Mini Challenge submission, which is of the form ...
24
votes
2answers
929 views

Write an Incident tokeniser

Background Incident is a fairly unusual programming language, in that its list of tokens is not predetermined, but rather inferred from the input. As such, tokenising an Incident program can be ...
23
votes
20answers
3k views

Jimmy these arrays down

My coworker, Jimmy is kinda new to C/C++. He's also kind of a slow learner. Now, to be fair, his code always compiles, but he has some really sloppy habits. For example, everybody knows that you can ...
23
votes
16answers
1k views

Making Music Boxes

Your task is to take a sequence of characters (the music) as input (in a function or program), and print (or return) the music as it would look like in a music box. You will only receive the ...
23
votes
5answers
869 views

Complex Dice Rolling Expressions

Background I play D&D on a regular basis with some friends. While talking about the complexity of some systems/versions when it comes to rolling dice and applying bonuses and penalties, we ...
22
votes
3answers
3k views

The Missing Number Revised

Background: I originally posted this question last night, and received backlash on its vagueness. I have since consulted many personnel concerning not only the wording of the problem, but also its ...
21
votes
56answers
5k views

Compare two numbers given as strings

I have a problem at work. I need to compare two numbers that come as strings from two different databases. The numbers may come with leading zeroes and/or leading/trailing spaces. So I may have ...
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 ...
21
votes
24answers
1k views

Wherre are the adjacent characters in the title? [3, 4]!

Title misspelled on purpose. Read more to find out why. Your task: given a delimited string or list including the characters A,B,C,D, output the indexes of all the ...
21
votes
25answers
3k views

Parse my Esperanto!

The famous constructed language Esperanto uses the Latin alphabet (mostly, see the linked wikipedia page for details). However, there are some characters with accents: ĉ, ĝ, ĥ, ĵ, ŝ, and ŭ. (C-...
21
votes
5answers
727 views

Convert a HTML page into a mountain

Task: convert a HTML page into a mountain! When HTML pages are indented, they can look like: ...
21
votes
8answers
506 views

Read a retro display

Art stolen from What size is the digit? 7-segment digits can be represented in ASCII using _| characters. Here are the digits ...
21
votes
1answer
496 views

Count common Game of Life patterns

The task here is to read from a Golly .rle or plaintext file (your choice) whose filename is provided (on STDIN or as a command line argument) and identify and ...
21
votes
2answers
806 views

Symbolic Integration of Polynomials

Apply an indefinite integral to a given string. The only rules you will be using are defined as such: ∫cx^(n)dx = (c/(n+1))x^(n+1) + C, n ≠ -1 c, C, and n are all constants. Specifications: You ...
20
votes
22answers
1k views

Simplify matrix input!

I have written a few challenges related to matrices, and common for all are that I use a format like the one below when representing the matrices, both in examples and in test cases: ...