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.
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 |
Operator | Description | Example |
+ | Addition | x + y |
- | Subtraction | x - y |
/ | Division | x / y |
* | Multiplication | x * y |
== | Equal | x == y |
> | Greater than | x > y |
>= | Greater than or equal | x >= y |
< | Less than | x < y |
<= | Less than or equal | x <= y |
!= | Not equal | x != y |
<> | Not equal | x <> y |
** | Power | x ** 3 |
% | Modulus | x % y |
++ | Increment | ++x (pre), x++ (post) |
-- | Decrement | --x (pre), x-- (post) |
+= | Add with assignment | x += 7 |
-= | Subtract with assignment | x -= 3 |
*= | Multiply with assignment | x *= 3.14 |
/= | Divide with assignment | x /= 2 |
&& | Logical AND | x && y |
|| | Logical OR | x || y |
&= | Bitwise AND with assignment | x &= 16 |
|= | Bitwise OR with assignment | x |= 32 |
^= | Bitwise XOR with assignment | x ^= 8 |
%= | Modulus with assignment | x %= 256 |
<<= | Bitwise LEFT SHIFT with assignment | x <<= 2 |
>>= | Bitwise RIGHT SHIFT with assignment | x >>= 1 |
**= | Power with assignment | x **= 4 |
:> | Maximum | x = 5 :> 4 (x=5) |
:< | Minimum | x = 5 :< 4 (x=4) |
:: | Self object reference | ::myInstanceVar |
& | Bitwise AND | x & 16 |
| | Bitwise OR | x | 32 |
^ | Bitwise XOR | x ^ 128 |
= | Assign | x = 4 |
:= | Assign | x := 4 |
! | Not | if ( ! x ) |
[ | Array access | x[i], x[i,j], x[i][j] |
~ | Complement | ~x |
$ | Substring | x $ b |
? | Conditional | x = y ? a : b |
: | Conditional separator | x = y ? a : b |
. | Message send | obj.CalcData() |
@ | Reference | @x |
, | Sequential | x, y, x |
& | Compile | &"time()" |
- | Negate | -x |
-> | Workarea reference | contact->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
|