Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
ed99bca
Remove code related to the compilation and use of .lara files
lm-sousa Oct 2, 2024
df879df
Remove deprecated apiExtractor feature
lm-sousa Oct 2, 2024
fe405b3
Remove dead code
lm-sousa Oct 2, 2024
4051eff
Remove LARA DSL specific option
lm-sousa Oct 3, 2024
6757030
Remove obsolete lara dsl tests
lm-sousa Oct 3, 2024
721392f
Remove laraloc test
lm-sousa Oct 3, 2024
abc89ca
Delete LaraLoc api calls
lm-sousa Oct 3, 2024
76b6818
Rename api file
lm-sousa Oct 3, 2024
66bfbf9
Refector test
lm-sousa Oct 3, 2024
107d9fe
Fix laraImport tests
lm-sousa Oct 3, 2024
0b6de0b
Refactor WeaverTest test
lm-sousa Oct 3, 2024
1ef9ed6
Fix refactored test
lm-sousa Oct 3, 2024
1b51793
Refactor jsengine tests
lm-sousa Oct 3, 2024
5417278
Rename tests
lm-sousa Oct 3, 2024
8fb4953
Refactor tests
lm-sousa Oct 3, 2024
6b621c9
Rename test files
lm-sousa Oct 3, 2024
a735273
Refactor tests
lm-sousa Oct 3, 2024
f225333
Rename test files
lm-sousa Oct 3, 2024
33c5c0e
Refactor tests
lm-sousa Oct 3, 2024
f0000d9
Fix broken test
lm-sousa Oct 3, 2024
f55c747
Remove test
lm-sousa Oct 3, 2024
3f86b18
Remove Eclipse and Ivy specific files
lm-sousa Oct 6, 2024
fda3e5d
Remove unused LaraAst project
lm-sousa Oct 6, 2024
b3a29fb
Remove experimental APIs
lm-sousa Oct 12, 2024
dd1cced
Remove LaraUtils APIs related to aspects
lm-sousa Oct 12, 2024
032d65f
Remove dead code
lm-sousa Oct 12, 2024
06d4e90
Replace laraImport with ES6 imports
lm-sousa Oct 13, 2024
dadbf0a
Replace println with console.log
lm-sousa Oct 13, 2024
3c3d4dc
JS files are now ESM by default
lm-sousa Oct 13, 2024
323c958
Replace println with console.log
lm-sousa Oct 13, 2024
4045dad
Remove support for auto-downloading external dependencies and auto-lo…
lm-sousa Oct 15, 2024
08e0754
Remove stacktrace option for LARA DSL
lm-sousa Oct 15, 2024
9db640a
Fix tests
lm-sousa Oct 15, 2024
cbb4077
Remove references to Nashorn
lm-sousa Oct 15, 2024
64bcfe4
Cleanup LARAI
lm-sousa Oct 15, 2024
908ed43
Reintroduce auto import of core.js files to fix execution environemt
lm-sousa Oct 16, 2024
a1b75a2
Remove dead code
lm-sousa Oct 16, 2024
5f344d4
Remove te legacy LaraCommonLanguage experiment from the project
lm-sousa Oct 19, 2024
929a6bd
Create new WeaverOptionsManager GUI to manege Classic-style config files
lm-sousa Oct 26, 2024
570b0a1
Refactor LaraUtils code
lm-sousa Oct 26, 2024
52c1d36
Remove unused dependency in LaraApi
lm-sousa Oct 26, 2024
0d65e98
Delete unused files
lm-sousa Oct 27, 2024
4639299
Bug fix
lm-sousa Mar 1, 2025
ef180df
Bug Fix
lm-sousa Mar 1, 2025
d44b1fc
Add vscode extension information
lm-sousa Mar 1, 2025
b738731
Modifications to fix bugs in Clava running in Jest
lm-sousa Mar 1, 2025
d28fa39
Reduce eslint agresiveness
lm-sousa Mar 1, 2025
8d09591
Merge 'staging' into 'lara-dsl-deprecation'
lm-sousa Mar 10, 2025
6317a2e
Remove js api files from java resources
lm-sousa Mar 10, 2025
2d97024
Move file to more appropriate location
lm-sousa Mar 10, 2025
86856d6
Remove Java code for managing JS APIs as resources
lm-sousa Mar 10, 2025
4408b3a
[LARAI] Remove laraImport ability and removed now incompatible tests
lm-sousa Mar 10, 2025
ee26be8
Remove unused classes
lm-sousa Mar 10, 2025
9ba7024
Merge remote-tracking branch 'origin/staging' into lara-dsl-deprecation
lm-sousa Mar 10, 2025
3348aa2
Revert change to test
lm-sousa Mar 10, 2025
e8d8fc9
[Lara-JS] Bump dependency versions
lm-sousa Mar 11, 2025
d2d1e73
Make projects compatible with Gradle 9
lm-sousa Mar 11, 2025
77c40e3
Remove duplicate job on pull_requests
lm-sousa Mar 11, 2025
4d913bb
Remove code for support of LARA DSL's def and select methods from the…
lm-sousa Mar 13, 2025
7068a5d
Remove gear triggers from weaver abstracts
lm-sousa Mar 13, 2025
d7068fc
Rmove generation of LARA DSL helper methods in weaver abstracts
lm-sousa Mar 13, 2025
eb9c1d8
Delete SelectOp.java
lm-sousa Mar 14, 2025
75df8cc
Update lara JP json specification generator
lm-sousa Mar 14, 2025
9f95eb1
Remove LARA DSL's Def and Select classes along with related methods a…
lm-sousa Mar 14, 2025
a0eee97
Delete extraneous java API
lm-sousa Mar 14, 2025
f85c915
Remove LaraApi project
lm-sousa Mar 14, 2025
ae9a863
Delete duplicate class
lm-sousa Mar 14, 2025
49df127
Delete unused files
lm-sousa Mar 14, 2025
3221ae7
Update all dependencies
lm-sousa Mar 16, 2025
1506536
Extract DefaultWeaver from LARAI into its own project
lm-sousa Mar 16, 2025
fdf8470
[Defaultweaver] Ignore files that are always modified
lm-sousa Mar 16, 2025
20c71e4
Finish moving DefaultWeaver to its own project
lm-sousa Mar 16, 2025
481fe92
Revert weaver abstracts to return a special undefined type to avoid b…
lm-sousa Mar 18, 2025
00f49e9
[Lara-JS] Remove Clava-specific options from lara-framework
lm-sousa Mar 18, 2025
476a321
Update workflow to test project using Node v22
lm-sousa Mar 21, 2025
d1810e4
Remove now unsupported features from failing test
lm-sousa Mar 22, 2025
e599ecd
Update nightly workflow to build and test the JS APIs, the DefaultWea…
lm-sousa Mar 22, 2025
73f8119
Delete Eclipse project remnants
lm-sousa Apr 23, 2025
3430291
Move cytoscape to proper dependency
lm-sousa Apr 24, 2025
33ae28d
Remove event code related to Aspects and Selects
lm-sousa Apr 29, 2025
cc53a9a
Remove code unused in lara 3.1
lm-sousa Apr 29, 2025
a33281e
Add missing dependency to project
lm-sousa Apr 29, 2025
03afb15
Remove now-defunct java-dist script
lm-sousa Apr 29, 2025
8356fed
Improve typing in LoggerBase
lm-sousa Apr 30, 2025
435c962
Refactor WeaverGenerator and related files; remove unused code and tests
lm-sousa Jun 13, 2025
b4005df
Closes #84
lm-sousa Jun 13, 2025
7e0a6a6
Remove obsolete ANTLR grammar files, test files, and related resources
lm-sousa Jun 13, 2025
9366538
Remove unused images from the deleted panels
lm-sousa Jun 14, 2025
9849dfc
Deleted unused LaraSystem class
lm-sousa Jun 14, 2025
ed025bd
Remove unused Tools and XMLParser classes, and related references in …
lm-sousa Jun 14, 2025
a993837
Remove deprecated classes and files from LARAI and LaraFramework
lm-sousa Jun 14, 2025
c2fe6ea
Remove JS engine references and related code from CLI options and dat…
lm-sousa Jun 14, 2025
4d0920f
Refactor build.gradle files to streamline dependencies and improve fo…
lm-sousa Jun 14, 2025
dc5725c
Refactor code for improved readability and maintainability
lm-sousa Jun 14, 2025
c8c1c51
Removed defunct verbose option and unused code.
lm-sousa Jun 14, 2025
165b4d8
Refactor build.gradle and settings.gradle files to remove unused depe…
lm-sousa Jun 14, 2025
0055850
Remove verbose level handling from WeaverOptions and WeaverDataStore
lm-sousa Jun 14, 2025
7da9780
Merge branch 'staging' into lara-dsl-deprecation
lm-sousa Jun 14, 2025
c0d8c05
Reverse bug introduced by merge with 'staging'
lm-sousa Jun 15, 2025
d4f3321
Refactor ArrayType and LARAExceptionBuilder to eliminate StringUtils …
lm-sousa Jun 15, 2025
8b95dc5
Refactor UserEntitiesGenerator, WeaverAbstractGenerator, ConvertUtils…
lm-sousa Jun 15, 2025
57cbaff
Remove usage of dummy method of NodeJsEngine.
lm-sousa Jun 15, 2025
c7964a7
Remove obsolete JavaScript and MJS test files related to weaver imports
lm-sousa Jun 16, 2025
4ed0a83
Remove obsolete ActionAwareCache and JsGear implementations from the …
lm-sousa Jun 16, 2025
d5ab97c
Re-enabled LaraI integration tests using Jest in Lara-JS. Also fixed …
lm-sousa Jun 16, 2025
88c58d0
Remove obsolete profiling classes and related interfaces from the cod…
lm-sousa Jun 16, 2025
f37c49c
Remove obsolete ReportException and WeaverReportTester classes from t…
lm-sousa Jun 16, 2025
a48ff43
Remove erroneous import from LegacyIntegrationTests
lm-sousa Jun 16, 2025
fd204e4
Refactor build.gradle to generate all abstract on build time.
lm-sousa Jun 17, 2025
75c2900
Update .gitignore to include auto-generated files
lm-sousa Jun 17, 2025
931b4e5
Remove JsEngine references, move the UndefinedValue class to the Lara…
lm-sousa Jun 26, 2025
a92ed07
Fix tests
lm-sousa Jun 30, 2025
4ad0551
Add Copilot instructions and update VSCode settings for Jest run mode
lm-sousa Jul 2, 2025
106be7d
Update Copilot instructions with development environment details and …
lm-sousa Jul 2, 2025
1fd0e6a
Add unit tests for LaraResourceProvider, UndefinedValue, LaraSystemTo…
lm-sousa Jul 6, 2025
cef205a
Handle errors in WeaverGenerator by exiting the program on failure to…
lm-sousa Jul 8, 2025
4e5e3b3
Add comprehensive unit and integration tests for LanguageSpecification
lm-sousa Jul 8, 2025
d05f365
Moved LanguageSpecification legacy test resources to proper folder.
lm-sousa Jul 8, 2025
71d6374
Fix warnings
lm-sousa Jul 21, 2025
2547102
Add unit tests for LARAI components
lm-sousa Jul 21, 2025
3fa5633
Merge branch 'staging' into lara-dsl-deprecation
lm-sousa Jul 29, 2025
736a2cd
Partial revert of "Remove gear triggers from weaver abstracts"
lm-sousa Jul 30, 2025
6978557
Remove unused CLI options and related tests for javascript and restri…
lm-sousa Jul 30, 2025
ad79465
Merge branch 'staging' into lara-dsl-deprecation
lm-sousa Jul 31, 2025
720be99
Refactor DataStore to use Set for allowedKeys and improve error handl…
lm-sousa Aug 2, 2025
ab9d7ef
Refactor JavaTypes to simplify engine handling and remove unused enum
lm-sousa Aug 2, 2025
e67e9e2
Remove unused ALLOW_GUI flag and related tests; refactor CLIConfigOpt…
lm-sousa Aug 2, 2025
6720cb3
Refactor TestGear and EventTrigger: remove unused event handling meth…
lm-sousa Aug 3, 2025
72f80c9
Remove unused launch configurations and related options from WeaverGe…
lm-sousa Aug 3, 2025
49f7ce5
Refactor build.gradle and remove unused test dependencies; clean up E…
lm-sousa Aug 3, 2025
35116b2
Decouple integration testing from Clava-specific weaver features.
lm-sousa Aug 3, 2025
0afb99b
Merge branch 'staging' into lara-dsl-deprecation
lm-sousa Aug 3, 2025
4f9e8cb
[Lara-JS] Fix bug in launcher, ensuring executeWeaver is called in bo…
lm-sousa Aug 3, 2025
470509f
Refactor LaraWeaverState to remove outputDir parameter and related me…
lm-sousa Aug 4, 2025
0225cd2
Update test to reflect recent changes and increase coverage
lm-sousa Aug 4, 2025
70d39aa
Refactor WeaverLegacyTester to use the new LaraWeaverEngine interface…
lm-sousa Aug 4, 2025
0bad684
Move WeaverLegacyTester import to jest directory in integration tests
lm-sousa Aug 4, 2025
8835968
Refactor WeaverLegacyTester to improve modularity and reuse by weaver…
lm-sousa Aug 4, 2025
d60cbb6
Fix type assertion for args.watch in main method to ensure proper han…
lm-sousa Aug 5, 2025
604397a
Remove unnecessary comments from build.gradle and improve log message…
lm-sousa Aug 17, 2025
4b4b935
Remove symbolic link for tests from version control
lm-sousa Aug 17, 2025
e58e75b
Refactor and clean up test cases and exception handling
lm-sousa Aug 19, 2025
282b8e5
Add comprehensive tests for configExtraOptions2DataStore method in Op…
lm-sousa Aug 19, 2025
0a88bdc
Refactor buildInterfaces function to use fileURLToPath for resolving …
lm-sousa Aug 19, 2025
50e1761
Enhance OptionsConverterTest by implementing a concrete WeaverOption …
lm-sousa Aug 21, 2025
f3fb761
Add junit-pioneer for test retries and update testJoinPointLookupPerf…
lm-sousa Aug 27, 2025
71e3fd3
Applied most suggestions made by IntelliJ to the code. Fixed a ton of…
lm-sousa Sep 4, 2025
6727870
Remove unused imports and commented-out code for cleaner implementation
lm-sousa Sep 9, 2025
9ab583c
[WeaverInterface] Add testing plan and implement Stages 0 and 1
lm-sousa Sep 12, 2025
8dc01c4
[WeaverInterface] Implemented Phase 2 of the testing plan
lm-sousa Sep 14, 2025
11f3609
[WeaverInterface] Implemented Stage 3 of the testing plan
lm-sousa Sep 14, 2025
cff69fa
[WeaverInterface] Implemented Stage 4 of the testing plan
lm-sousa Sep 14, 2025
b6cd767
[WeaverInterface] Implemented Stage 5 of the testing plan
lm-sousa Sep 14, 2025
4459b4a
Refactor test imports for consistency and clarity across multiple tes…
lm-sousa Sep 14, 2025
cfe41bd
[WeaverInterface] Implemented Stage 6 of the testing plan
lm-sousa Sep 14, 2025
86f0fcb
[WeaverInterface] Implemented Stage 7 of the testing plan
lm-sousa Sep 14, 2025
59cdb0b
[WeaverInterface] Implemented Stage 8 of the testing plan
lm-sousa Sep 15, 2025
df70381
Add testing guide and update build.gradle for clarity
lm-sousa Sep 15, 2025
3d51695
Fix cleanup method in FixturesSmokeTest to use WeaverEngine for threa…
lm-sousa Sep 15, 2025
1b029a0
Fixed bugs reported during the testing plan implementation.
lm-sousa Sep 15, 2025
0a98b07
[WeaverGenerator] Added a new Testing Plan and implemented Stages 0 a…
lm-sousa Sep 15, 2025
a21ad8b
[WeaverGenerator] Implemented Stage 2 of the testing plan
lm-sousa Sep 15, 2025
07538a1
[WeaverGenerator] Implemented Stage 3 of the testing plan
lm-sousa Sep 15, 2025
a22c137
[WeaverGenerator] Implemented Stages 4, 5 and 6 of the testing plan
lm-sousa Sep 15, 2025
40b8272
[WeaverGenerator] Implemented Stage 7 of the testing plan
lm-sousa Sep 16, 2025
295a248
[WeaverGenerator] Implemented Stage 8 of the testing plan
lm-sousa Sep 16, 2025
9ca2ee9
[WeaverGenerator] Delete dead code
lm-sousa Sep 17, 2025
b12e535
Simplify resources location
lm-sousa Sep 17, 2025
092f4a8
[WeaverGenerator] Remove experimental code
lm-sousa Sep 17, 2025
5cc4e6c
Make sure weaver generator adds method 'getRootJp'
lm-sousa Sep 17, 2025
b2401bc
[WeaverGenerator] Add getRootJp method to MinimalWeaver and update ed…
lm-sousa Sep 17, 2025
0911bd0
Refactor build configuration: use environment variables for library p…
lm-sousa Sep 19, 2025
908e8b7
Remove unused GUI components and related classes from WeaverGenerator
lm-sousa Sep 19, 2025
3802476
Change java test resources file extensions to avoid analysis from the…
lm-sousa Sep 19, 2025
cc907ab
[WeaverGenerator] Address the bugs reported in BUGS_2.md
lm-sousa Sep 19, 2025
96da4df
Refactor artifacts schema to allow mixed ordering of enum, typedef, a…
lm-sousa Sep 20, 2025
72d3fe9
[WeaverGenerator] Address the bugs reported in BUGS_4.md
lm-sousa Sep 20, 2025
fdecdbd
Harden WeaverGenerator overrides and snapshot all golden outputs
lm-sousa Sep 22, 2025
2e4d5dc
Fix build method to use null for shortOption when creating WeaverOption
lm-sousa Sep 22, 2025
9193ab5
Fix null check for watch argument in main method
lm-sousa Sep 22, 2025
5614a4c
Add build and test steps for LaraUtils and WeaverGenerator in nightly…
lm-sousa Sep 22, 2025
96b4a96
Update test assertion due to bug fix related to a dependency version …
lm-sousa Sep 22, 2025
3d711da
[WeaverGenerator] Address the bugs reported in BUGS_6.md
lm-sousa Sep 22, 2025
d40adec
[WeaverGenerator] Address the bugs reported in BUGS_7.md
lm-sousa Sep 22, 2025
5b2cf9a
[WeaverGenerator] Address the bugs reported in BUGS_8.md
lm-sousa Sep 22, 2025
7b84e13
Remove redundant task
lm-sousa Sep 22, 2025
e9d69f1
Ensure uniform imports and improve code formatting for WeaverGenerato…
lm-sousa Sep 22, 2025
5f4c194
[WeaverGenerator] Delete now completed testing plan and adjust final …
lm-sousa Sep 22, 2025
334a7e7
Fixes #93
lm-sousa Sep 29, 2025
c34ee8e
Merge remote-tracking branch 'origin/staging' into lara-dsl-deprecation
lm-sousa Sep 30, 2025
84a657f
Add unit tests for WeaverOptionUtils methods
lm-sousa Sep 30, 2025
387f90b
Make sure the weaver datastore is created using the proper weaver Dat…
lm-sousa Oct 1, 2025
cf26acb
Refactor LaraWeaverEngine and LaraWeaverState to improve DataStore ha…
lm-sousa Oct 1, 2025
e903a1e
Forgot to update the tests ;)
lm-sousa Oct 2, 2025
2dec1fc
Partially revert 33ae28d to fix WeaverOptionsManager startup sequence.
lm-sousa Oct 8, 2025
3eba18e
Add testing for the newly brought back classes
lm-sousa Oct 8, 2025
eab4f53
Bug fix: Refactor EnumRadioButtonPanel to streamline layout setup and…
lm-sousa Oct 8, 2025
43917fc
Quick cleanup
lm-sousa Oct 24, 2025
8960a62
Add GitHub Actions workflow for Copilot Coding Agent setup steps
lm-sousa Nov 15, 2025
07c19d4
Refactor CopilotCloud Agent setup steps to streamline repository refe…
lm-sousa Nov 17, 2025
acf0abe
Remove unused md5 method and its documentation from Io class
lm-sousa Dec 26, 2025
4effbc3
Add fast-glob integration for pattern-based file retrieval in Io class
lm-sousa Dec 26, 2025
081f8d2
Normalize path for fast-glob compatibility in Windows
lm-sousa Dec 26, 2025
3e8a0de
Remove unused JUnit dependency from DefaultWeaver
lm-sousa Dec 26, 2025
689e8db
Refactor error messages and remove unused methods in LaraIDataStore a…
lm-sousa Dec 28, 2025
5b1ace9
Rename getStoreDefinition to buildStoreDefinition and remove version …
lm-sousa Dec 28, 2025
71ef7fc
Merge branch 'staging' into lara-dsl-deprecation
lm-sousa Dec 29, 2025
f32a01c
Prepare for Gradle 10 and fix eslint config
lm-sousa Jan 2, 2026
6d37bb8
Refactor WeaverLegacyTester constructor and add timestamp to import f…
lm-sousa Jan 2, 2026
dbc7941
Revert "Refactor WeaverLegacyTester constructor and add timestamp to …
lm-sousa Jan 2, 2026
10f4f30
Fixes signature of action 'insert', returns an array of JPs instead o…
joaobispo Jan 9, 2026
229e607
[Lara-JS] By default sets the output folder o WeaverLegacyTester to b…
joaobispo Jan 9, 2026
a22b8ba
[Lara-JS] Fixes bug in LaraCore.arrayFromArgs() when input was a sing…
joaobispo Jan 9, 2026
433cf51
[Lara-JS] Another fix to LaraCore.arrayFromArgs, returning the array …
joaobispo Jan 9, 2026
8f5189e
[Lara-JS] Removes varargs from IterativeMutator.addJps()
joaobispo Jan 9, 2026
6988307
[Lara-JS] Reverts changes that where introducing regressions
joaobispo Jan 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
321 changes: 321 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,321 @@
# LARA Framework - Copilot Instructions

## Project Overview

The LARA Framework is a sophisticated **source-to-source compiler framework** designed for building domain-specific language (DSL) compilers and weavers. It provides tools and APIs to develop custom source-to-source transformations for programming languages, with a particular focus on C/C++ and other systems programming languages.

### Key Capabilities
- **Source-to-source compilation**: Transform code from one representation to another while preserving semantics
- **Metaprogramming support**: Enable automated code generation and transformation
- **Language-agnostic architecture**: Define custom AST specifications for any target language
- **DSL development**: Build domain-specific languages with integrated tooling

### Target Audience
- Compiler developers
- Research teams working on code optimization and transformation
- Tool developers building code analysis and transformation systems
- Academic researchers in programming languages and compilers

## Development Environment & Setup

- **Java Version:** 17+ (required for all Java components)
- **Node.js Version:** 20 or 22 (minimum 20.0.0 for JavaScript components)
- **Build System:** Gradle for Java modules, npm for TypeScript/JavaScript
- **IDE:** VSCode is recommended for development

## Architecture Overview

The LARA framework follows a modular architecture with clear separation of concerns:

```
lara-framework/
├── Lara-JS/ # JavaScript/TypeScript driver/entrypoint and API collection for transformations and analyses
├── LanguageSpecification/ # XML-based AST specification system
├── WeaverGenerator/ # Automatic weaver code generation
├── LARAI/ # LARA Interpreter
├── DefaultWeaver/ # Reference weaver implementation
├── WeaverInterface/ # Core weaver interfaces
├── WeaverOptionsManager/ # Configuration management
└── LaraUtils/ # Shared utilities
```

### Technology Stack
- **Backend**: Java 17+ with Gradle build system
- **Frontend**: TypeScript/JavaScript with Node.js 20 or 22
- **Specification**: XML with XSD schema validation
- **Testing**: Jest (JS), JUnit (Java)
- **Interoperability**: Java-JavaScript bridge via `java` npm package

### Related Projects
- **clava**: C/C++ source-to-source compiler built on LARA framework
- **kadabra**: Java source-to-source compiler built on LARA framework
- **specs-java-libs**: Core Java utility libraries (SpecsUtils, jOptions, etc.)

## Core Concepts

### 1. Join Point Model
Join points represent nodes in an Abstract Syntax Tree (AST) with associated attributes and actions:

```typescript
// Example: A function join point with attributes and actions
class FunctionJoinPoint extends LaraJoinPoint {
// Attributes (read-only properties)
get name(): string { /* function name */ }
get params(): VariableJoinPoint[] { /* parameters */ }
get body(): StatementJoinPoint { /* function body */ }

// Actions (methods that transform the AST)
replaceWith(newFunction: FunctionJoinPoint): void { /* replace implementation */ }
insertBefore(statement: StatementJoinPoint): void { /* insert before this function */ }
}
```

These are defined in the `joinPointModel.xml` file, which specifies the hierarchy and relationships between different join point types.
You can then run the following command to generate the TypeScript interfaces for the join points:

```bash
# Generate TypeScript interfaces from XML specifications
cd Lara-JS
npm run build-interfaces
```

### 2. Weaver Pattern
Weavers are the core transformation engines that implement source-to-source compilation:

```java
public class CustomWeaver extends AWeaverEngine {
@Override
public List<Class<? extends AJoinPoint>> getJoinPointClasses() {
// Return available join point types
}

@Override
public boolean handlesApplication(File source) {
// Determine if this weaver can process the source
}
}
```

A lot of their code is automatically generated by the `WeaverGenerator` module, which creates boilerplate code based on the XML specifications of the joinpoints.
It is run automatically during the build process.

### 3. Language Specification System
The framework uses XML-based specifications to define:

- **joinPointModel.xml**: AST node hierarchy and relationships
- **actionModel.xml**: Available methods/actions on join points
- **artifacts.xml**: Attributes and properties of join points

```xml
<!-- Example join point definition -->
<joinpoint class="function" extends="executable">
<select class="var" alias="param"/>
<select class="statement" alias="body"/>
</joinpoint>
```

### 4. Java-JavaScript Interoperability
The Lara-JS module provides seamless integration between Java weavers and JavaScript transformation scripts:

```typescript
// Access Java weaver functionality from JavaScript
const weaverEngine = Weaver.getWeaverEngine();
const rootJoinPoint = weaverEngine.getRootJoinPoint();

// Transform AST using JavaScript
for (const func of Query.search('function')) {
if (func.name.startsWith('old_')) {
func.replaceWith(modernizeFunction(func));
}
}
```

## Module Details

### Lara-JS (`@specs-feup/lara`)
**Purpose**: TypeScript/JavaScript implementation providing modern API and better compatibility

**Key Components**:
- `src-api/`: Public API for weaver development
- `src-code/`: Core weaver functionality and launchers
- `scripts/`: Build and interface generation tools

**Entry Points**:
- `core.ts`: Global imports and initialization
- `weaver/Weaver.ts`: Main weaver utilities
- `LaraJoinPoint.ts`: Base join point implementation

### LanguageSpecification
**Purpose**: Formal XML-based specification system for defining AST structures

**Key Files**:
- `language/*.xml`: Core language specifications
- `resources/schemas/*.xsd`: XML Schema definitions for validation
- `DOCUMENTATION.md`: Comprehensive specification guide

**Usage**: Define custom AST nodes, attributes, and actions for new target languages

### WeaverGenerator
**Purpose**: Automatically generate Java weaver implementations from language specifications

**Capabilities**:
- Generate join point classes from XML specifications
- Create weaver boilerplate code
- Validate specification consistency

### LARAI
**Purpose**: LARA Interpreter for executing transformation scripts

**Key Class**: `LaraI.java` - Main interpreter entry point with thread-local weaver management

## Development Guidelines

### Code Organization Patterns

1. **Join Point Hierarchy**: Follow inheritance patterns defined in `joinPointModel.xml`
2. **Attribute Naming**: Use camelCase for JavaScript, snake_case for internal representations
3. **Action Methods**: Prefix with verb (e.g., `replace`, `insert`, `remove`)
4. **Type Safety**: Leverage TypeScript for API definitions, Java generics for backend

### Common Development Scenarios

#### Adding a New Join Point Type
1. Update `LanguageSpecification/language/joinPointModel.xml`
2. Define attributes in `artifacts.xml`
3. Add actions in `actionModel.xml`
4. Regenerate interfaces using WeaverGenerator (gradle should handle this automatically)
5. Implement concrete classes in target weaver

#### Creating a Custom Weaver
1. Extend `AWeaverEngine` in Java backend
2. Implement required abstract methods
3. Define language-specific join points
4. Create JavaScript API wrapper in Lara-JS
5. Add configuration options via WeaverOptionsManager

### Build System

The project uses Gradle multi-project build:

```bash
# Build all modules
./gradle build

# Build specific module
./gradle :Lara-JS:build

# Run tests
./gradle test
```

### Testing Approach

- **Unit Tests**: Jest for TypeScript, JUnit for Java
- **Integration Tests**: End-to-end weaver execution tests
- **Specification Tests**: XML schema validation and parsing tests

## API Reference Summary

### Core Classes (Java)
- `WeaverEngine`: Main weaver execution engine
- `AJoinPoint`: Base class for all join points
- `LaraI`: Interpreter and execution context
- `LanguageSpecification`: XML specification parser

### Core Classes (TypeScript)
- `LaraJoinPoint`: Base join point with JavaScript API
- `Weaver`: Utility methods for weaver interaction
- `Query`: AST querying and selection
- `DataStore`: Configuration and state management

### Common Usage Patterns

```typescript
// 1. Querying AST
const functions = Query.searchFrom($root, 'function');
const loops = Query.searchFrom($function, 'loop');

// 2. Accessing attributes
console.log($function.name, $function.numParams);

// 3. Applying transformations
$loop.setKind('unroll');
$statement.insertBefore(newStatement);

// 4. Weaver utilities
const isJP = Weaver.isJoinPoint($node);
const defaultAttr = Weaver.getDefaultAttribute('function');
```

## Integration Points

### For Weaver Developers
- Implement `WeaverEngine` interface
- Define join point specifications in XML
- Create transformation APIs

### For Language Researchers
- Extend language specifications
- Add new join point types and attributes
- Implement domain-specific transformations

### For Tool Builders
- Use Lara-JS APIs for tool integration
- Leverage parallel execution capabilities
- Build on weaver launcher infrastructure

## Dependencies and Requirements

### Runtime Requirements
- **Java**: JDK 17 or higher
- **Node.js**: Version 20 or 22 (minimum 20.0.0)
- **Build**: Gradle 6.0+ for Java modules

### Key Dependencies
- `java`: Node.js-Java bridge
- `cytoscape`: Graph visualization
- `yargs`: Command-line argument parsing
- `chokidar`: File system watching

## Common Troubleshooting

### Java-JavaScript Interop Issues
- Ensure compatible Java and Node.js versions
- Check `java` npm package installation
- Verify JAVA_HOME environment variable

### Specification Validation Errors
- Validate XML against XSD schemas
- Check join point inheritance consistency
- Verify action parameter types

### Build Issues
- Clean and rebuild with `./gradle clean build`
- Check Gradle wrapper compatibility
- Ensure all subprojects build independently

## References

- **Main Repository**: https://github.com/specs-feup/lara-framework
- **Language Specification Guide**: `LanguageSpecification/DOCUMENTATION.md`

## Contributing

When working with this codebase:

1. **Follow established patterns** for join point definitions and weaver implementations
2. **Update specifications** when adding new AST node types
3. **Maintain compatibility** between Java and JavaScript APIs
4. **Add comprehensive tests** for new functionality
5. **Document new join point types** and transformation capabilities

The LARA framework is designed for extensibility - most common development tasks involve extending existing patterns rather than creating entirely new architectures.

---

**For LLMs:**
- Follow established patterns for join point definitions and weaver implementations
- Update specifications when adding new AST node types
- Maintain compatibility between Java and JavaScript APIs
- Add comprehensive tests for new functionality
- Document new join point types and transformation capabilities
Loading