Skip to content

A simple programming language with only GOTO statements for control flow.

License

Notifications You must be signed in to change notification settings

gaganchandan/goto-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goto-lang

goto-lang is a simple programming language with only GOTO statements for control flow and a small set of instructions.

Getting started

git clone https://github.com/gaganchandan/goto-lang
cd goto-lang/src
dune build --release
dune exec --release goto <program>

Language features

goto-lang only allows operations in two data types, integers and string. Variables can be defined of either of these two types. 24 different instructions are avaailabe. The general syntax for instructions is as follows:

INSTR op1 op2 .. opn

Control flow is performed using the goto instruction. Conditional goto instruction make use of something known as the cmpflag which is partly inspired by flags and conditional jumps in x86 assembly. Comments are supported as well, and begin with -- as seen in Lua.

The examples/ directory contains trivial programs showcasing goto-lang's capabilities. If you just want a "Hello, World!" program, then here you go!

_entry:
  PRINT "Hello, World!\n"

A slightly more complex variant:

_entry:
  PRINT "What is your name?\n"
  GETSTR name 
  VAR msg "Hello, "
  ADDI msg name
  ADDI msg "!\n"
  PRINT msg

About

A simple programming language with only GOTO statements for control flow.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published