10 PRINT"HELLO":REM a comment
20 FOR I=1 TO 10:PRINT I:NEXT
10PRINT"HELLO":REM a comment
20 FORI=1TO10:PRINTI:NEXT
! -----------------------------------------------------------------------
! BASIC '64
!
! Beginner's All-purpose Symbolic Instruction Code
!
! "It is practically impossible to teach good programming style to students
! that have had prior exposure to BASIC; as potential programmers they are
! mentally mutilated beyond hope of regeneration."
!
! - Edsger W. Dijkstra
!
! BASIC is one of the oldest programming language and one of the most popular.
! It was developed in 1964 by John G. Kemeny and Thomas E. Kurtz to teach
! students the basics of programming concepts. At the advent of the microcomputer,
! BASIC was implemented on numerous platforms such as the Commodore, Atari,
! Apple II, Altair, IBM PC computers. Over time, BASIC evolved into GW-BASIC,
! QBasic, Visual Basic, and recently Visual Basic .NET.
!
! In practically all programming languages, the reserved word/symbol that denotes
! a comment is treated as a form of whitespace - having no effect in the manner in
! which the program runs. Once such type of comment is used to indicate the remainder
! of the line is to be ignored. These can be added to the end of any line without
! changing the meaning of the program. In C++, it is the '//' symbol;
! in BASIC '64 it is 'REM'.
!
! However, in the BASIC programming language, the line comment is treated like a
! statement. For instance, if 'REM' was a normal line comment:
!
! 10 PRINT "Hello World" REM Common first program
!
! would be a valid statement. However, in BASIC, this is illegal. In the example
! above, the comment must be added as an additional statement.
!
! 10 PRINT "Hello World" : REM Common first program
!
! As a result, the Line Comment terminal that is used in the GOLD Parser cannot be
! used here. In the grammar below, a 'Remark' terminal was created that accepts all
! series of printable characters starting with the characters "REM ". In some
! implementations of BASIC, any string starting with "REM" is a comment statement.
! Examples include "REMARK", "REMARKABLE" and "REMODEL". This grammar requires the space.
!
! This grammar does not include the editor statements such as NEW, SAVE, LOAD, etc...
!
! Note: This is an ad hoc version of the language. If there are any flaws, please
! e-mail GOLDParser@DevinCook.com and I will update the grammar. Most likely I have
! included features not available in BASIC '64.
! -----------------------------------------------------------------------
"Name" = 'BASIC (Beginners All-purpose Symbolic Instruction Code)'
"Author" = 'John G. Kemeny and Thomas E. Kurtz'
"Version" = '1964 - Original - before Microsoft enhanced the language for the IBM PC.'
"About" = 'BASIC is one of most common and popular teaching languages ever created. '
"Case Sensitive" = False
"Start Symbol" = <Lines>
{String Chars} = {Printable} - ["]
{WS} = {Whitespace} - {CR} - {LF}
NewLine = {CR}{LF}|{CR}
Whitespace = {WS}+
Remark = REM{Space}{Printable}*
ID = {Letter}[$%]?
String = '"'{String Chars}*'"'
Integer = {digit}+
Real = {digit}+.{digit}+
<Lines> ::= Integer <Statements> NewLine <Lines>
| Integer <Statements> NewLine
<Statements> ::= <Statement> ':' <Statements>
| <Statement>
<Statement> ::= CLOSE '#' Integer
| DATA <Constant List>
| DIM ID '(' <Integer List> ')'
| END
| FOR ID '=' <Expression> TO <Expression>
| FOR ID '=' <Expression> TO <Expression> STEP Integer
| GOTO <Expression>
| GOSUB <Expression>
| IF <Expression> THEN <Statement>
| INPUT <ID List>
| INPUT '#' Integer ',' <ID List>
| LET Id '=' <Expression>
| NEXT <ID List>
| OPEN <Value> FOR <Access> AS '#' Integer
| POKE <Value List>
| PRINT <Print list>
| PRINT '#' Integer ',' <Print List>
| READ <ID List>
| RETURN
| RESTORE
| RUN
| STOP
| SYS <Value>
| WAIT <Value List>
| Remark
<Access> ::= INPUT
| OUPUT
<ID List> ::= ID ',' <ID List>
| ID
<Value List> ::= <Value> ',' <Value List>
| <Value>
<Constant List> ::= <Constant> ',' <Constant List>
| <Constant>
<Integer List> ::= Integer ',' <Integer List>
| Integer
<Expression List> ::= <Expression> ',' <Expression List>
| <Expression>
<Print List> ::= <Expression> ';' <Print List>
| <Expression>
|
<Expression> ::= <And Exp> OR <Expression>
| <And Exp>
<And Exp> ::= <Not Exp> AND <And Exp>
| <Not Exp>
<Not Exp> ::= NOT <Compare Exp>
| <Compare Exp>
<Compare Exp> ::= <Add Exp> '=' <Compare Exp>
| <Add Exp> '<>' <Compare Exp>
| <Add Exp> '><' <Compare Exp>
| <Add Exp> '>' <Compare Exp>
| <Add Exp> '>=' <Compare Exp>
| <Add Exp> '<' <Compare Exp>
| <Add Exp> '<=' <Compare Exp>
| <Add Exp>
<Add Exp> ::= <Mult Exp> '+' <Add Exp>
| <Mult Exp> '-' <Add Exp>
| <Mult Exp>
<Mult Exp> ::= <Negate Exp> '*' <Mult Exp>
| <Negate Exp> '/' <Mult Exp>
| <Negate Exp>
<Negate Exp> ::= '-' <Power Exp>
| <Power Exp>
<Power Exp> ::= <Power Exp> '^' <Value>
| <Value>
<Value> ::= '(' <Expression> ')'
| ID
| ID '(' <Expression List> ')'
| <Constant>
<Constant> ::= Integer
| String
| Real
Yes. But note, just like Basic or C, whitespace is not part of the language in most languages apart from e.g. Python.The example is bad, because PowerBASIC has nothing to do with old 8bit vintage BASIC :
So Synedit will work for BASIC I have a PowerBASIC(successor to TurboBASIC) editor written using it, but I'll have to look it up in my archives. I rewrote it in PowerBasic..for fun.
(wasn't spoiled: I started with Fortran)
More difficult to handle with syneditfacil :
A=1.3E4
B=2.75E-5
10IFA=3THENGOSUB100
...otherelse, completion is not working.- completion do not workI see you're using SynFacilCompletion. Good. It's a SynFacilSyn with completion.
- Line Numbers are treated like regular Numbers
Here is my Github with a few of my projects if you wan't to have a look to what can be done with OSDK/Delphi/Lazarus for this Oric Atmos :
https://github.com/DJChloe?tab=repositories
I noticed that you are involved in 6502 programming too, more over I was surprised to discover that you develop a whole compiler for the Pascal language.
How fast or compact produced by your pascal ?Well. I always include optimization to my compilers :) (check my PIC compiler https://github.com/t-edson/PicPas) but I haven't had time to work in it for the 6502.
Do you think it can be adapted to Oric's world ?
..10 PRINT
.3...56 FOR I=1TO5
Ready
PRINT "Hello"
Ready
10 PRINT "Hello"
Ready
2 10 5PRINT"Hello"
The interpreter was removin the first whitespace character until a non number or non white character was meet, was recombining the numbers and was adding a space so that the listing was rewritten like this :Ready
LIST
2105 PRINT"Hello"
By the way, your solution fails here... mine is compliant.CLOAD "filename"(,S)
CLOAD ""(,S)
CLOAD "filename",J,(,S)
CLOAD "filename",V,(,S)
CLOAD "filename",V,(,S)
CSAVE "filename"(,AUTO)(,S)
CSAVE "filename",A adr,E adr(,S)
J=join (=merge) filename to existing BASIC listing in memory
V=verify filename on tape
AUTO=run the program AUTOmatically when using CLOAD
S=Program in "slow mode" on tape. Safer when loading back, but you were waiting 10 minutes instead of 3 in order to wait for your program to be loaded on the Oric !
I would like to see highlighter for MAkeFile ::)1) You are totally off topic, MakeFile is totally context-free, write an highlighter should not be difficult and has nothing in common with Vintage BASIC
There is a tutorialI felt myself upset at the beginning of this thread, like you did, I suppose, here : http://forum.lazarus-ide.org/index.php?topic=27152.0
http://wiki.lazarus.freepascal.org/SynEdit_Highlighter
By the way, your solution fails here... mine is compliant.
I have tried to fiddle with this without any success :
<!--Line number--> <Regex Text="[ ]*"/> <Regex Text="[0-9\s]+" />
Ideally, the use of grammar file should permit to redirect to an event handler in code or a script file.
Something like that, maybe :
<Regex Text="DATA" ifTrueCustomEvent="1"/>
TSynFacilSyn1.OnCustom1:=CustomTreatment1; procedure CustomTreatment1(TokPos:integer;TokString:string); begin if TokString='DATA' then begin ... end; end;
2) I know it is very frustrating to have answers like :I guess Martin_fr answer this way because he's very busy and tired of read people doing the same question about SynEdit. That's why he's wrote a tutorial. Probably not the best but it's a help.QuoteThere is a tutorial
http://wiki.lazarus.freepascal.org/SynEdit_Highlighter
There is a tutorial >:(
http://wiki.lazarus.freepascal.org/SynEdit_Highlighter
There are 200 pages documentation in Spanish and English >:D: >:D >:D
https://github.com/t-edson/SynFacilSyn/blob/1.21/Docs/Technical%20documentation%20-%20Rev1.odt
I would like to see highlighter for MAkeFile ::)
1) in your SynFacilUtils, on Github, there is missing Misutils.pas : it prevents to compile your editor.Included. Thanks for the observation.
2) When you open another file in your editor, there is a refresh problem with the syntax highlight : you are obliged to drop down the language menu and click again on your already selected language (I did not investigate this issue furthermore, but I am sure that you will sort it out).It's because highlighter is selected according with the file extension. I guess. Anyway it's justa a sample for using SynFacilUtils.
It's because highlighter is selected according with the file extension. I guess. Anyway it's justa a sample for using SynFacilUtils.No problem, I can go with it. It does the job : it permits to test quickly your library.
SynFacilUtils is not as complete or documented as SynFacilSyn. The aim is to facilitate the creation of IDE. But I've stopped developing it since I'm planning to replace (or change drastically) with another library with support for mutiple edition windows.