FGL Features

fgl language fgl.js web server database dev tools

FGL Language
Server-Side & Application

FGL is a robust programming language and development platform optimized for the creation of advanced web applications and standalone programs. FGL is both procedural and object-oriented and provides the ease of use of a Python or JavaScript with the raw performance, flexibility, and industry standards of the “C” world.

Serialize Complex Data Types:

    o = object()

    o.fish = { "cod", "walleye", "trout" }
    o.today = date( "MMMM dd, YYYY" )
    o.pi = 22 / 7

    fname = 'c:\temp\test1.dat'
    
    // serialize and write to disk
    fname.writeToDisk( pack( o ) )
    
    // read and de-serialize 
    o2 = fname.readFromDisk( ).unpack( )
    
    println( ">>> ", o2.fish[2], o2.today, o2.pi )
 
Store & Retrieve Native Data in a Database:

    aa = aArray().add( {
        { "ST", "Staycation" },
        { "RT", "Road trip" },
        { "SK", "Skip" }
    }
    
    // store complex object in keyvalue db
    keyvalue.myTripOptions = aa
    
    aa = null
    
    // retrieve from keyvalue db
    aa = keyvalue.myTripOptions
    
    println( ">>> ", aa[ "RT" ] )
 
Key Features
  • Automatic Memory and Resoure Management
  • Case Insentitivity
  • Enhanced Variable Manipulation
  • Advanced Object Orientation
  • Operator Overloading
  • Multiple Inheritance
  • Optimized Functions and Procedures
  • Variable Parameter Passing
  • Parameter Overloading
  • Function Chaining
  • Code-Blocks
  • Arrays: Single Dimension, Multi-dimension, Linear, Sparse, Ragged, and Associative
  • Integrated Database, Web Server, and Dynamic Content Generator
  • JIT and Standalone Compiler
  • Data Serialization and Compression
  • Language Extensibility
Functions
FUNCTION myDateFormatter( dte, format="MMM dd, YYYY HH:MN ap" )
    return( dateFormat( dte ? dte : date(), format ) )
END

println( ">>> ", myDateFormatter() )
println( ">>> ", myDateFormatter( , "YYYYMMDDHHMNSS" ) )

newYear = "01-01-2022"
println( ">>> ", newYear.myDateFormatter( "Today is DDDD" ) )
  • Variable Parameter Passing
  • Default Parameters and Parameter Overloading
  • Default Parameters can be Values, Constants, or Other Functions
  • Automatic Function Chaining
  • Embed Functions in Active Pages, Source Files, and Libraries
  • Explicit and Implicit Main Function
Variables Default Types: Strings, Numbers, Logical, Hex, Arrays, Objects, Constants, Field, Null, IP Address
Extended: Word, Integer, Long, Double, Float, Date, JDate, BLOB, CRC, JSON, XML, DOM

  • Variable names are not case sensitive.
  • Variables do not have to be predefined.
  • Variable “typing” is defined by assignment.
  • Variables can automatically convert to any type of data.
  • Variables support advanced scoping.
  • Variables can be dynamically accessed through code-blocks and macros.
  • Variables can be stored and retrieved in their original states.
  • Variable memory does not have to be allocated or de-allocated.
  • Variables can be passed by value or reference.
  • Variables support virtual methods when accessing functions.
Operators
OperatorDescriptionExample
+Additionx + y
-Subtractionx - y
/Divisionx / y
*Multiplicationx * y
==Equalx == y
>Greater thanx > y
>=Greater than or equalx >= y
<Less thanx < y
<=Less than or equalx <= y
!=Not equalx != y
<>Not equalx <> y
**Powerx ** 3
%Modulusx % y
++Increment++x (pre), x++ (post)
--Decrement--x (pre), x-- (post)
+=Add with assignmentx += 7
-=Subtract with assignmentx -= 3
*=Multiply with assignmentx *= 3.14
/=Divide with assignmentx /= 2
&&Logical ANDx && y
||Logical ORx || y
&=Bitwise AND with assignmentx &= 16
|=Bitwise OR with assignmentx |= 32
^=Bitwise XOR with assignmentx ^= 8
%=Modulus with assignmentx %= 256
<<=Bitwise LEFT SHIFT with assignmentx <<= 2
>>=Bitwise RIGHT SHIFT with assignmentx >>= 1
**=Power with assignmentx **= 4
:>Maximumx = 5 :> 4 (x=5)
:<Minimumx = 5 :< 4 (x=4)
::Self object reference::myInstanceVar
&Bitwise ANDx & 16
|Bitwise ORx | 32
^Bitwise XORx ^ 128
=Assignx = 4
:=Assignx := 4
!Notif ( ! x )
[Array accessx[i], x[i,j], x[i][j]
~Complement~x
$Substringx $ b
?Conditionalx = y ? a : b
:Conditional separatorx = y ? a : b
.Message sendobj.CalcData()
@Reference@x
,Sequentialx, y, x
&Compile&"time()"
-Negate-x
->Workarea referencecontact->dbCreateIndex()
!Insertion (Active Pages)<[ ! x ]>
<[Begin Active Page block<[ ! 'hellow world' ]>
]>End Active Page block<[ ! date( ) ]>
<%Begin HTML block<% <p>Hello</p> %>
%>End HTML block<% <h3>World</h3> %>
Control Structures
  • If / Else / Elseif / End
  • If (Inline)
  • Switch / Case / Default / End
  • While / End
  • For / End
  • Repeat / Until
  • Break / Continue
  • Goto / Label
  • Try / Catch
  • Return
Objects
CLASS <class name>
  [ INHERIT [PUBLIC|PRIVATE|PROTECTED] [VIRTUAL] <class name>,…]
  [ PUBLIC: | PRIVATE: | PROTECTED: ]

    LOCAL <symbol>

    METHOD <name> [ ( <parameters, …> ) ]
        <statements>
    END

    ACCESS <name>
        <statements>
        return( val )
    END

    ASSIGN <name> ( <value> )
        <statements>
    END

    OPERATOR [ + | - | * | / ][ ( <varname ) ]
        <statements>
        return( val )
    END
END

Standard:
  • Methods
  • Variable parameter passing with default initializers
  • Instance variables with initializers
  • Support of "self" and shorthand "::" object references
  • Class-wide static variables with initializers
  • Properties: assign/access/default methods
  • Virtual methods
  • Public/Private/Protected object elements
  • Class constants
  • Operator overloading
  • Inheritance
  • Base-class overriding
  • Objects can be passed as parameters, returned from functions, and stored in arrays or any other data type

Enhanced:
  • Multiple inheritance: lets classes inherit from multiple base classes
  • Virtual classes: when multiple base classes are themselves inheriting from the same base class, provides support for single or multiple instances of the common classes.
  • Message renaming: lets developers overcome duplicate names when inheriting from single or multiple base classes
  • Compile-time resolution of object interaction for advanced performance
  • Optional run-time resolution for maximum flexibility, as in: a."message", a.(var), and (obj).(method)
  • Objects are always referential, however object variables can be passed by value or reference
  • Complex objects can be "flattened" into data streams and fully restored using the pack() and unpack() functions

Custom:
  • Full extension module API provides C-level manipulation of classes, including class creation and registration of C-functions as methods
  • API-level maniuplation of FGL objects, including assigning and accessing variables
  • Support for per-object memory buffer for use by the extension module builder
  • Call-back support for custom pack/unpack object serialization
  • Garbage collection call-back for customized resource management
Other Features
  • Code-blocks & Macros
  • Low-level File
  • Database
  • Libraries
  • Extensions
  • Error Handling
  • Console Apps
  • Web Applications
  • Integrated Debugger and Profiler
  • Advanced Programming
  • Tools and Utilities


#####

Copyright © 2020-2024 by the FGL Foundation, All Rights Reserved



12 ms