Day 1 - Building the Lexer for Our New Programming Language

 


 Day 1 - Building the Lexer for Our New Programming Language

Welcome to Day 1 of our journey in creating a new programming language! Today, we’re diving into the foundational step of building the lexer, which is a crucial component in interpreting our code. Let’s explore the details of what we accomplished, the keywords we chose, and the rationale behind them.


What We Achieved Today

1. Lexer Implementation: We successfully implemented the lexer for our new programming language. The lexer, or lexical analyzer, is responsible for breaking down source code into tokens that the parser can understand. This process is essential for interpreting and compiling code.

  • File Created: lexer.py
  • Main Functionality: Tokenization of the source code into identifiable units like keywords, identifiers, operators, and numbers.
  • Token Types: We defined various token types, including NUMBER, IDENTIFIER, INK (our variable keyword), and more.

2. Keywords Chosen: For variable declarations, we chose ink as our keyword. Here’s why:

  • Relevance to Thoth: We wanted a keyword that resonates with the theme of knowledge and writing, inspired by the Egyptian god Thoth. Ink symbolizes the act of writing and recording, aligning well with our language’s purpose.
  • Uniqueness: While ink is simple, it stands out from common programming keywords, making our language distinct and memorable.

3. Progress and Next Steps: We’ve set the stage for parsing and interpreting code. The lexer will recognize and tokenize ink as well as other fundamental elements. Next, we’ll integrate this lexer into our parser to handle variable declarations and expressions.

Progress Bar:

  • Lexer Implementation: [####--------] 40%
  • Parser Development: [----------] 0%
  • Complete Interpreter: [----------] 0%

Stay tuned as we continue to build and refine our new programming language. Tomorrow, we’ll focus on extending our lexer and integrating it with the parser to handle more complex syntax.

Comments

Popular posts from this blog

جدول زمني مفصل لتعلم تحليل البيانات

استخدام السلاسل المُنسقة في بايثون

Google’s Quantum Supremacy: A New Era in Computing