Skip to content

add: interpreter task - #49

Open
shrehanrajsingh wants to merge 2 commits into
kossiitkgp:masterfrom
shrehanrajsingh:master
Open

shrehanrajsingh wants to merge 2 commits into
kossiitkgp:masterfrom
shrehanrajsingh:master

Conversation

@shrehanrajsingh

@shrehanrajsingh shrehanrajsingh commented Mar 19, 2026

Copy link
Copy Markdown

This pull request adds a coding + teaching task for developing a simple toy interpreter which would help the person unfold the concepts of interpreter design. Emphasis is more on teaching, thus the task is kept in the Teaching/ directory


## Example: Bytecode Generation (Optional)

Here's a sample bytecode representation for the QBasic program above. Each instruction is a simple operation that the interpreter's virtual machine would execute:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a teaching task, and this part is optional, all of the following explanations are unnecessary imo. Give them links to resources and explain what bytecode is at a high level and let them explore the rest.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced this with a small paragraph on bytecode generation, with some resources to learn about them

## Some Resources
- https://ruslanspivak.com/lsbasi-part1/
- https://github.com/codecrafters-io/build-your-own-x?tab=readme-ov-file#build-your-own-programming-language
- https://www.craftinginterpreters.com/contents.html

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be best to highlight this one, and even ask them to go through it as the primary resource/guide to complete the task.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

highlighted this section further


Each node represents a statement or expression in the code, capturing its structure and relationships.
In the execution phase, the interpreter can be tuned as follows.
```cpp

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block seems too technical. I feel it should be removed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this code block


## Example: AST Breakdown

Here's a simple Abstract Syntax Tree (AST) representation for the QBasic code above:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the reader has no idea what an AST is, the following would be hard to understand. It would be good to add a one-line description of what an AST is and how it helps.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the breakdown with basic definition of AST and a small example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants