{"id":31359366,"url":"https://github.com/perbu/vclparser","last_synced_at":"2025-09-26T23:24:59.415Z","repository":{"id":315750689,"uuid":"1060690468","full_name":"perbu/vclparser","owner":"perbu","description":"VCL parsing library","archived":false,"fork":false,"pushed_at":"2025-09-20T13:47:59.000Z","size":341,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-20T14:41:05.198Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perbu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-20T11:51:33.000Z","updated_at":"2025-09-20T13:48:03.000Z","dependencies_parsed_at":"2025-09-20T14:41:06.565Z","dependency_job_id":"a00bb7dc-ea35-4df1-852c-3bbaca99f0e6","html_url":"https://github.com/perbu/vclparser","commit_stats":null,"previous_names":["perbu/vclparser"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/perbu/vclparser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fvclparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fvclparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fvclparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fvclparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perbu","download_url":"https://codeload.github.com/perbu/vclparser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fvclparser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276803697,"owners_count":25707735,"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","status":"online","status_checked_at":"2025-09-24T02:00:09.776Z","response_time":97,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-09-26T23:24:57.912Z","updated_at":"2025-09-26T23:24:59.408Z","avatar_url":"https://github.com/perbu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VCL Parser for Go\n\nA VCL (Varnish Configuration Language) parser implemented in Go that parses VCL files into Abstract Syntax Trees (AST).\n\n## Features\n\n- Complete lexical analysis of VCL syntax\n- Recursive descent parser with error recovery \n- Type-safe AST representation\n- Post-parse resolution of include statements\n- Symbol table and semantic analysis\n- Visitor pattern for AST traversal\n- VMOD and variable semantics loaded from varnishd build\n\n## Semantics\n\nSemantics like what variables are available in a given context are defined in the metadata package, in a JSON file that\nis generated by the `generate.py` script inside varnishd. This file is embedded into the library at compile time.\n\nVMOD semantics are loaded from a collection of VCC files in `vcclib`. These are embedded into the library at compile\ntime.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/varnish/vclparser/pkg/parser\"\n)\n\nfunc main() {\n\tvclCode := `\n    vcl 4.0;\n\n    backend default {\n        .host = \"127.0.0.1\";\n        .port = \"8080\";\n    }\n\n    sub vcl_recv {\n        if (req.method == \"GET\") {\n            return (hash);\n        }\n    }\n    `\n\n\tast, err := parser.Parse(vclCode)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"Parsed VCL with %d declarations\\n\", len(ast.Declarations))\n}\n```\n\n## Architecture\n\n- `pkg/lexer/` - Lexical analysis and tokenization\n- `pkg/ast/` - AST node definitions and visitor pattern\n- `pkg/parser/` - Recursive descent parser implementation\n- `pkg/types/` - Type system and symbol table\n- `examples/` - Usage examples\n- `tests/testdata/` - Test VCL files\n\n## VCL Language Support\n\nThis parser supports the full VCL language including:\n\n- Version declarations (`vcl 4.0;`)\n- Backend definitions with properties\n- Access Control Lists (ACLs)\n- Probe definitions\n- Subroutine definitions\n- All VCL statements (if/else, set, unset, call, return, etc.)\n- Expression parsing with proper operator precedence\n- Built-in variables and functions\n- C-code blocks (C{ }C)\n\n## Testing\n\n```bash\ngo test ./...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperbu%2Fvclparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperbu%2Fvclparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperbu%2Fvclparser/lists"}