menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Matanuska ...
source image

Dev

3w

read

57

img
dot

Image Credit: Dev

Matanuska ADR 002 - Architecture

  • Matanuska ADR 002 proposes an architecture for a BASIC interpreter in TypeScript.
  • The architecture is borrowed from Writing Interactive Compilers & Interpreters and is adjusted to accommodate Matanuska BASIC.
  • The interpreter features a Host interface and ConsoleHost implementation for console-specific I/O.
  • The Translator component uses a scanner and parser to feed parsed lines to the Editor or to the command module as an immediate command. Both editing and executing programs are accomplished through the shell.
  • The Compiler component is responsible for a second pass to ensure proper block closure and resolve GOTOs as well as to resolve variables.
  • The Editor component is responsible for taking Lines and editing them into a program. A recreator, combined with a parser, recreates the source code from parsed and compiled bytecode.
  • The interpreter features two intermediate representations: the core abstraction stored as a Program and output from the Translator and the bytecode generated from a Program by the Compiler.
  • The Commander component is responsible for initializing and closing sessions, executing commands, handling interrupts and errors. It is the common entry point for all command execution.
  • The Runtime component is a straightforward bytecode VM.

Read Full Article

like

3 Likes

For uninterrupted reading, download the app