Most ridiculous hello world app ever

"How would swift grammar look if written in swift itself?" :thinking:
4K lines, several :coffee:'s, few :beer:'s and 2 days later got to this answer:

  func test() {
    let app = top_level_declaration(
      statements(
        .declaration(
          .function_declaration(
            .init(
              function_name: .identifier(
                .identifier_name(.init("main"))
              ),
              function_signature: .normal(
                .init(
                  parameter_clause: .empty()
                )
              ),
              function_body: .init(
                statements: .init(
                  .expression(
                    .init(
                      .normal(
                        .init(
                          .function_call_expression(
                            .normal(
                              postfix_expression: .primary_expression(
                                .identifier_with_arguments(
                                  .init(
                                    .identifier_name(.init("print"))
                                  )
                                )
                              ),
                              function_call_argument_clause: .normal(
                                .init(
                                  .single(
                                    .expression(
                                      .init(
                                        .normal(
                                          .init(
                                            .primary_expression(
                                              .literal_expression(
                                                .literal(
                                                  .string_literal(
                                                    .static_string_literal(.single_line("Hello, World"))
                                                  )
                                                )
                                              )
                                            )
                                          )
                                        )
                                      )
                                    )
                                  )
                                )
                              )
                            )
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        )
      )
    )!
    print(app)
  }

Prints this obviously:

func main(){print("Hello, World")}

Perhaps the most ridiculous "Hello World" app ever. :rofl:

9 Likes
func test () {...}

That made me immediately hop into Xcode to copy and paste, but then I realised that that is not the whole thing.

Where is the rest? :worried: :slight_smile: