From: skaller <skaller@users.sourceforge.net>
To: felix-language <felix-language@lists.sourceforge.net>
Cc: caml-list <caml-list@inria.fr>
Subject: Felix 1.0.20 released
Date: 12 Dec 2004 12:31:58 +1100 [thread overview]
Message-ID: <1102815117.2603.16.camel@pelican.wigram> (raw)
Felix version 1.0.20 is now stablised and 1.0.21 has been
opened as the development version. Felix is an Algol like
language with a strong functional subsystem and ML like typing.
Available with BSD like FFAU licence from
http://felix.sf.net
This version integrates Scott McPeaks Elkhound GLR parser
http://www.cs.berkeley.edu/~smcpeak/elkhound/
directly in the language.
A complete (but trivial) working example is given below
to indicate the what the integration looks like.
----------------------------------------------
include "std";
// the input string
data := "1+2+3$";
// a type for tokens
union token_t =
| TOK_EOF
| TOK_PLUS
| TOK_INT of int
;
// a token stream generator
var i = 0;
fun get_token():token_t =
{
ch := data.[i to i+1];
++i;
tok :=
match ch with
| "$" => TOK_EOF
| "+" => TOK_PLUS
| "1" => TOK_INT 1
| "2" => TOK_INT 2
| "3" => TOK_INT 3
endmatch
;
return tok;
}
// a type for expression terms
union expr_t =
| Integer of int
;
// a grammar for expressions
nonterm expr : expr_t =
| xx:expr TOK_PLUS y:TOK_INT =>
match xx with
| Integer ?i => Integer (i+y)
endmatch
| y:TOK_INT => Integer y
;
// a parser for our example
var z : 1 + int =
parse (the get_token) with
| e: expr => match e with | Integer ?i => i endmatch
endmatch
;
// print the result
match z with
| case 1 => { print "Error"; }
| case 2 (?i) => { print i; }
endmatch;
endl;
--
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850,
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net
reply other threads:[~2004-12-12 1:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1102815117.2603.16.camel@pelican.wigram \
--to=skaller@users.sourceforge.net \
--cc=caml-list@inria.fr \
--cc=felix-language@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox