{"id":15010992,"url":"https://github.com/burz/feval","last_synced_at":"2025-04-09T18:41:41.513Z","repository":{"id":16964490,"uuid":"19726963","full_name":"burz/Feval","owner":"burz","description":"evaluation using f-algebras","archived":false,"fork":false,"pushed_at":"2015-09-07T04:20:00.000Z","size":369,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T20:43:27.072Z","etag":null,"topics":["algebras","category-theory","evaluation","functor","haskell","interpreter"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/burz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-13T05:27:49.000Z","updated_at":"2024-11-14T16:41:28.000Z","dependencies_parsed_at":"2022-07-26T01:32:09.813Z","dependency_job_id":null,"html_url":"https://github.com/burz/Feval","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/burz%2FFeval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/burz%2FFeval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/burz%2FFeval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/burz%2FFeval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/burz","download_url":"https://codeload.github.com/burz/Feval/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248089948,"owners_count":21045996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algebras","category-theory","evaluation","functor","haskell","interpreter"],"created_at":"2024-09-24T19:38:13.169Z","updated_at":"2025-04-09T18:41:41.497Z","avatar_url":"https://github.com/burz.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Feval - evaluation using f-algebras\n===================================\n\nAuthor: Anthony Burzillo\n\n******\n\nFeval is a statically typed functional programming language that uses f-algebras as opposed to classic recursion to solve\nthe problem of evaluation and typechecking, which allows the compiler to perform better optimizations.\n\nThe overall language of Feval is EF, which is an extension of the smaller language F. In order to run a program written\nin EF, we first use an f-algebra to transform the AST to F, and then we transform the result (via an f-algebra) into\nthe individual AST's used by the evaluator's f-algebra and the typechecker's f-algebra. The reason we need to use\nseperate f-algebras is because we need to stall the processing of certain subtrees of the AST in order to ensure correct\nevaluation and typechecking. For instance, we cannot evaluate the expression of a anonymous function until we have\nobtained its argument. Similarly, we cannot typecheck a function until we have assigned a type hypothesis to the variable.\n\nFor more information on how we solve these problems, check out the article [Feval: F-Algebras for expression evaluation](http://burz.github.io/2014/06/15/feval.html). For an in-depth explanation of parsing see [Feval: Parsing a functional language with Parsec](http://burz.github.io/2014/06/24/parsing.html)\n\n## Usage\n\nTo build Feval run `cabal configure \u0026\u0026 cabal build \u0026\u0026 cabal install`.\nThen you can run `Feval` which acts as a REPL:\n```\n$ ./feval\nFunction x -\u003e x \u0026\u0026 True\n  =\u003e Function x -\u003e x \u0026\u0026 True\n    : Bool -\u003e Bool\n(Function x -\u003e Function y -\u003e x + y / 50) 5\n  =\u003e Function y -\u003e 5 + y / 50\n    : Int -\u003e Int\nLet f x = If x = 0 Then 1 Else x * f (x - 1) In f 6\n  =\u003e 720\n    : Int\nCase [1, 2, 3, 4] Of [] -\u003e 0 | (x : xs) -\u003e x + 6\n  =\u003e 7\n    : Int\nFunction x -\u003e Case True : x Of [] -\u003e True | (y : ys) -\u003e True || !(y || False)\n  =\u003e Function x -\u003e Case True Of [] -\u003e True | (y, ys) -\u003e True || !(y || False)\n    : [Bool] -\u003e Bool\n```\nTo quit simply press ctrl-d.\n\nSince the REPL can only handle one line expressions, we also allow `feval` to take a file to execute as an argument.\nFor instance, with the provided file mergesort.fvl:\n```\n$ feval mergesort.fvl\n  =\u003e [-34, 3, 4, 23]\n    : [Int]\n```\n\n## Expressions\n\n### Boolean Operations\n\nWe allow conjunction (\u0026\u0026), disjunction (||), and negation (!) expressions.\n\n### Integer Operations\n\nThe operations of addition (+), subtraction (-), multiplication (*), division (/), and modulus (%) evaluate to integer\nvalues. On the other hand, the comparison operators of equality (=), less-than (\u003c), less-than-or-equal (\u003c=), greater-than\n(\u003e), and greater-than-or-equal (\u003e=) all evaluate to boolean values.\n\n### Functional Operations\n\nWe allow the creation of anonymous functions via `Function x -\u003e e` where `e` is some expression, and `x` is the argument\nto the function. We can create multiple argument anonymous functions via `Function x -\u003e Function y -\u003e e` where `x` is\nthe first argument and `y` is the second, etc.\n\nTo apply a function `f` simply use `f e` where `e` is the expression for the first argument, or `f e1 e2` for the first\nargument `e1` and second argument `e2`.\n\n### If Expressions\n\nUse `If e1 Then e2 Else e3`.\n\n### Let Expressions\n\nWe allow let expressions to define constants and functions (possibly recursive) via\n```\nLet x = 4 In x + 54\n```\nand\n```\nLet f x y = If x = 0 Then 0 Else y + f (x - 1) y In f 3 4\n```\n\n### Semi-colon Expressions\n\nAn expression of the form `e1; e2` first evaluates `e1` then `e2` and returns the result of `e2`.\n\n### List Expressions\n\nYou can create empty lists `[]` or lists with values `[1, 2, 3, 4]`. You can cons values onto a list via\n```\n5 : [4, 5, 6]\n  =\u003e [5, 4, 5, 6] \n    : [Int]\n```\nFinally, we can match on lists via a case expression via\n```\nCase e1 Of [] -\u003e e2 | (x : xs) -\u003e e3\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburz%2Ffeval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fburz%2Ffeval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburz%2Ffeval/lists"}