{"id":19259621,"url":"https://github.com/overturetool/astcreator","last_synced_at":"2025-10-07T19:19:26.669Z","repository":{"id":7358812,"uuid":"8683570","full_name":"overturetool/astcreator","owner":"overturetool","description":"The Overture AstCreator Tool","archived":false,"fork":false,"pushed_at":"2017-12-04T05:48:03.000Z","size":22398,"stargazers_count":2,"open_issues_count":6,"forks_count":1,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-01-05T09:42:00.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://overturetool.github.io/astcreator","language":"Java","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/overturetool.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}},"created_at":"2013-03-10T10:12:18.000Z","updated_at":"2021-06-10T10:35:27.000Z","dependencies_parsed_at":"2022-08-20T11:00:36.627Z","dependency_job_id":null,"html_url":"https://github.com/overturetool/astcreator","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/overturetool%2Fastcreator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overturetool%2Fastcreator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overturetool%2Fastcreator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overturetool%2Fastcreator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/overturetool","download_url":"https://codeload.github.com/overturetool/astcreator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240356473,"owners_count":19788557,"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":[],"created_at":"2024-11-09T19:17:11.257Z","updated_at":"2025-10-07T19:19:21.611Z","avatar_url":"https://github.com/overturetool.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Overture AstCreator Tool [![Build Status](https://travis-ci.org/overturetool/astcreator.png?branch=master)](https://travis-ci.org/overturetool/astcreator)\n\nThis generates heterogenous ASTs in Java for the Overture project, and should be applicable to anything else that needs an AST.\n\n## Using AstCreator as a Maven plugin\n\n~~~xml\n\u003cplugin\u003e\n  \u003cgroupId\u003eorg.overturetool.astcreator\u003c/groupId\u003e\n  \u003cartifactId\u003eastcreator-plugin\u003c/artifactId\u003e  \n  \u003cversion\u003e1.6.8\u003c/version\u003e\n  \u003cartifactId\u003eroot\u003c/artifactId\u003e\n  \u003cexecutions\u003e\n    \u003cexecution\u003e\n      \u003cid\u003ejava\u003c/id\u003e\n      \u003cphase\u003egenerate-sources\u003c/phase\u003e\n      \u003cgoals\u003e\n        \u003cgoal\u003egenerate\u003c/goal\u003e\n      \u003c/goals\u003e\n    \u003c/execution\u003e\n  \u003c/executions\u003e\n  \u003cconfiguration\u003e\n    \u003cast\u003eovertureII.astv2\u003c/ast\u003e\n  \u003c/configuration\u003e\n\u003c/plugin\u003e\n~~~\n\n## Using the core jar\n\nThe `jar` produced from the `core/` directory is embeddable; please contact us if you plan to use it.\n\n## Making a release\n\nSee https://github.com/overturetool/astcreator/wiki/Release-Procedure\n\n\n# Specification Language\n\n# AST Specification Syntax and Template\n\nThe specification consists of:\n\n\n- 1. Base and analysis package declerations\n- 2. Tokens section\n - Definition of any externally specified nodes. This is nodes that is manually written in Java and implements `INode`\n - Definition of external java types\n  - `enum`\n\t- any object\n- 3. Abstract Syntax Tree: This is the definition of the AST itself it consists of:\n\t- Level 0 nodes prefixed after generation with `P`\n\t- Level 1+ nodes prefixed after generation with `S` and in the specification with `#`\n\t- Leaf nodes prefixed after generation with `A` and specified as {node name} followed by field declerations. Only these nodes can be instantiated.\n\nBoth all nodes can speficy fields both only Level X can specify packages.\n\n\n```\nPackages\nbase org.overture.ast.node;\nanalysis org.overture.ast.analysis;\n  \nTokens\n\n  LexStringToken = 'java:node:org.overture.ast.intf.lex.ILexStringToken';\n  location = 'java:org.overture.ast.intf.lex.ILexLocation';\n  \n  nameScope = 'java:enum:org.overture.ast.typechecker.NameScope';\n  \n  //Java\n  java_Boolean = 'java:java.lang.Boolean';\n  java_Integer = 'java:java.lang.Integer';\n  \nAbstract Syntax Tree\n\nexp {-\u003e package='org.overture.ast.expressions'\n\t| (type):type \n\t| [location]:location}\n    =   #Unary\n    |   #Binary\n\t\t|\t\t{apply} [root]:exp [args]:exp* (argtypes):type*\n    ;\n    \n#Unary {-\u003e package='org.overture.ast.expressions'\n\t|\t[exp]:exp}\n    =   {absolute} \n\t\t;\n```\n\n# To String Specification Syntax and Template\n\nThe ToString extension is used to generate `toString` method bodies for AST nodes.\n\nThe structure consist of two parts:\n\n- 1. Import declerations\n- 2. *ToString* specifications\n\nThe *ToString* specification is a fully qualified AST name of the format:\n\n```\n\u003ctostring-body\u003e ::= \"%\" \u003cpath\u003e \"=\" \u003cbody\u003e\n\n\u003cpath\u003e ::= \u003ctext\u003e \u003cs-name\u003e* \"-\u003e\" \u003ctext\u003e\n\u003cs-name\u003e ::= \"-\u003e\" \u003ctext\u003e \n\n\u003cbody\u003e ::= \u003cfield\u003e | \u003cjava-embeding\u003e | \u003cstring\u003e | \"+\"\n\u003cfield\u003e ::= \"[\" \u003ctext\u003e \"]\"\n\u003cjava-embeding\u003e ::= \"$\" \\.* \"$\"\n\u003cstring\u003e ::= \"\\\"\" \u003ctext\u003e \"\\\"\"\n \n```\n\n\n\n```\nTo String Extensions\n\n// import packages used by external $$ java code\nimport org.overture.ast.util.Utils;\nimport org.overture.ast.util.ToStringUtil;\n\n%CG-\u003e#decl-\u003eclassHeader = [name]\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foverturetool%2Fastcreator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foverturetool%2Fastcreator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foverturetool%2Fastcreator/lists"}