GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Vigrel/BrewCodeLanguage: Create a Programming Language. The language has all the basic structures: variables, conditionals, loops and functions

BranchesTags
Open more actions menu

Latest commit

 

History

18 Commits
18 Commits

Folders and files

NameName
Last commit message
Last commit date
compiler
compiler
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
BrewCode.pptx
BrewCode.pptx
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

EBNF

program = "Let's brew a coffee", [ block ], "Your coffee is ready"

block = statement, {statement}

statement = λ | function_declaration | variable_declaration | rel_expression | variable_assignment | loop | condition | return_statement | print_statement

Function


function_declaration = "brew", type_declaration, function_name , parameter_list , function_body

function_name = identifier

parameter_list = "(" , [ variable_declaration , { "," , variable_declaration } ] , ")"

function_body = "{" , [ block ] , "}"

function_call = function_name, "(", [ rel_expression, { ",", rel_expression } ], ")"

return_statement = "pour" , rel_expression , ";"

Variable


type_declaration = "cup" | "lungo"

variable_declaration = type_declaration, variable_name , ";"

variable_name = identifier

variable_assignment = variable_name, "=", rel_expression, ";"

Expressions


rel_expression = expression , { ( "same" | "stronger" | "weaker" ) , expression }, , ";"

expression = term , { ( "+" | "-" | "maybe" ) , term } ;

term = factor , { ( "*" | "/" | "also" ) , factor } ;

factor = string | number | variable_name | function_call | "(" , rel_expression , ")" ;

Loop


loop = "percolate" , rel_expression , "{" , block , "}" ;

If/else


condition = "sip" , rel_expression , "{" , block , "}" , [ "gulp" , "{" , block , "}" ] ;

Others


print_statement = "serve" , rel_expression , ";" ;

number = digit , { digit } ;

string = '"', ?any possible character?, '"' ;

identifier = letter , { letter | digit | "_" } ;

letter = "a" | "b" | ... | "z" | "A" | "B" | ... | "Z" ;

digit = "0" | "1" | ... | "9" ;

example

Let's brew a coffee
  cup blackCoffee;
  cup americanCoffee;
  cup water;
  blackCoffee = 10;
  americanCoffee = 10;
  water = 10;
  percolate(blackCoffee stronger americanCoffee) {
    sip (blackCoffee weaker 5) {
      sip(blackCoffee weaker 2) {
        serve "No sugar added";
      } gulp {
        serve "Adding sugar";
      }
    }
    blackCoffee = blackCoffee - water;
  }
Your coffee is ready

About

Create a Programming Language. The language has all the basic structures: variables, conditionals, loops and functions

Topics

compilerprogramming-languagepython

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.