0.4.28 • Published 3 days ago

firefly-compiler v0.4.28

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

Firefly programming language

A straightforward language for full-stack development.

  • Hybrid imperative+functional style with uncomplicated types.
  • Code sharing between the browser and the server.
  • Comprehensive IDE support (MacOS/Windows/Linux).
  • Cross-compilation of executables (MacOS/Windows/Linux).
  • Asynchronous functions without the async/await hassle.
  • Super simple package management with repeatable builds.

This is a preview. Please take it for a ride and tell us what you think!

Writing your first webapp

Install the VSCode extension.

Create a WebApp.ff file.

Type webapp and autocomplete to get a minimalistic client and server (you may need to give the extension a few seconds to initialize first).

Go to the Run and debug side bar and choose create a launch.json file.

Press F5 or click Run. View the running webapp at http://localhost:8080/

In the WebApp.ff file you'll see a nodeMain, which runs on the server, and a browserMain, which runs on the client. There's also a buildMain which is the build step that compiles the client side code to JavaScript so that it can be served to the browser.

Building an executable

Install the firefly compiler:

npm install -g firefly-compiler

Build executables for Linux, MacOS and Windows:

firefly build WebApp.ff

You can find the executables in .firefly/

The command line interface can also run WebApp.ff directly by typing:

firefly WebApp.ff

Connecting to PostgreSQL

To connect to a PostgreSQL database, add this dependency to the top of the file:

dependency ff:postgresql:0.0.0

And import the Pg module from it:

import Pg from ff:postgresql

Create a connection pool with the appropriate connection parameters:

let pool = Pg.makePool(...)

And run your first transaction, e.g.:

pool.transaction {connection =>
    let emails = connection.statement("""
        select email from users
    """).map {row =>
        row.getString("email").grab()
    }
    Log.debug(emails)
}

What's next

For now, you're on your own! Lots of things you'll be missing. We're working on it.

To follow the development or get help, join #firefly on https://discord.gg/FHv8vXJNVf - we're a friendly bunch, and your feedback is appreciated!

This repository contains the source code of the compiler and language server. It's all written in Firefly! Apart from extension.js, the JavaScript files you see in this repository are generated from Firefly code.

0.4.28

3 days ago

0.4.27

6 days ago

0.4.26

7 days ago

0.4.25

7 days ago

0.4.24

19 days ago

0.4.22

21 days ago

0.4.23

21 days ago

0.4.21

1 month ago

0.4.20

1 month ago

0.4.19

1 month ago

0.4.17

1 month ago

0.4.18

1 month ago

0.4.16

1 month ago

0.4.10

1 month ago

0.4.15

1 month ago

0.4.13

1 month ago

0.4.14

1 month ago

0.4.11

1 month ago

0.4.12

1 month ago

0.4.9

2 months ago

0.4.8

2 months ago

0.4.5

4 months ago

0.4.7

4 months ago

0.4.6

4 months ago

0.4.4

9 months ago