{"id":23392106,"url":"https://github.com/bww/epl","last_synced_at":"2025-09-03T08:06:23.019Z","repository":{"id":26913140,"uuid":"30375112","full_name":"bww/epl","owner":"bww","description":"Embedded predicate language","archived":false,"fork":false,"pushed_at":"2024-06-11T23:17:14.000Z","size":105,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-14T11:34:14.745Z","etag":null,"topics":["go","golang","language","predicate"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bww.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-05T19:53:57.000Z","updated_at":"2024-06-11T23:17:03.000Z","dependencies_parsed_at":"2024-12-22T04:29:06.197Z","dependency_job_id":"f18ef156-a07b-4758-b668-a2bb97e97287","html_url":"https://github.com/bww/epl","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bww%2Fepl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bww%2Fepl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bww%2Fepl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bww%2Fepl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bww","download_url":"https://codeload.github.com/bww/epl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247867365,"owners_count":21009240,"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":["go","golang","language","predicate"],"created_at":"2024-12-22T04:28:25.493Z","updated_at":"2025-04-08T15:19:27.983Z","avatar_url":"https://github.com/bww.png","language":"Go","readme":"# Embedded Predicate Language\n\nEPL is a tiny, general-purpose, expression-only language compiler and runtime implemented in Go. A Go program can use EPL to express arbitrarily complex predicate logic tersely and unambiguously or to accept such logic from a user.\n\n```go\ncontext := map[string]interface{}{\n  \"greeting\": \"Hello\",\n}\n\nprogram, _ := epl.Compile(`greeting == \"Hello\"`)\nresult, _ := program.Exec(context)\nfmt.Println(result) // true\n```\n\n## History\n\nThis Go version is the latest and most fully realized incarnation of this project. A previous version was [Predicate Kit](https://github.com/bww/PredicateKit), implemented in Objective-C and intended as a more flexible replacement for [`NSPredicate`](https://developer.apple.com/documentation/foundation/nspredicate?changes=_5).\n\n# Syntax\nEPL will be reasonably familiar to anyone with experience using langauges with C-style syntax.\n\n## Identifiers\nIdentifiers in EPL have the same rules as Go. A valid identifier is a letter followed by zero or more letters or digits. An underscore is considered to be a letter.\n```\na\nThisIsALongIdentifier\n_a9\n```\n\n## UUID Identifiers\nIn addition to normal identifiers EPL has support for the use of UUIDs as identifiers. A UUID identifier is the sequence `u:` (or `U:`, if you prefer) followed by a valid UUID. A UUID identifier can be used anywhere a normal identifier can be used.\n```\nu:9515976f-cdb4-4e56-bd07-b1ae6efc00da\nU:7388AA2B-44C3-4146-8F17-C78F89B5F7D8\n```\n\n## Literals\nString, number, and boolean literals are supported.\n\n## Strings\nStrings literals have essentially the same rules as Go. A string begins with `\"`, is terminated by `\"`, and contains zero or more characters or escape sequences. Unlike regular Go strings, an EPL string may contain newlines.\n```\n\"Hello!\"\n\"\"\n\"Hello\n       world!\"\n```\n\nThe following escape sequences are allowed in strings. All escape sequences are introduced by a backslash `\\` character.\n\n| Escape | Value |\n|--------|-------|\n| `\\uXXXX` | A Unicode character with the codepoint `XXXX`. |\n| `\\xXX` | A Unicode character with the codepoint `XX`. |\n| `\\\\` | A literal `\\` |\n| `\\\"` | A literal `\"` |\n| `\\a` | Audible bell | \n| `\\b` | Backspace |\n| `\\f` | Form feed |\n| `\\n` | Newline |\n| `\\r` | Carriage return |\n| `\\t` | Tab |\n| `\\v` | Vertical tab |\n\n## Numbers\nNumeric literals have essentially the same rules as Go. Decimal, octal, and hexidecimal integers and decimal floating point numeric literals are supported. Floating points may use exponential notation.\n\n### Integers\n```\n42\n0600\n0xBadFace\n170141183460469231731687303715884105727\n```\n\n### Floating points\n```\n0.\n72.40\n2.71828\n1.e+0\n6.67428e-11\n1E6\n```\n\n## Booleans\nBoolean literals are `true` and `false`.\n```\ntrue\nfalse\n```\n\n## Nil\nThe special literal Nil uses the special identifier `nil`.\n```\nnil\n```\n\n## `\u0026\u0026`, `||`, `!` Logical Operators\nThe standard logical and, or, and not operators are supported and have the same meaning as in Go.\n```\n1 \u003c 2 \u0026\u0026 2 \u003c 3\n1 \u003e 2 || 2 \u003c 3\n!(1 \u003e 2)\n```\n\n## `\u003c`, `\u003c=`, `==`, `\u003e=`, `\u003e` Relational Operators\nThe standard relational operators are supported. Values are comparable if their types are comparable in Go. Unlike Go, EPL will automatically convert numeric types so that they can be compared.\n```\n 1 \u003c 2\n 1 \u003c= 3\n 1 == 1\n 5 \u003e= 5\n 5 \u003e 4\n```\n\n## `.` Dereference Operator\nThe `.` operator dereferences a property. This operator can be use more liberally in Ego than Go. You can use this operator to:\n\n* Obtain the value of an exported struct field\n* Obtain a value from a map that has string keys if the key is also a valid identifier. That is: `a_map.string_key` is equivalent to `a_map[\"string_key\"]`.\n* Obtain the result of a method invocation if that method does not take any arguments. That is: `an_interface.Foo` is equivalent to `an_interface.Foo()`.\n\n## `[]` Subscript Operator\nThe subscript operator obtains the value at an index when the operand is an array or slice and obtains the value of a key when the operand is a map.\n```\n a_slice[5]\n a_map[\"the_key\"]\n```\n\n## `()` Functions and Methods\nFunctions and methods are invoked as they are in Go. When a function invocation follows a dereference it is treated as a method invocation.\n```\nlen(v)\nval.Len()\n```\n\nThe manner in which underlying Go functions are mapped to EPL is a bit more nuanced, however. There are various rules governing how different return values are handled, aimed at producing the expected result.\n\n# Standard Library\nA few builtin functions are provided in the standard library. They are aimed at providing functionality that cannot be reasonably addressed using the language syntax alone.\n\n| Function | Detail |\n|----------|--------|\n| `len(v)` | Determine the length of an array, slice, or map, `v`. Providing any other type as an argument will produce an error. |\n| `match(e, v)` | Match the regular expression `e` in the text `v`. If a match is found, `true` is returned, otherwise `false`. |\n| `printf(...v)` | Print to standard output. This method has the same semantics as `fmt.Printf`. |\n\n## Environment\nThe current environment is exposed via the variable `env`. Environment variables are accessed by their name as properties of `env`.\n```\nenv.TERM\nenv.POSTGRES_HOME\n```\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbww%2Fepl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbww%2Fepl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbww%2Fepl/lists"}