Skip to content

A Go-based interpreter (lexer + parser) for a custom language

Notifications You must be signed in to change notification settings

ElenaDanchenko/EasyGo

Repository files navigation

EasyGo

EasyGo - Simple Interpreted Programming Language

Academic project for the "Programming Language Theory" course (2026)

About

An interpreter implementation for a formal programming language with simplified Go-like syntax. Created to explore programming language internals through hands-on development.

Implementation

  • Lexer - source code analysis and tokenization
  • Parser - abstract syntax tree (AST) construction
  • Interpreter - program execution

Language Features

  • Basic constructs: variables, arrays, loops, conditionals
  • Block scoping
  • Simple type system: integers, floats, boolean, string
  • Go-inspired syntax

Language Grammar (EBNF)


ProgramStmnt :: = statement+

statement ::=  ExpressionStmnt | VarDeclStmnt |  IfStmt | ForRangeStmt | MrVoiceStmnt 

VarDeclStmnt ::= ("little_lady" | "little_lady_you_know") identifier (type)? "=" expression

MrVoiceStmnt ::= "Mr_Voice" "(" expression ("," expression)* ")"

IfStmt ::= "if" expression BlockStmnt ("else" BlockStmnt)?

ForStmt ::= "for" identifier "," identifier ":=" "range" expression BlockStmnt

BlockStmnt ::= "{" statement* "}"

type ::= "integer" | "float" | "bool" | "string"

ExpressionStmnt ::= Expression

Expression     ::= IntegerExpr
                  | FloatExpr
                  | StringExpr
                  | BoolExpr
                  | AssignmentExpr
                  | BinaryExpr
                  | UnaryExpr
                  | PostfixExpr
                  | ArrayExpr
                  | IdentifierExpr
                  | "(" Expression ")"
            
AssignmentExpr ::= IdentifierExpr  ("="|"+="|"-="|"*="|"/=") Expression
IntegerExpr ::= digit+
FloatExpr ::= digit+ "." digit+
StringExpr ::= '"' character* '"'
BoolExpr ::= "true" | "false"

BinaryExpr ::= Expression ("+" | "-" | "*" | "/" | "&&" | "||" | "AND" | "OR"| "NOT") Expression
UnaryExpr ::= ("-" | "!") Expression  
PostfixExpr ::= Expression ("++" | "--")
ArrayExpr ::= "[" "]" type "{" Expression ( "," Expression )* "}"

IdentifierExpr  ::= identifier

identifier      ::= ( letter | "_" ) ( letter | digit | "_" )*

letter          ::= [a-zA-Z]
digit           ::= [0-9]
character       ::= [^\n\r\t\"] 

Grammatical parsing tree

Grammatical parsing tree

Used Resources

The Go Programming Language Specification - language reference and design principles
YouTube programming tutorials

About

A Go-based interpreter (lexer + parser) for a custom language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages