Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - support language Clipper #484

Closed
marwin1991 opened this issue Jun 29, 2024 · 10 comments · Fixed by #485
Closed

Feature - support language Clipper #484

marwin1991 opened this issue Jun 29, 2024 · 10 comments · Fixed by #485

Comments

@marwin1991
Copy link
Contributor

Would it be hard to add support for this lang?

https://harbour.github.io/

@marwin1991
Copy link
Contributor Author

Harbour is a compiler for the xBase superset language often referred to as Clipper (the language that is implemented by the compiler CA-Clipper). Harbour is a cross-platform compiler and is known to compile and run on:

@marwin1991
Copy link
Contributor Author

"Clipper": {
  "complexitychecks": [
    "for ",
    "for(",
    "if ",
    "if(",
    "do while ",
    "while ",
    "else ",
    "elseif ",
    "else(",
    "switch ",
    "case ",
    "otherwise ",
    "begin sequence ",
    "end sequence ",
    "begin sequence(",
    "try ",
    "catch ",
    "finally ",
    "|| ",
    "&& ",
    "!= ",
    "== "
  ],
  "extensions": [
    "prg",
    "ch"
  ],
  "line_comment": [
    "//",
    "&&"
  ],
  "multi_line": [
    [
      "/*",
      "*/"
    ]
  ],
  "quotes": [
    {
      "end": "\"",
      "start": "\""
    },
    {
      "end": "'",
      "start": "'"
    }
  ]
}

@marwin1991
Copy link
Contributor Author

@marwin1991
Copy link
Contributor Author

example of test.prg

/* 
   This program demonstrates the calculation 
   of the factorial of a number using a function.
*/

FUNCTION Factorial( n )
   LOCAL result := 1
   LOCAL i

   // Loop from 1 to n
   FOR i := 1 TO n
      result := result * i
   NEXT

   RETURN result

// Main program execution starts here
FUNCTION Main()
   LOCAL num := 5
   LOCAL fact

   // Calculate the factorial of the number
   fact := Factorial( num )

   // Check if the factorial is greater than 100
   IF fact > 100
      ? "Factorial is greater than 100"
   ELSE
      ? "Factorial is less than or equal to 100"
   ENDIF

   RETURN

@marwin1991
Copy link
Contributor Author

image

I am wodering if we should split it to Clipper and Clipper Header ?

Exmple of header file:

/* 
   Constants and macro definitions for the program
*/

// Define a constant for the number to calculate factorial
#define NUM_TO_FACTORIAL  5

// Define messages to display
#define MSG_FACT_GT_100   "Factorial is greater than 100"
#define MSG_FACT_LE_100   "Factorial is less than or equal to 100"

// Define a macro for maximum factorial limit
#define MAX_FACT_LIMIT    100

// Prototype for the Factorial function
FUNCTION Factorial( n )
RETURN NIL

// Prototype for the Main function
FUNCTION Main()
RETURN NIL

@marwin1991
Copy link
Contributor Author

What is purpose of keywords? If its important we can use:

 "keywords": [
    "AND",
    "BEGIN",
    "CASE",
    "CATCH",
    "CLASS",
    "DO",
    "ELSE",
    "ELSEIF",
    "END",
    "ENDIF",
    "FUNCTION",
    "IF",
    "INHERIT",
    "LOCAL",
    "METHOD",
    "NEXT",
    "OR",
    "OTHERWISE",
    "RETURN",
    "SEQUENCE",
    "STATIC",
    "SUPER",
    "SWITCH",
    "THEN",
    "TRY",
    "WHILE"
  ]

@marwin1991 marwin1991 changed the title Feature - supprt language xHarbour Feature - support language Clipper Jun 29, 2024
@boyter
Copy link
Owner

boyter commented Jun 30, 2024

Sorry this came in on the weekend hence the late response. I have merged your PR in, but the support for header files and clipper files is probably best answered by you. I am not familiar with the language at all.

As for the keywords, thats used in case there is clash on the filename extension. An example being verilog, coq and v which all use .v

If the extension is unique there is no need to supply it.

@marwin1991
Copy link
Contributor Author

@boyter Do you have plans for release 3.3.5 version ? I can't wait to test it 😀🔥

@boyter
Copy link
Owner

boyter commented Jul 2, 2024

I may release it before I go on break. I have most of a performance regression in place. Id like to solve it all, but perhaps it can wait.

@boyter
Copy link
Owner

boyter commented Jul 2, 2024

Ah screw it. Done. Enjoy the new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants