-
Notifications
You must be signed in to change notification settings - Fork 1
CompilerEvolution
This document describes the development path of the eQuantic.UI compiler, focusing on the transition from a simple syntactic transpiler to a robust, semantic-aware compilation engine.
Initially, the compiler operated through direct token-based substitutions.
- Limitation: It was difficult to handle method overloads or complex C# extensions.
- Result: TypeScript code that sometimes required manual adjustments.
We introduced the CSharpToJsConverter based on strategies (IConverterStrategy).
- Improvement: Each element of the syntax tree (AST) now has an isolated and testable conversion logic.
-
Highlight: Implementation of native support for constructs like
try-catch,switchand lambda expressions.
Integration with the Roslyn Semantic Model allowed the compiler to understand the "meaning" of the code, not just its form.
-
Context Heuristics: The compiler now knows how to differentiate when a variable is a
Parameter(retains the name) or aProperty(addsthis.). -
Declarative Mapping: We replaced large
switchblocks with a configurable mapping registry.
To ensure that the code executed in the browser is stable, the compiler imposes clear limits:
-
Server/Client Split:
-
Server Components: Can use
System.IO,DbContext, and database APIs. - Client Components: Restricted to UI logic, state, and portable APIs.
- Enforcement: The compiler rejects the use of prohibited APIs (such as direct file access) in components that will be sent to the browser.
-
Server Components: Can use
The next major evolutionary leap will focus on the automatic Type-Safe Bridge, where the compiler will generate not only the ServerAction call but also ensure that return types and arguments are perfectly synchronized between C# and TypeScript at compile time.