Loading...
Searching...
No Matches
alc new C

extend "C" to the MAX

introduction

Well, "C" is the most famous programming language in the world and the basis for almost everything in the computing world. The strategic goal in metaprogramming is to use the existing C programming language and add new language features that are used for integration.

the "new-C" has

static typing

All types are checked at compile time by default (like C)

  • A type in "new-C" is just like an ordinary "C" type, example: int, double etc
  • There are primitive-types always supported in the meta-kernel and the target-language called : MkKernel_PrimitiveType_C_API
  • There are special-types used to interact only with the kernel: MkKernel_Type_C_API
  • There are class-types used to provide a specific feature: example MkBufferS, MkTypeS
object-oriented programming (OOP)

A class-type is available and, like C, is also a static type, but can be checked at runtime if necessary (upgrade cast).

  • The class-type is an addition to the "C"-type-system and is a C-struct with a special format : MkTypeS
basic object class

Unlike C++ there is a root class MkObjectC and thus there is no need for a template or generic-type "nightmare" like in C++

clear names

All functions and names (including class, method and attribute) are unique and are therefore easily locatable via the TAG file.

The general name-syntax is:

usage syntax example
instance method PrefixClassMethod(Class hdl, ...) (runtime) MK_BUF MkBufferAppendSTR(MK_BUF const buf, MK_STRN const val)
class method PrefixClassAttribute(...) (static,runtime) MK_BUF MkBufferHandleResolve(MK_HDL const netHdl)
virtual method MkObjectMethod(Object hdl, ...) (runtime) void MkObjectLog(MK_OBJN const obj, MK_OBJ fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl) call
(runtime) void MkBufferLog(MK_BUFN const buf, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
...

The name-syntax is not fixed, the name in a specific target-langugage follow by default the "C" style but using the target-language-syntax, example for C#:

usage syntax example
instance method hdl.Method(...) doc_mk_cs_BufferAppendSTR
class method Class.Attribute(...) doc_mk_cs_BufferHandleResolve
virtual method obj.Method(...) doc_mk_cs_ObjectLog
doc_mk_cs_BufferLog
...

But even the target-language-syntax is not fixed and can be changed, example: use underscore notation :

usage syntax other syntax
instance method PrefixClassMethod(Class hdl, ...) prefix_class_method(Class hdl, ...)
class method PrefixClassAttribute(...) prefix_class_attribute(...)
virtual method MkObjectMethod(Object hdl, ...) prefix_object_method(Object hdl, ...)

code generation

To add a new feature into C additional code is required (e.g. class). However, the required code is NOT written by the programmer or the compiler (C++), but inserted DIRECTLY into the source code (.c or .h) by the alc-compiler-toolset , where the code ends up in release management where it is then safe and is verifiable.

  • alc is the synonym for all language compiler and is a toolset able to compile/generate/process every kind of structured data like programming-language, file-type, config-file etc.
  • the alc-compiler does not generate a specific BINARY format like gcc, the alc-compiler generate valid source-code, configuration-data etc used by a specific tool (like javac) as input.
safe pointer

like C, memory must be allocated and deallocated, but unlike C and C++, a pointer can be checked for validity or invalidity

  • The CORE-Problem of traditional "C" is the missing runtime-check of a pointer.
  • The check include pointer-valid, pointer-type and pointer-memory-size
tried and tested toolset
The "new-C" is still the "old-C" so you can still use your favorite toolset like gcc, make, ctage, vim, etc
built-in integration
The "new-C" was designed to automatically integrate with your favorite programming language, which means your "C" code can be reused in a variety of projects

example

back

theCompiler