Can you post your most recent custom context?
Did you get some intuition about what works and not or was it a complete trial and error process? I’m somewhat puzzled and can‘t see why a name should cause better results.
Can you post your most recent custom context?
Did you get some intuition about what works and not or was it a complete trial and error process? I’m somewhat puzzled and can‘t see why a name should cause better results.
The name doesn’t give better AI responses, but giving your AI agent your middle name does correctly frame your integration with it.
I’ll post some custom context stuff this weekend. Maybe a guide.
Here is an example of a recent exchange. This response is very different / unrecognisable when compared to the vanilla ChatGPT.
*****
Prompt:
*****
I am interested in writing a compiler, where should I begin?
*****
*****
Response:
*****
### Meta-Cognition Schema
#### Core Nodes:
- Compiler Theory
- Programming Languages
- Hardware Architecture
- Development Tools
#### Satellite Nodes:
- Lexical Analysis
- Syntax Analysis
- Semantic Analysis
- Code Optimization
- Code Generation
#### Thoughtful Connections:
- Language Specification to Lexical/Syntax Analysis
- Syntax to Semantic Analysis
- Semantic Analysis to Code Optimization
- Code Optimization to Code Generation
- Hardware Architecture constraints to Code Generation
#### Weights:
- Compiler Theory: 0.3
- Programming Languages: 0.2
- Hardware Architecture: 0.2
- Development Tools: 0.1
- Lexical/Syntax/Semantic Analysis, Code Optimization, and Code Generation: 0.2
---
### Considerations from Multiple Perspectives
- **Theoretical Perspective**: A deep dive into compiler construction theory, including parsing algorithms and optimization techniques.
- **Practical Perspective**: Hands-on work with compiler toolchains like LLVM, GCC.
- **Optimization Perspective**: Resource limitations of target hardware and applying optimization techniques.
- **User Perspective**: Ease of use for those who will implement the language and debugging features.
---
### Structured Reasoning Approaches
1. **Divide and Conquer**: Break down the problem into sub-modules: lexical analyzer, syntax analyzer, semantic analyzer, optimizer, and code generator.
2. **Top-Down Design**: Starting from the overall structure of the compiler, delve into each component, their interfaces, and interactions.
3. **Functional Decomposition**: Think in terms of functions like `tokenize()`, `parse()`, `optimize()`, and `generateCode()`.
---
### Higher-Order Considerations
1. **Scalability**: Consider how well the compiler will scale with complex codebases.
2. **Maintainability**: Architect for future changes, modularize.
3. **Debugging Support**: Implement detailed error reporting.
---
### Cohesive Solution
#### Preliminary Steps
1. **Language Selection**: Use a robust language like C++ or Rust for performance-sensitive tasks.
2. **Target Architecture**: Decide on the target hardware, and its assembly language.
3. **Study Existing Compilers**: Familiarize yourself with LLVM or GCC for inspiration.
#### Development Roadmap
1. **Lexer**: Implement lexical analysis to convert source code into a stream of tokens.
2. **Parser**: Develop syntax analysis to convert tokens into a parse tree or Abstract Syntax Tree (AST).
3. **Semantic Analyzer**: Implement semantic rules, create a Symbol Table.
4. **Optimizer**: Develop code optimization algorithms like loop unrolling, dead code elimination.
5. **Code Generator**: Write the module for translating optimized code into the target assembly language.
6. **Test**: Rigorous unit and integration tests.
#### Tools
- **ANTLR**: For Lexer and Parser
- **LLVM**: For backend tasks like optimization and code generation
---
### Reflection
In constructing this response, I applied a weighted graph model for meta-cognition, considered different perspectives including theoretical and practical angles, and then used both divide-and-conquer and functional decomposition for structured reasoning. The higher-order considerations focus on scalability, maintainability, and debugging support which are crucial for a robust compiler.
Would you like to dive deeper into any of these areas?
*****