Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/Prog/ challenge #4362

Name: Anonymous 2013-08-17 13:12

Make a HTML parser in regex.
Deadline: before the thread is deleted by the mods

Name: Anonymous 2013-08-17 13:15

THIS THREAD HAS CHANGED TOPIC
New title: /prog/ challenge #4363
Redefine the web completely by replacing HTML with S-exps and Javashit with Scheme.
Deadline: before the report advocate realizes his futile efforts are futile

Name: Anonymous 2013-08-17 13:18

>>2
That won't change the web in a fundamental manner. Unless you're thinking of also replacing HTTP and maybe even the transport layer.

Name: Anonymous 2013-08-17 13:22

>>3
I'd contribute to a web without Javashit or </x></x></x></x></x>s.

What's wrong with HTTP?

Name: Anonymous 2013-08-17 13:34

In Perl 6 regex isn't the same thing as regular expressions.

Name: Anonymous 2013-08-17 13:44

(html
 (head (title This Webpage Sucks))
 (body
  (h1 Welcome to my WbPages)
  Hello))

Name: Anonymous 2013-08-17 15:07

>>5
Do regular expressions only match regular languages now in Perl 6?

Name: Anonymous 2013-08-17 15:18

>>6
Lemon curry?

Name: Anonymous 2013-08-17 15:20

>>7
Nope, they're recursive now.
http://perlcabal.org/syn/S05.html

Name: Anonymous 2013-08-17 15:39

parsing is done recursively
regex is usually only to get a single match out of a big string, or to do many replacements

Name: Anonymous 2013-08-17 15:46

I am prince Mombasa from Nigeria.

I have a question to programmers.

Is it possible to create a regular expression that matches all regular expressions?

Thank you.

Name: Anonymous 2013-08-17 15:46

>>10
fuck off fagshit.

Name: Anonymous 2013-08-17 15:47

>>11
Yes.  /.*/ matches all regular expressions.

It also matches a lot of other things, too.

Name: Anonymous 2013-08-17 15:51

What is the time complexity of a PCRE?

Name: Anonymous 2013-08-17 15:54

I will do this challenge, but I'm waiting for my emerge world to finish first.

Name: Anonymous 2013-08-17 15:58

          ∧_∧   / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
          ( ´∀`) < COOL FREE REGULAR EXPRESSIONS
        /    |    \________
       /       .|     
       / "⌒ヽ |.イ |
   __ |   .ノ | || |__
  .    ノく__つ∪∪   \
   _((_________\
    ̄ ̄ヽつ ̄ ̄ ̄ ̄ ̄ ̄ | | ̄
   ___________| |
    ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| |

Name: Anonymous 2013-08-17 16:06

>>14
O(ANGER)

Name: /g/ challenge No.4362 2013-08-17 16:13

Make a /g/ parser in re/g/ex.
Deadline: before the thread is deleted by the mods

Name: Anonymous 2013-08-17 16:16

>>18
/((((top(pest)? )?lel)|xD+|autism|troll|fart) ?)+/

Name: Anonymous 2013-08-17 16:16

>>18
I'm tempted to write a /g/ tokenizer, but I don't know.

Name: Anonymous 2013-08-17 17:07

I think >>19-san wins the /g/ challenge

Name: Anonymous 2013-08-17 17:49

The bane of my existence.
I must get dubs.

Name: Anonymous 2013-08-17 18:09

>>13
Impressive, if you pay me $100k I will give you $1M on a later date.

Name: sigh 2013-08-17 19:49

Name: Anonymous 2013-08-17 20:03

I'd make a regex to parse html, but unfortunately some people think it's a good idea to write things like <br> instead of <br />, or <img> instead of <img />. Really, these people are the worst.

Name: Anonymous 2013-08-18 14:30

>>25
XML and HTML are both terrible in different ways.  XHTML, at least, had the benefit of  removing many of the terrible parts of HTML at only the cost of adding the terrible parts of XML, which were already there for the most part. And at least with XHTML you get the ability to point expat at the thing and not worry about whether someone closed their tags or not.

Name: Anonymous 2013-08-18 17:46

>>23
I hope you send back my $1 million soon

Name: Anonymous 2013-08-18 17:49

>>27
I have not yet received the $1 million, please try resending it.

Name: Anonymous 2013-08-18 19:37

>>26
I suppose you know of a better way to markup some data in a human readable way that doesn't suffer from Lisp parens hell.

Name: Anonymous 2013-08-18 19:43

>>29
Someone hasn't read their Paredit today.

Name: Anonymous 2013-08-18 19:47

>>30
Paredit makes S-Expressions work entirely on you favor, the only people who complain are the ones who haven't tried it in earnest.

Now, the only downside I can see is if you for some reason have to read Lisp code in a shitty editor or printed, so you can't actually trust the indentation, or follow it easily, but that's rare.

Name: Anonymous 2013-08-18 20:30

>>30
One point of XML is so humans don't require a software editor to parse the code. If you really like Lisp so much, it won't take you any time to write some Lisp macros that write proper XML and XHTML.

Name: Anonymous 2013-08-18 20:39

>>31
lisp printed on paper is enthrailing.

Name: Anonymous 2013-08-18 20:47

>>29
How is this

(anchor
   (list
       (item "1")
       (item "2")
       (item "3")))

any worse than
<anchor>
     <list>
          <item>1</item>
          <item>2</item>
          <item>3</item>
     </list>
</anchor>
[/code]
Do a character count, a line count, try to type both of these manually, and tell me which one is worse. If you have parens so much, you could use S-exprs with angular/curly braces, a specific byte outside of ASCII, SJIS emoticons, little Unicode penises or whatever you want, and they will still be better than the markup languages shat by the W3shit.

Name: Anonymous 2013-08-18 20:49


(anchor
 $ list
   (item "1")
   (item "2")
  $ item "3")

Name: Anonymous 2013-08-18 20:49

>>34
Now try writing an Lisp parens example for a front page like Yahoo.

Name: Anonymous 2013-08-18 20:51

>>29
A modification of >>34-san's post: Forced-indentation S-expressions.


anchor
    list
        item "1"
        item "2"
        item "3"

which sort of reminds me of YAML, known to be fully parsable both by humans and machines. Not that I'm suggesting YAML or FIS-exprs, but anything will always be better than XML based markup languages.

>>30
XML has never been easy to parse by humans. Try opening an Ant configuration file or any of those TURNKEY SOLUTIONS and tell me if you could read it after pasting it on Notepad or printing it.

Name: Anonymous 2013-08-18 20:55

>>36
Still would turn out to be better than HTML. Did you even read my post? Yes, there would be ))))))))))))), but if you don't like them and you like languages with C-like syntax so much, then you could do


(anchor
    (list
        (item "1")
        (item "2")
        (item "3")
    )
)

and the ``closing tags'' still take less space than [code]</list></anchor></body></html></document></program></end></eof></really-end-this-time>[code].

Name: Anonymous 2013-08-18 20:57

>>38
If you want to get rid of ))))))))), see >>35

Name: Anonymous 2013-08-18 21:02

>>39
I don't get it. Why is that $ before the third item? It doesn't seem to open or close anything specific, it seems to be randomly added inside the list.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List