fgscript

package module
v0.0.0-...-6daaa5e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

README

FGScript

A macro system for Flowgorithm internal file format.

# Comments outside of the function are ignored
# (They will not appear in the generated file)
fn Main () _ None
	# Comments are allowed only at the beggining of the line
	var n Integer
	
	println "Write a number:"
	scan n
	
	println "Fibonacci: " & Fibonacci(n)
end

fn Fibonacci (n Integer) x Integer
	# We can define multiple variables at once
	var x y i Integer
	
	# Remember to always initialize variables before use
	set x 0
	set y 1
	
	# Loop n-1 times
	for i from 1 to n step 1
		# Expressions have the same syntax as in Flowgorithm
		set x x+y
		set y x-y
	end
end

Installation

go install github.com/mandriota/fgscript/cmd/fgscript@latest

Editors configuration

Emacs & Straight

(use-package fgscript-mode
  :straight (:type git :host github :repo "mandriota/fgscript"
                   :files ("editors/emacs/fgscript-mode.el")))

Documentation

Overview

Package fgscript implements FGScript macro system execution and generation of Flowgorithm file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tokenize

func Tokenize(src string) []string

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func (*Generator) MatchAndWrite

func (g *Generator) MatchAndWrite(tokens []string) error

func (*Generator) String

func (g *Generator) String() string

func (*Generator) TopLevel

func (g *Generator) TopLevel() bool

func (*Generator) WriteBreakpoint

func (g *Generator) WriteBreakpoint(tokens []string) error

func (*Generator) WriteComment

func (g *Generator) WriteComment(tokens []string) error

func (*Generator) WriteEndSt

func (g *Generator) WriteEndSt(tokens []string) error

func (*Generator) WriteFooter

func (g *Generator) WriteFooter() error

func (*Generator) WriteHeader

func (g *Generator) WriteHeader()

func (*Generator) WriteLnStAssignment

func (g *Generator) WriteLnStAssignment(tokens []string) error

func (*Generator) WriteLnStCall

func (g *Generator) WriteLnStCall(tokens []string) error

func (*Generator) WriteLnStDeclaration

func (g *Generator) WriteLnStDeclaration(tokens []string) error

func (*Generator) WriteLnStPrint

func (g *Generator) WriteLnStPrint(tokens []string, newline bool) error

func (*Generator) WriteLnStScan

func (g *Generator) WriteLnStScan(tokens []string) error

func (*Generator) WriteStDo

func (g *Generator) WriteStDo(tokens []string) error

func (*Generator) WriteStElse

func (g *Generator) WriteStElse(tokens []string) error

func (*Generator) WriteStFor

func (g *Generator) WriteStFor(tokens []string) error

func (*Generator) WriteStFunction

func (g *Generator) WriteStFunction(tokens []string) error

func (*Generator) WriteStIf

func (g *Generator) WriteStIf(tokens []string) error

func (*Generator) WriteStWhile

func (g *Generator) WriteStWhile(tokens []string) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL