goto-lang

所属分类:编程语言基础
开发工具:OCaml
文件大小:0KB
下载次数:0
上传日期:2023-08-10 03:47:58
上 传 者sh-1993
说明:  一种简单的编程语言,只有用于控制流的GOTO语句。,
(A simple programming language with only GOTO statements for control flow.,)

文件列表:
LICENSE (1070, 2023-08-09)
examples/ (0, 2023-08-09)
examples/fizzbuzz.goto (482, 2023-08-09)
examples/hw.goto (58, 2023-08-09)
examples/hw5.goto (157, 2023-08-09)
examples/largest.goto (345, 2023-08-09)
examples/license.goto (233, 2023-08-09)
references/ (0, 2023-08-09)
references/reference.md (2169, 2023-08-09)
src/ (0, 2023-08-09)
src/bin/ (0, 2023-08-09)
src/bin/dune (64, 2023-08-09)
src/bin/main.ml (424, 2023-08-09)
src/dune-project (173, 2023-08-09)
src/goto.install (185, 2023-08-09)
src/goto.opam (517, 2023-08-09)
src/lib/ (0, 2023-08-09)
src/lib/dune (45, 2023-08-09)
src/lib/eval.ml (12650, 2023-08-09)
src/lib/lexer.ml (5208, 2023-08-09)
src/lib/parser.ml (19451, 2023-08-09)
src/lib/syntax.ml (748, 2023-08-09)
src/test/ (0, 2023-08-09)
src/test/dune (20, 2023-08-09)
src/test/goto.ml (0, 2023-08-09)
utilities/ (0, 2023-08-09)
utilities/goto.vim (468, 2023-08-09)

# 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 ``` ## 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. For a detailed description on the various instructions and langauge features, consult the documents in `references/`. The `examples/` directory contains trivial programs showcasing `goto-lang`'s abilities. If you just want a "Hello, World!" program, then here you go! ``` _main: PRINT "Hello, World!\n" ``` A slightly more complex variant: ``` _main: PRINT "What is your name?\n" GETSTR name VAR msg "Hello, " ADDI msg name ADDI msg "!\n" PRINT msg ```

近期下载者

相关文件


收藏者