fika
所属分类:编程语言基础
开发工具:Elixir
文件大小:0KB
下载次数:0
上传日期:2021-05-10 08:47:38
上 传 者:
sh-1993
说明: 一种用于web的静态类型函数编程语言。
(A statically typed functional programming language for the web.)
文件列表:
.formatter.exs (107, 2021-05-10)
.tool-versions (28, 2021-05-10)
LICENSE (11357, 2021-05-10)
config/ (0, 2021-05-10)
config/config.exs (134, 2021-05-10)
config/dev.exs (65, 2021-05-10)
config/prod.exs (56, 2021-05-10)
config/releases.exs (181, 2021-05-10)
config/test.exs (56, 2021-05-10)
docs/ (0, 2021-05-10)
docs/hacking_syntax.md (3144, 2021-05-10)
docs/release_workflow.md (825, 2021-05-10)
example.fi (4011, 2021-05-10)
examples/ (0, 2021-05-10)
examples/router.fi (259, 2021-05-10)
fika/ (0, 2021-05-10)
fika/io.fi (146, 2021-05-10)
fika/list.fi (431, 2021-05-10)
lib/ (0, 2021-05-10)
lib/fika.ex (84, 2021-05-10)
lib/fika/ (0, 2021-05-10)
lib/fika/application.ex (725, 2021-05-10)
lib/fika/cli.ex (1567, 2021-05-10)
lib/fika/code.ex (1094, 2021-05-10)
lib/fika/compiler/ (0, 2021-05-10)
lib/fika/compiler/code_server.ex (9209, 2021-05-10)
lib/fika/compiler/default_types.ex (2906, 2021-05-10)
lib/fika/compiler/erl_translate.ex (6576, 2021-05-10)
lib/fika/compiler/function_signature.ex (517, 2021-05-10)
lib/fika/compiler/module_compiler.ex (2677, 2021-05-10)
lib/fika/compiler/parser.ex (676, 2021-05-10)
lib/fika/compiler/parser/ (0, 2021-05-10)
lib/fika/compiler/parser/common.ex (1492, 2021-05-10)
lib/fika/compiler/parser/expressions.ex (3057, 2021-05-10)
... ...
[![FOSSUnited](http://fossunited.org/files/fossunited-badge.svg)](https://fossunited.org/)
[![Discord](https://img.shields.io/discord/756840900952588321?color=7389D8&label=Discord&logo=discord&logoColor=white&style=plastic)](https://discord.gg/zNs6Gs5)
-----
Fika is a modern programming language for the web.
It is statically typed, functional and runs on the BEAM (Erlang VM).
### Current status
Actively developed. Not ready for production use or HackerNews.
Currently I'm working on an incremental compiler on a long running branch.
If you'd like to keep tabs on our progress, please [subscribe to our updates here](https://tinyletter.com/fika).
### Syntax
Here's a quick walkthrough of Fika's syntax: [example.fi](https://github.com/fika-lang/fika/blob/main/example.fi)
### Running Fika programs
Fika is written in Elixir, so make sure you have that installed.
Follow [these instructions](https://elixir-lang.org/install.html) to install
Elixir. Next, clone this repo, cd into the directory and then follow the below instructions.
#### Using Elixir shell
```
# Install dependencies and run the Elixir shell
mix deps.get
iex -S mix
# In the Elixir shell, compile and load a Fika file using the following:
> Fika.Code.load_module("example")
# Now you can run functions from the module like this:
> :example.sum(40, 2)
> 42
```
#### Using `fika` executable
```
# Create the executable
mix release
# The above command creates an executable in the path ./_build/prod/rel/bakeware/fika
# Call the function example.sum(1, 2) from the file example.fi
./_build/prod/rel/bakeware/fika exec --function="foo()" example
```
PS: If you're developing Fika, the recommended way to try Fika code is to use
the Elixir shell which is documented above because this is faster.
### Your first HTTP server
Fika comes with a web server which allows you to quickly create HTTP request
handlers. Note: This web server is a prototype currently and only responds with
strings and a 200 status code.
```elixir
# Inside examples/router.fi
fn routes : List({method: String, path: String, handler: Fn(->String)}) do
[
{method: "GET", path: "/", handler: &hello},
{method: "GET", path: "/foo", handler: &bar}
]
end
fn hello : String do
"Hello world"
end
fn bar : String do
"Bar"
end
```
Now start the webserver in one of two ways:
#### Using Elixir shell
```
iex -S mix
# A web server is started automatically using the router `examples/router.fi`
```
#### Using `fika` executable
```
# Create the executable
mix release
# router.fi is in the `examples` folder
cd examples
../_build/prod/rel/bakeware/fika
```
Now open `http://localhost:9090` in the browser to see "Hello world" served
by Fika. Changes to the router are picked up automatically.
### Fika together!
If you'd like to be part of the Fika community, you can find us here:
[![Discord server](https://github.com/fika-lang/assets/blob/master/discord_server.png?raw=true)](https://discord.gg/zNs6Gs5)
This is the best place to chat with Fika developers, ask questions or get guidance
on contributing to Fika. We also livestream some talks and pair programming sessions here.
[Here's the link to join.](https://discord.gg/zNs6Gs5)
[![Hackers list](https://github.com/fika-lang/assets/blob/master/hackers_list.png?raw=true)](https://tinyletter.com/fika)
This is an email digest where we send out the latest updates
about Fika and our ecosystem. [Here's the link to subscribe.](https://tinyletter.com/fika)
If you'd like to contact the creator of Fika, you can find Emil Soman on
[twitter](https://twitter.com/emilsoman) or drop a mail to `fikalanguage@gmail.com`.
### Thanks
Fika's development is supported by its many contributors and [the grant from
FOSSUnited](https://forum.fossunited.org/t/foss-hack-2020-results/424). Thank you!
近期下载者:
相关文件:
收藏者: